hi
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);
- 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.
- 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;
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]if(ObjectFind("fastsma")==-1) { ObjectCreate("fastsma"+i,OBJ_HLINE,0,0,fastsma);
You look for "fastsma" which NEVER exists, (you create "fastsma"+i.)
WHRoeder:
- 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.
- No need for the decrement Contradictory information on IndicatorCounted() - MQL4 forum
-
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)
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