Zero divide time frame dependent - page 2

 
Mike Tanton:

...take it easy sd59... Roeders' point is that the Volume (not your OBV - volume) will probably never be "exactly" zero.. 0.000000... I think

PS: this trick does not only work for the OBV... whenever I get a Zero Divide... I check the relevance of it and then just over-ride it...

Go for it...

Edit:... try not to piss Roeder off...lol

yep, thanks again for your comments. I shouldn't have mentioned the 'Volume' because people start to digress. The real issue is as you see above - a printout of the variable volume (OBV value) above with a greater than zero value. Then on the next line it turns to zero..and to cap it all it only happens on the M1 TF!

Oh well I guess it'll remain a mystery.

thanks again.

 

No problem... these things are sent to test us... and they always do...

PS: It was just a matter of time before it hit you on the higher TF's... anyways

 

As a matter of interest... if you are using the OBV... then you should try adding the AD, ASI and OBV together... makes it a little bit more "stable"...

int start()                         
  {

   for(int i=MaxBars; i>=0; i--)             
     {

         Line[i]=(  iCustom(Symbol(),0,"Rhythm_AD_Calibrated",0,i)
                  + iCustom(Symbol(),0,"Rhythm_OBV_Calibrated",0,i)
                  + iCustom(Symbol(),0,"Rhythm_ASI_Calibrated",0,i))/3;
         
         Zero[i]=0;

     }

...sorry, those are my "Custom" indies... but iAD, iASI and iOBV... etc.

But, it's important to "Calibrate" them... so that they each have an equal value contribution....
 

Interesting...I'm not familiar with iASI - which one is it here: https://docs.mql4.com/indicators

Is it Money Flow Index?

Technical Indicators - MQL4 Reference
Technical Indicators - MQL4 Reference
  • docs.mql4.com
For an Expert Advisor (or any other MQL4 program) to take up the value of any indicator, it is not necessary that this indicator is present in the chart. The requested indicator will be loaded and calculated in the thread of the module that has called it. Any indicator can be calculated on the data of not only current chart, but also on the...
 
sd59:

Interesting...I'm not familiar with iASI - which one is it here: https://docs.mql4.com/indicators

Is it Money Flow Index?

Ummm... the Accumulative Strength Index (I think)... I thought it was part of the platform indi's...  I'll see if I can attach it for you...

But it's important to "Calibrate" them... for eg. the...(rounded)

Ad (EURUSD) value currently = -10 000

OBV   "          ditto    "           = -49 000

ASI     "      ' '               "         = 94


BUT... I am presuming that you are taking the "Slopes" of these indi's????

Files:
 

Thanks for this I'll try it out next week. I'm using the absolute values for volume spread analysis and looking to get the best signal.

Using just Volume is not too bad but hey if I can use other indies to get a better signal then happy days!

I think just using absolute values of the momentum indies added together as you suggest might be good to try but I don't want to digress too much from true VSA. 

 

Agggh... I'm going down a rabbit hole here...but,

The "Un-Calibrated" slope (Max) values of these indi's are:

AD = 1208

OBV = 1501

ASI = 42

So, if you had to add them together and then divide by 3... you will be getting a "False" value... The OBV will have more "weight" in the calculation as opposed to the ASI... if that makes any sense...


I hope I am not confusing you here...

 

To be honest... the only value these indis have are their "Slope"....

...but to calibrate them... then this is my code... take note of the "Zero-Divide Error" dodge....lol

int start()                         
{
//Indicator Calibration
double MaxIndiValue = 0.00001;
double IndiValue=0;
double CalibrationCoef=0;

   for(int x=200; x>=0; x--)             
     {
         IndiValue =   iCustom(Symbol(),0,"Rhythm_AD_Line",0,x);
         if(IndiValue > MaxIndiValue) MaxIndiValue = IndiValue;
         CalibrationCoef = 10/MaxIndiValue;
     }

   for(int i=MaxBars; i>=0; i--)  
     {
         Zero[i]=0;
         Line[i]= (  iCustom(Symbol(),0,"Rhythm_AD_Line",0,i))*CalibrationCoef;
     }   

ie. create a Custom Indi for each of the 3.... just making a line but making the access of the buffer value easy...

Then create another custom indi to giving you the slope of each...

Then "Calibrate" them...

Then get their average...

If that makes any sense....

Edit: I see that I Calibrated the indi's before I calculated the "Slope" values.... I think it would be better to calibrate things "After" calculating the slope... must have a look at this... thanks
 
Mike Tanton:

To be honest... the only value these indis have are their "Slope"....

...but to calibrate them... then this is my code... take note of the "Zero-Divide Error" dodge....lol

ie. create a Custom Indi for each of the 3.... just making a line but making the access of the buffer value easy...

Then create another custom indi to giving you the slope of each...

Then "Calibrate" them...

Then get their average...

If that makes any sense....

Edit: I see that I Calibrated the indi's before I calculated the "Slope" values.... I think it would be better to calibrate things "After" calculating the slope... must have a look at this... thanks

thanks for the ideas - I'm not making an EA out of this at the moment just using the final indi to trade manually. It's all new stuff at the moment.

thanks again.

 
Sure... no problem... It's a good "Volume" indicator
Reason: