Trade Contextは忙しいです。その理由がわかりましたが、解決策が必要です。
8件の返信
ok first let me explain what im trying to do so you all know what im missing
my expert will open a trade based on my strategy at 9.00AM everyday
and since it only open 1 trade a day , i decided to run the expert on 15 charts
when it is 9.00am , some of the trades get open and some get “Trade Context is busy” error
i know this is happening because im sending too much orders to the server
how can i avoid that ?
i have 8 Trading Rules

何かアイデアはありますか?
0
こんにちは,
you could edit the final code and place the following code just before an order is placed / closed to prevent this error, while still executing the trade / exit.
while(IsTradeContextBusy()) Sleep(100); RefreshRates();
0
こんにちは,
you could edit the final code and place the following code just before an order is placed / closed to prevent this error, while still executing the trade / exit.
while(IsTradeContextBusy()) Sleep(100); RefreshRates();
thank you for your reply.
shall i put the code before the order execution only or before & after ?
0
here is an example , is that the right place to put the code in ? 😆
// test
while(IsTradeContextBusy()) Sleep(100);
RefreshRates();
if(sqIsBarOpen == true) {
if ((Close[1] > iSAR(NULL, 0 , 0.02 , 0.2 , 1)))
{
sqOpenOrder("NULL", OP_BUY, getOrderSize(1000, OP_BUY ), getOrderPrice(1000), "", 1000, "test");
}
}
return(0);
}
0
yes, this should work. It can be also placed into the body of bool sqOpenOrder() function which is bit lower right behind
bool sqOpenOrder(string symbol, int orderType, double orderLots, double price......
because you always call this function to create an order from multiple conditions
0
yes, this should work. It can be also placed into the body of bool sqOpenOrder() function which is bit lower right behind
bool sqOpenOrder(string symbol, int orderType, double orderLots, double price......because you always call this function to create an order from multiple conditions
still having the same problem
im thinking of adding time delay after each order (lets say 2 seconds) , the problem is that the ea will use the same 2 seconds on each chart. so I’ll get the same problem again because im using 15 charts
any ideas to implement random delay after each order ? (from 1 up to 15 seconds , its ok)
0
hello ……. it’s me
0
こんにちは,
you can try to play with Sleep value or try another method and wrap the code like this (using if (IsTradeAllowed())
if(IsTradeAllowed())
if(sqIsBarOpen == true) {
if ((Close[1] > iSAR(NULL, 0 , 0.02 , 0.2 , 1))) {
sqOpenOrder("NULL", OP_BUY, getOrderSize(1000, OP_BUY ), getOrderPrice(1000), "", 1000, "test");
}
}
}
0
8件の返信を表示中 - 1 - 8件目 (全8件中)