Do you want to exclude a profitable order if there was one? What code have you got so far?
ubzen:
Do you want to exclude a profitable order if there was one? What code have you got so far?
Do you want to exclude a profitable order if there was one? What code have you got so far?
It isn´t suppose to be there a profitable trade, because what I want is to place an order only if there are losing orders, to hedge it.
Untill now I haven´t any code, just considering how to get this part of the trading system.
Something like this:
int start(){ //~~~~~~~~~~ int Loss, Size; for(int i=OrdersTotal()-1;i>=0;i--){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true && OrderSymbol()==Symbol()){ //~~~~~~~~~~ if(OrderProfit()<0){ Size=Size+OrderLots(); Loss=Loss+OrderProfit(); } } } //~~~~~~~~~~ Alert(Loss,"__",Size); //~~~~~~~~~~ return(0);}
ubzen:
Something like this:
I will try it.
Thank you very much.
ubzen:
Something like this:
It works fine. Thanks again. :)

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,
I want to run a cicle to look for the negative amount of money in open buy/sell orders.
Exemple, if I have 3 open buy orders, one losing 20 pips, other losing 50 pips and another losing 33 pips, which means at that point a total of 83 negative pips.
How can I get look for that 83 value, and for the total of open orders (3)?
Regards