You need a Loop which gives you Positions before OrderSelect().
for(i=OrdersTotal()-1; i>=0; i--){ if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)){
Thanks Ubzen for your support but this not the issue the issue it i can't a sign a value for globe variable
What value do you get for:
Comment("Top Opposite points is : ",Opp);And what do you think it should be?
semotallica:
Dear's,
Kindly i need to know how to make global variable to change by any section as if trade between -3 to -5 Opp = 0 else put the lowest value of trade and put it in Opp
It is not clear exactly what you mean but I have had a go below. Please note ubzen's comment that you have given the wrong parameters to the OrderSelect() function.
extern int Opp = 0; int tradeMin= 123456789; int start(){ if( !OrderSelect(0,SELECT_BY_POS,MODE_TRADES) ) return( 0 ); // so we now have a valid selected order int trade = MathFloor( OrderProfit()/ (OrderLots()*MarketInfo(OrderSymbol(),MODE_TICKVALUE)) ); if( tradeMin > trade ) tradeMin = trade; if( trade >= -50 && trade <= -30 ) Opp = 0; else Opp = tradeMin; return( 0 ); }
dabbler:
I didn't understand either . . . so I didn't reply . . it occurs to me that returning anything from start is pretty much pointless though (especially when it is type void) . . . maybe the OP meant to use a different function name and this was meant to be a custom function . .
It is not clear exactly what you mean
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Dear's,
Kindly i need to know how to make global variable to change by any section as if trade between -3 to -5 Opp = 0 else put the lowest value of trade and put it in Opp
Please advice
BR
Semotallica