nee help....
MaxTime=0; LastTicket=0; for(int i=OrdersTotal()-1;i>=0;i--){ OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(MaxTime<OrderOpenTime()){ MaxTime=OrderOpenTime(); LastTicket=OrderTicket(); } } for(i=OrdersTotal()-1;i>=0;i--){ OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderTicket()!=LastTicket){ OrderClose(...) } }
cool.. thanks Integer ^^
hi, Interger. how to add lot here?
is it correct?
for example below
extern double Lots = 0.1; <<< only this lots not delete
1, ticket 1111 lot 0.1 time 9.00 <close order
2, ticket 1112 lot 0.2 time 9.02 <close order
3, ticket 1113 lot 0.3 time 9.03 <close order
4, ticket 1114 lot 0.1 time 9.04 < stay dont clos
is it correct?
for example below
extern double Lots = 0.1; <<< only this lots not delete
1, ticket 1111 lot 0.1 time 9.00 <close order
2, ticket 1112 lot 0.2 time 9.02 <close order
3, ticket 1113 lot 0.3 time 9.03 <close order
4, ticket 1114 lot 0.1 time 9.04 < stay dont clos
extern double Lots = 0.1; int MaxTime=0; int LastLots=0; int LastTicket=0; for(int i=OrdersTotal()-1;i>=0;i--){ OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(MaxTime<OrderOpenTime() && LastLots<NormalizeDouble( OrderLots(), 3 )){ MaxTime=OrderOpenTime(); LastLots=Lots; LastTicket=OrderTicket(); } } for(i=OrdersTotal()-1;i>=0;i--){ OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderTicket()!=LastTicket){ OrderClose(...) } }
This code will leave only latest order from the orders with the lot size less than
0,1
anyone have idea, close all the order and leave last one order stay?
example order below
buy profit, close all and stay last one
1, ticket 1111 lot 0.1 time 9.00 <close order
2, ticket 1112 lot 0.1 time 9.02 <close order
3, ticket 1113 lot 0.1 time 9.03 <close order
4, ticket 1114 lot 0.1 time 9.04 < stay dont close
because i try and try. still can't stay last order, need help.
thanks
egt520