Hi Jack,
you should try something link this:
void OnTick() { int CountProfit = 0; double InProfit=OrderLots()*50; for(int Loop=OrdersTotal()-1;Loop>=0;Loop--) { if (OrderSelect(Loop,SELECT_BY_POS,MODE_TRADES) == true) { if (OrderProfit() > InProfit) CountProfit++; } }
I think, this is something the way you want to do.
Best regards,
Werner
Hi Jack,
you should try something link this:
I think, this is something the way you want to do.
Best regards,
Werner
Hi Jack,
my code was just a suggestion how you can solve your problem. You have to
check the CountProfit variable and you should think about the way you calculate
the InProfit variable. If you want to leave it that way, you should put if in the
for-loop before like this:
int CountProfit = 0; for(int Loop=OrdersTotal()-1;Loop>=0;Loop--) { if (OrderSelect(Loop,SELECT_BY_POS,MODE_TRADES) == true) { double InProfit=OrderLots()*50; if (OrderProfit() > InProfit) CountProfit++; } }
Best regards,
Hi Jack,
my code was just a suggestion how you can solve your problem. You have to
check the CountProfit variable and you should think about the way you calculate
the InProfit variable. If you want to leave it that way, you should put if in the
for-loop before like this:
Best regards,

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all
I'm in need of help with the code below. I would like to open 2 more trades if/once they go in 5 pips profit.
I know noticed by using OrderLots()*50 is completely wrong. At times they would not open at all or open at 8 or 14 pips. I would like to know what functions are the correct one or other ways to do this the right way.