how to make Global variable can be change at any Section
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)){
What value do you get for:
Comment("Top Opposite points is : ",Opp);And what do you think it should be?
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 ); }
It is not clear exactly what you mean
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