Hi RaptorUK, thank you for your quick response.
As you can see in the source code I added a "Print" to check the experts log. When High[i]-Low[i] is equal to zero, in the log appears "zero divide" do you thing thats why the indicator stops drawing arrows?
Hi RaptorUK, thank you for your quick response.
As you can see in the source code I added a "Print" to check the experts log. When High[i]-Low[i] is equal to zero, in the log appears "zero divide" do you thing thats why the indicator stops drawing arrows?
Thank you very much, i'll think how to work this around...
Yes, Zero Divide will Stop any code. Always look out for Zero_Divide when using /. To solve the problem, check:
if( High[i]-Low[i] != 0 ){ if (Volume[i]>Vol && Close[i]>Open[i+1] && ((Close[i]-Low[i])/(High[i]-Low[i]))>=0.75){ UpBar[i]=High[i]; } }
Additional notes: Start using variable names for stuff like High[i]-Low[i]. Makes it easier to read.
Example: double Hi_minus_Lo=High[i]-Low[i]; __________ if( Hi_minus_Lo != 0 ){}
**Be careful using Volume[i] because you can miss Volumes or Ticks.
Thank you both for all your help, ubzen solution is much more refine that what i did. I just added a very small number to the expresion: (High[i]-Low[i]+0.00000000000000000001] Now the indicator works fine for my purposes.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I'm a newbie with mql4 and when i tried to code my first indicator I could'nt make to draw the arrows on the chart.
An up arrow should be drawn when the volume is more than the extern variable "Vol"; When the close of the bar is higher than the open of the previous, and when the close of the bar is in the upper 75% of that bar.
A Down arrow should be drawn when the volume is more than the extern variable "Vol"; when the close of the bar is lower than the open of the previos, and when the close of the bar is in the lower 25% of that bar.
The indicator works well when I only code the first 2 parameters, but when I include the percentaje parameter it didn't draw any arrow.
I need help undestanding why when i code "((Close[i]-Low[i])/(High[i]-Low[i]))>=0.75"the indicator stops drawing arrows.
Thank you