Download MetaTrader 5
To add comments, please log in or register
Register as a seller and start making profit!
ankityadav
208
ankityadav 2014.03.28 11:53 
hi
whroeder1
13644
whroeder1 2014.03.28 12:51  
ankityadav: t doesn't seems to work and
    double fastPre=iBands(NULL,0,InpFastSMA,FastInpdev,0,PRICE_CLOSE,MODE_SMA,limit+1);
    double slowPre =iBands(NULL,0,InpSlowSMA,SlowInpdev,0,PRICE_CLOSE,MODE_SMA,limit+1);
  1. Your look back is max(InpFastSma, InpSlowSma) + 1 but your loop starts at limit=Bars-1, so you are looking past the limits of the chart.
  2. No need for the decrement Contradictory information on IndicatorCounted() - MQL4 forum
      if(counted_bars<0) return(-1);                       
    //if(counted_bars>0) counted_bars--;
      int lookback = MathMax(InpFastSMA, InpSlowSMA)+1;
      if(counted_bars < lookback) counted_bars = lookback;
      limit=Bars-counted_bars-1;                           
    

  3. ObjectSet("fastsma"+i,OB...
    The fiirst time you create fastsma+0, fastsma+1,... On the next bar with a cross you again try to create fastsma+0, thus removing the previous one(s). Don't use a shift number in your object names, shifts are not constant. use fastsma+Time[limit]
  4.        if(ObjectFind("fastsma")==-1)
             {
                ObjectCreate("fastsma"+i,OBJ_HLINE,0,0,fastsma);
    You look for "fastsma" which NEVER exists, (you create "fastsma"+i.)


ankityadav
208
ankityadav 2014.03.28 13:07  
WHRoeder:
  1. Your look back is max(InpFastSma, InpSlowSma) + 1 but your loop starts at limit=Bars-1, so you are looking past the limits of the chart.
  2. No need for the decrement Contradictory information on IndicatorCounted() - MQL4 forum

  3. The fiirst time you create fastsma+0, fastsma+1,... On the next bar with a cross you again try to create fastsma+0, thus removing the previous one(s). Don't use a shift number in your object names, shifts are not constant. use fastsma+Time[limit]



Hi thanks for your reply but i have changed the code but seems the same result dont know why what is happening if you remove

fastsma<=Bid-(NormalizeDouble(DistancePips*mPoint,Digits))

and if you remove both condition then it works but if you add this condition it stops working don't know why it stops .And also if you changed the sign of both condition then you can it working again but the logic was different behind that

fastsma>=Bid+(NormalizeDouble(DistancePips*mPoint,Digits)
/
To add comments, please log in or register