Is there a way of making the discrimination (a closed period as opposed to a current one) and then adjusting the code to only factor in closed
periods for the labeling?
Just don't process the current bar, reduce the value of limit by 1
Just don't process the current bar, reduce the value of limit by 1
Okay.
While we're at it, I was worried that I was getting confused on the orientation of the D/O/H/L/C/V arrays that are parameters to OnCalculate(). Are they oriented "most recent first", that is, 0 to (limit - 1) with the (limit - 1) index corresponding to the current bar?
Would I simply make the adjustment into the for loop of the calculations? - i.e.:
for (i = 0; i < (limit - 1); i++) { // HMA pre-buffer calculations ... }
Also, to root out any potential future errors, was it correct to use rates_total as the increment maximum in the second for loop, or should I have also used (limit - 1) here?
// Calculate the HMA slope/derivative. Because we can safely assume that // a bar or timeframe period is itself a unit of time, the derivative // calculation reduces to current - previous. // // Also, we perform crossover detection here. See ZeroCrossDet() for // more information. HMA_Slope_Buffer[0] = 0; for (i = 1; i < rates_total; i++) { // <- should this be changed to "i = 1; i < (limit - 1); i++"? // Zero-crossing detection // Drawing of graphical objects }
Thank you for your help - it is much appreciated.
Hey all,
I'm currently working on a custom Hull moving average (HMA) indicator that detects and labels local minimum and maximum points of the
Hull curve. At first glance, this modified indicator seems to work well (see images below), tagging HMA minimum points with a green buy
signal arrow and HMA maximum points with a red sell signal arrow.It applies the signal arrows "across the board" onto the entire chart
timeline which allowed me to verify that I got the slope and zero-cross logic correct.
However, a snag comes when the chart is live and new data is coming in - the HMA indicator no longer tags points correctly, labeling buy and sell signals when the Hull moving average has not leveled off. Here is a snippet of the EUR/USD daily chart, right in the center core of the chart frame. As you can see, the custom HMA indicator labels these points very well, with almost no false signals. There is a slight offset, but nothing egregious or overly concerning.
EDIT: Just realized that I'm unable to post photos. Below is the link to the image in question.
https://www.mql5.com/en/charts/11830487/eurusd-fx-d1-ig-group-limited
However, you can see in the past couple days where it began to give false signals - signaling a sell twice in a row, with the first signal coming
well before the slope had actually leveled off. Then, the next sell signal had a conflicting buy signal occurring within the same bar. My
line of thinking, although I have done no inspection yet, is that the current bar or candle isn't "cemented" or "closed", so variations
in price get calculated into a HMA value that is constantly in flux. The behavior I'm intending for is for the period to close and then
the indicator make a labeling determination. Is there a way of making the discrimination (a closed period as opposed to a current one) and
then adjusting the code to only factor in closed periods for the labeling?
Below is the complete code for the indicator - I've tried to leave in as many comments as I can in order to give a better idea as to my thought
process during its construction.Thank you for any help any of you can provide.
No problem to post a screenshot. Use the pocket tool.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey all,
I'm currently working on a custom Hull moving average (HMA) indicator that detects and labels local minimum and maximum points of the Hull curve. At first glance, this modified indicator seems to work well (see images below), tagging HMA minimum points with a green buy signal arrow and HMA maximum points with a red sell signal arrow.It applies the signal arrows "across the board" onto the entire chart timeline which allowed me to verify that I got the slope and zero-cross logic correct.
However, a snag comes when the chart is live and new data is coming in - the HMA indicator no longer tags points correctly, labeling buy and sell signals when the Hull moving average has not leveled off. Here is a snippet of the EUR/USD daily chart, right in the center core of the chart frame. As you can see, the custom HMA indicator labels these points very well, with almost no false signals. There is a slight offset, but nothing egregious or overly concerning.
EDIT: Just realized that I'm unable to post photos. Below is the link to the image in question.
https://www.mql5.com/en/charts/11830487/eurusd-fx-d1-ig-group-limited
However, you can see in the past couple days where it began to give false signals - signaling a sell twice in a row, with the first signal coming well before the slope had actually leveled off. Then, the next sell signal had a conflicting buy signal occurring within the same bar. My line of thinking, although I have done no inspection yet, is that the current bar or candle isn't "cemented" or "closed", so variations in price get calculated into a HMA value that is constantly in flux. The behavior I'm intending for is for the period to close and then the indicator make a labeling determination. Is there a way of making the discrimination (a closed period as opposed to a current one) and then adjusting the code to only factor in closed periods for the labeling?
Below is the complete code for the indicator - I've tried to leave in as many comments as I can in order to give a better idea as to my thought process during its construction.Thank you for any help any of you can provide.