Ok, now it works with Time[1].
The problem is that if I write
total = OrdersTotal(); Num_Order_Long_6 = 0; Num_Order_Short_6 = 0; for(cnt=0;cnt<=total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY); if (OrderType()==OP_BUY) { Num_Order_Long_6++; } if (OrderType()==OP_SELL) { Num_Order_Short_6++; } }
It returns Num_Order_Long_6 > 0 and it's ok because I have an order in the history trades.
If I write
total = OrdersTotal(); Num_Order_Long_6 = 0; Num_Order_Short_6 = 0; for(cnt=0;cnt<=total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY); if (OrderSymbol()==Symbol() && OrderMagicNumber()==1 && OrderOpenTime()>= Time[1] ) { if (OrderType()==OP_BUY) { Num_Order_Long_6++; } if (OrderType()==OP_SELL) { Num_Order_Short_6++; } } }
It gives me 0 and I don't understand why. The magic numer and the symbol are ok.
You are using OrdersTotal() as a counter, but checking history
Use OrdersTotal() for open trades and OrdersHistoryTotal() when checking history
Thank you! Now it works well
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all, I don't know how to recall the last bar open time.
Could you help with the below code? I need to replace the string "LAST BAR OPEN TIME".
Thank you!!!