[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 474

 
for (int j=OrdersHistoryTotal(); j>=0; j--) 
{ 
OrderSelect(j, SELECT_BY_POS, MODE_HISTORY);
if (OrderType()==OP_BUY||OP_SELL)
{
if (OrderStopLoss()>0)
{
if (OrderProfit()>0)
{



 
}
}
}
}
Help me understand after all the conditions are met there is more than one order left, how do I pull out exactly the last closed order
 
vik-777:
Help me understand after all the conditions are met there is more than one order left, how do I pull out exactly the last closed order
Compare all OrderCloseTime() and save separately the Ordererticket() of the one which is currently closed the latest
 
ilunga:
compare everyone's OrderCloseTime() and save separately the Ordererticket() of the one that is currently closed later than everyone else's
thank you, can you tell me more about how to compare them by time
 
vik-777:
Thank you, can you tell me more about how to compare the timing?
datetime max_time = 0;
int      max_ticket = 0;
for (int j=OrdersHistoryTotal(); j>=0; j--) 
{ 
OrderSelect(j, SELECT_BY_POS, MODE_HISTORY);
if (OrderType()==OP_BUY||OP_SELL)
{
if (OrderStopLoss()>0)
{
if (OrderProfit()>0)
{
if (OrderCloseTime() > max_time)
{
   max_ticket = OrderTicket();
   max_time = OrderCloseTime();
}
}
}
}
}
 
ilunga:

Thank you
 

Good day!

Please suggest some resource with working (or at least hopeful) trading strategies. If it exists ))))

 
demlin:

Good day!

Please suggest some resource with working (or at least hopeful) trading strategies. If it exists ))))


Any strategy that works, as long as it has become yours of course
 
demlin:

Good day!

Please suggest some resource with working (or at least hopeful) trading strategies. If it exists ))))


Have you failed?)) Have a look at the Championship page. There's a website that offers several options. But again, this is just a tool. Just by putting it on the chart you can't be in profit all the time. You have to know how to deal with it. Hedging, diversification, capital and risk management. It all has to be native and understandable.)))
 
tol64:

Couldn't get over it?)) Have a look at the Championship page. There's a website that offers several options. But again, this is just a tool. Just putting it on the chart doesn't get you to be in profit all the time. You have to know how to deal with it. Hedging, diversification, capital and risk management. This all should be native and understandable))).

I am sorry, maybe this is a wrong topic, tell me why the EA works in the Strategy Tester but it does not open live or demo trades.
Files:
 
tol64:

Couldn't get over it?)) Have a look at the Championship page. There's a website that offers several options. But again, this is just a tool. Just by putting it on the chart you can't be in profit all the time. You have to know how to deal with it. Hedging, diversification, capital and risk management. This all should be native and understandable))).
Thank you I will have a look