Mql4 Error Zero Divide
03:35 Hi I'm making a signal table where i'm going to put signals of indicators I like, so today I made a function that returns a signal for the indicator StepMA Stoch, now the problem is that sometimes it gives an error Zero Divde and most wierd thing is that sometimes, not aways, when I remove the function the error stops to show. So the problem is in the function's code but I don't know where because I tryied a lot and got no solution, thanks in advance. int StepMAStochSignal(string nSymbol, int PeriodWATR=7, double Kwatr=0.7, int HighLow=0) { inti,shift,TrendMin,TrendMax,TrendMid; double SminMin0,SmaxMin0,SminMin1,SmaxMin1,SumRange,dK,WATR0,WATRmax,WATRmin,WATRmid; double SminMax0,SmaxMax0,SminMax1,SmaxMax1,SminMid0,SmaxMid0,SminMid1,SmaxMid1; double linemin,linemax,linemid,Stoch1,Stoch2,bsmin,bsmax; double nSignalS1[2]; double nSignalS2[2]; intnBars; nBars = iBars(nSymbol,PERIOD_H1) - (iBars(nSymbol,PERIOD_H1)-36); for(shift=nBars-1;shift>=0;shift--) { SumRange=0; for (i=PeriodWATR-1;i>=0;i--) { dK = 1+1.0*(PeriodWATR-i)/PeriodWATR; SumRange+= dK*MathAbs(iHigh(nSymbol,PERIOD_H1,i+shift)-iLow(nSymbol,PERIOD_H1,i+shift)); } WATR0 = SumRange/PeriodWATR; WATRmax=MathMax(WATR0,WATRmax); if (shift==nBars-1-PeriodWATR) WATRmin=WATR0; WATRmin=MathMin(WATR0,WATRmin); int StepSizeMin=MathRound(Kwatr*WATRmin/Point); int StepSizeMax=MathRound(Kwatr*WATRmax/Point); int StepSizeMid=MathRound(Kwatr*0.5*(WATRmax+WATRmin)/Point); if(HighLow>0) { SmaxMin0=iLow(nSymbol,PERIOD_H1,shift)+2*StepSizeMin*Point; SminMin0=iHigh(nSymbol,PERIOD_H1,shift)-2*StepSizeMin*Point; SmaxMax0=iLow(nSymbol,PERIOD_H1,shift)+2*StepSizeMax*Point; SminMax0=iHigh(nSymbol,PERIOD_H1,shift)-2*StepSizeMax*Point; SmaxMid0=iLow(nSymbol,PERIOD_H1,shift)+2*StepSizeMid*Point; SminMid0=iHigh(nSymbol,PERIOD_H1,shift)-2*StepSizeMid*Point; if(iClose(nSymbol,PERIOD_H1,shift)>SmaxMin1) TrendMin=1; if(iClose(nSymbol,PERIOD_H1,shift)
To add comments, please log in or register What are the latest MQL5.community news? The Wall section will tell you! 9660 Adam Perkins 2014.07.23 04:25 Hello,I have an indicator I'm working on that when it is first placed on the chart, the bollinger band values are zero and I end up with a zero divide message in both MT4 and MT5. After the bollinger band values and the indicator have a chance to calculate, it displays correctly but appears again when i change the chart or timeframe (and sometimes the indicator doesn't display after the change).What can I do to avoid the zero divide error? Is there a wait until loaded function? Or should I https://forum.mql4.com/13803 put the division calculation in an if statement to wait until the bollinger values are above zero?Thank you Actual COMBO Depth of Market AND Tick Volume Chart by Sergey Andreev 12.50 This indicator allows you to enjoy the two most popular products for analyzing request volumes and market deals at a favorable price: Actual Depth of Market Chart Actual Tick Footprint Volume ChartThis product combines the power of both indicators https://www.mql5.com/en/forum/34578 and is provided as a single file. The functionality of Actual COMBO Depth of Market AND Tick Volume Chart is fully identical to the original indicators. You will enjoy the power of these two products combined into the single super-indicator! Elder SafeZone Long by Financial Trading Seminars Inc. 15 SafeZone is a method for setting stops on the basis of recent volatility, outside the level of market noise. It is described in "Come into my Trading Room" book. In an uptrend, SafeZone defines noise as that portion of the current bar that extends below the low of the previous bar, going against the prevailing trend. It averages the noise level over a period of time and multiplies it by a trader-selected factor. For long trades, SafeZone subtracts the average noise level, multiplied by a fac Jaeger MT5 by Alexander Vinogradov 10 Monitoring and Trend Analysis This product shows the trend strength levels based on 16 standard indicators, time periods and currency groups. Depending on the current trend, the indicator colors change from green to red, allowing you to see the full picture. Advantages Whatever your trading method and strategy are, you should always know, in which direction you are trading and what the probability of the trend c
guest with limited access. Please take a minute to join our FOREX community. You will gain free unlimited access to best FOREX trading systems, forex articles, Metatrader http://www.fxfisherman.com/forums/forex-metatrader/metatrader-zerocode/8794-help-me-fix-zero-divide-problem.html indicators, Metatrader expert advisors and a lot more free MT4/MT5 scripts. Sign Up Now Community Links Social Groups Pictures & Albums Search Forums Show Threads Show Posts Tag Search Advanced Search Go to Page... LinkBack Thread Tools Search this Thread Display Modes Help me fix zero divide problem #1 (permalink) 08-22-2010, 03:55 PM cheshire Currency Trader Join Date: mql4 error Apr 2008 Posts: 4 Help me fix zero divide problem Hi there, can someone fix the zero divide error for my ea that link neuroshell and mt4. when it want to make a trade...then the zero divide problem occur and please check also whether stop loss,take profit and trailing stop will create a zero divide problem also...thanks in advance...your help is much more appreciated... mql4 error zero Attached Files MTFeed.mq4 (32.9 KB, 28 views) Maybe You need the MTFeedClient.dll put in libraries #2 (permalink) 09-03-2010, 05:24 PM metatradercoder Currency Trader Join Date: Sep 2010 Posts: 4 Maybe You need the MTFeedClient.dll put in libraries Quote: Originally Posted by cheshire Hi there, can someone fix the zero divide error for my ea that link neuroshell and mt4. when it want to make a trade...then the zero divide problem occur and please check also whether stop loss,take profit and trailing stop will create a zero divide problem also...thanks in advance...your help is much more appreciated... by the time I downloaded and opened.. I saw Import function MTFeedClient.dll. I think you need to put the .dll file, so that the ea can use the function from MTFeedClient.dll I will try to check further metatradercoder@yahoo.com « Previous Thread | Next Thread » Thread Tools Show Printable Version Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Search this Thread Advanced Search Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit yo