your time reeset is 1 min
since nth ordinal number is updated 1 all the time
what you haave is order#1, then order#1. not #2 and so on . .
you had better if you choose for GOLD 500
each day 10%,,,, https://www.forexfactory.com/thread/1371538
1
TMA-RSI-Bands (RSI Of TMA Centered + Bands) 28 replies
Need small modification on my RSI cross/touch RSI alert 0 replies
RSI cross indicator when rsi=50 19 replies
RSI (Fast) above/below RSI (Slow) displayed as a Histogram 5 replies
Disliked{quote} Maybe detect trade context changes that affect your cached valuesIgnored
Dislikedmt4 only: i face this problem (special case) prev: we mention that: i make mt4 like mt5 to avoid unnessacy repetitive calualtions . . for example: buy orders, avg price , and any value that will never change if there is no new order?? {image} the problem is: assume there are 100 open orders and 20 pendin orders --- total: 120 order if any pending is opened . . total is still 120 ?? and avg price, open postions will not be updated ! ! who has smart logic to solve this problem above code can not offer any help,, it is valid only if last ticket changed...Ignored
bool last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES);
double last_account_margin=AccountMargin();
if(OrderTicket()!=last_order_ticket)
{
orders=OrdersTotal();
last_order_ticket=OrderTicket();
OnTrade();
}
else if(orders!=OrdersTotal())
{
new_order_update();
orders=OrdersTotal();
last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES);
last_order_ticket=OrderTicket();
OnTrade();
}
else if(last_account_margin!=AccountMargin())
{
last_account_margin=AccountMargin();
orders=OrdersTotal();
datetime last_order_time=0;
for(int i=0; i<orders; i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
{
if(last_order_time<OrderOpenTime())
{
last_order_time=OrderOpenTime();
last_order_ticket=OrderTicket();
}
}
}
}
//new_order_update();???
OnTrade();
} Disliked{quote} i don't know if this is a solution or not bool last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES); double last_account_margin=AccountMargin(); if(OrderTicket()!=last_order_ticket) { orders=OrdersTotal(); last_order_ticket=OrderTicket(); OnTrade(); } else if(orders!=OrdersTotal()) { new_order_update(); orders=OrdersTotal(); last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES); last_order_ticket=OrderTicket(); OnTrade(); } else if(last_account_margin!=AccountMargin()) { last_account_margin=AccountMargin();...Ignored
int last_margin;
int user_update=17;
void OnTimer()
{
mouse_timer++;
current_time=TimeLocal();
if(mouse_timer>5000) mouse_timer=1;
if(mouse_timer>SAFTEY_TIMER) Mouse_Click_Locked="NO";
bool last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES);
if(OrderTicket()!=last_order_ticket)
{
Print("OrderTicket()!=last_order_ticket");
orders=OrdersTotal();
last_order_ticket=OrderTicket();
OnTradeX();
}
else if(orders!=OrdersTotal())
{
Print("orders!=OrdersTotal()");
orders=OrdersTotal();
last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES);
last_order_ticket=OrderTicket();
OnTradeX();
}
else if(last_margin!=int(AccountMargin))
{
Print("last_margin!=int(AccountMargin)");
last_margin=int(AccountMargin);
OnTradeX();
}
else if(mouse_timer%user_update==0)
{
Print("mouse_timer%user_update==0");
OnTradeX();
}
} Disliked{quote} i don't know if this is a solution or not bool last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES); double last_account_margin=AccountMargin(); if(OrderTicket()!=last_order_ticket) { orders=OrdersTotal(); last_order_ticket=OrderTicket(); OnTrade(); } else if(orders!=OrdersTotal()) { new_order_update(); orders=OrdersTotal(); last_order_select=OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES); last_order_ticket=OrderTicket(); OnTrade(); } else if(last_account_margin!=AccountMargin()) { last_account_margin=AccountMargin();...Ignored
DislikedIAM THINLING in these messages, if there is any, block send orders for 10 minutes, for example, blocktime,, you set in pre-set file it will include err#134, 132, , {image}Ignored