It's difficult to understand you. You could use a translation tool.
I don't find it difficult at all.
I find it impossible to understand.
I don't find it difficult at all.
I find it impossible to understand.
update code ~ check later is after few seconds to read the flag. >> I not special to descriptor it.
At the moment you are allocating a local object in OnTrade:
void OnTrade(void) { COrderInfo m_order; ... } // <- m_order goes out of scope, so its information is lost
You could use a CHashMap or CList to add your order info instance to the global scope.
If you only have 1 open position at any time, you could just make COrderInfo global.
Solution #1: (one open position at any time)
COrderInfo MyOrder; void OnTrade(void) { MyOrder.Select(my_result.order); ... }
Solution #2: (multiple positions/orders)
#include <Generic/HashMap.mqh> CHashMap<ulong,COrderInfo*> MyOrders; void OnTrade(void) { COrderInfo *info=new COrderInfo; info.Select(my_result.order); MyOrders.Add(my_result.order,info); ... } void CheckOrder(ulong order) { COrderInfo *info; if(MyOrders.TryGetValue(order,info)) Print("order #",order," newproperty=",info.newproperty()); else Print("order #",order," not found"); }
my case will be mutiple
>> And your response is great help, I will try next Sunday
If I use as global scope. I need to maintain the life scope. I think this don't keep OO thinking andmaybe
more trouble many warier message >.<.
I get confuse that we can get order by select(ID). I think it's mean there is one global
in the system, if possibble to update this one as on trade or open operation
Not create an new COrderInfo HashMap?
m_order.PropertyChange(3);
m_order.StoreState();
my case will be mutiple >> And your response is great help, I will try next Sunday
ok great
If I use as global scope. I need to maintain the life scope. I think this don't keep OO thinking andmaybe more trouble many warier message >.<.
I get confuse that we can get order by select(ID). I think it's mean there is one global in the system, if possibble to update this one as on trade or open operation
Not create an new COrderInfo HashMap?
Sorry, but I cannot understand you. I suggest to type your request in native language and use a translation tool.
COrderInfo.Select() reads information from the trade server/MT terminal cache. This is distinct from the global variable scope of an EA.
//+------------------------------------------------------------------+ //| Selecting an order to access | //+------------------------------------------------------------------+ bool COrderInfo::Select(void) { return(OrderSelect(m_ticket)); }
I use method 2,the simple verify result Success!! (only try CHashMap add ,no delete >,<)
COrderInfo.Select() reads information from the trade server/MT terminal cache. This is distinct from the global variable scope of an EA.
<< COrderInfo.Select() reads information from the trade server/MT terminal cache. so lt's mean there will not a copy in client(our PC).
I think you already answer me. I get it.
Before you tell this, I thought client and server both will maintain one order list, and
client will sync order request to trade server.
If we have DOC about how to read data from MT terminal cache.
And relative question is that if local not maintain a order list , some case ex server not response ... sever issue may not verify be client ?
Maybe like slip, the data you see (local order time,price) --->> server( transaction time ,price)
Before you post
I write xxEA
CTrade m_trade;
void OnTrade(void)
{
COrderInfo m_order;
if ( OrderGetInteger(ORDER_STATE)==ORDER_STATE_PLACED)
{
m_order.CheckState();
m_order.PropertyChange(3);
m_order.StoreState(); >>>>>>>>>>>>>>>>>>>//store to Global (MT5 library maintain)
.....
}
}
Now
Local PC ---------<<<<<<<<<<<<<------------------------->>>>>>>>>>>>------ Brokers Server (local var) Order >> net buffer ? >>>> Order (each client get one order list) (Read from MT cache) Result << net buffer <<<< execution Result data Data pass by my_result << need pervert it overwrite by next tick. ?
data always sync from server and update as transaction send the result to client.
MT5 App/ MT5 PC client has a loop always check the sever update new result.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
uint m_newproperty;
public:
uint newproperty(void) const;
uint newpropertyChange(const uint newproperty) ;
}
void OnTrade(void)
{
COrderInfo m_order;
m_order.Select(my_result.order);
if ( OrderGetInteger(ORDER_STATE)==ORDER_STATE_PLACED)
{ m_order.CheckState();
m_order.PolicyChange(3);
m_order.StoreState();
m_ticket=my_result.order;
}
}