Ok there has been some progress. The interpolated data (Aqua line) is nice and smooth, and runs through the controlpoints of the source data (Red staircase).
But there are the occasional glitch as can be seen in this picture... shouldn't be there. Can you spot the problem?
Lets say you want to see a 10EMA hourly on a 5m chart.
10 hourly periods == 10 hours
on 5 minutes, 10 hours is 120 bars.
So set a 120 period EMA on 5m and you're done.
No its not quite that simple... This was the very first thing I tried, but it isn't nearly as good as a true htf MA.
It falls short in two areas:
-More lag
-More ripple (change of direction)
In these two areas the true htf MA (based on the smoothed 'staircase') is far superior to just a slow ltf MA.
That slow ltf MA lags quite a bit, but worse than that is that its full of ripple (small signal reversals) which leads to
uncertenty and false 'trade' signals. This is beacuse inherent in the steps is a hughe quantization error, which in other
applications would typically be undesirable, but here its what makes the indicator so good and smooth with practically NO ripple or false signals.
I think the power of a really good htf MA is grossly underestimated... Possibly one of the most powerfull and useful indicators ever.
BTW to the left in the circle above you can see that one step is shorter due to missing bars.
Show us a screenshot of this version I made for you.
latest version in my next post below.
btw, did you move on to something else or did this not work for you at all? Any response would be appreciated. I found it useful.
And my last update. This one has example of smoothing both sides of the staircase.
Checked your version and it looks perfect on the chart, but...
-The loop counts backwards, in general I'd avoid doing that for various reasons.
-It fails on Visual backtest.
Anyhow I got mine working ok using a combination of methods, just need to fix the coloring / buffer alignment, and do a final check on monday to see how it handles live data (unfinished bar0 ).
This picture shows mine, in its current state (need to fix that bufferproblem), and yours below.
Here's something I had made when I started playing with the indicator. It does the in-betweening that DRAW_SECTION usually does but fills prices into buffer. You just have to change your buffer settings back to DRAW_LINE and make a call to this function before your start function returns. Not sure about that counting backwards thing you mentioned. You should share that knowledge sometime. Is it a backtest related issue(I don't do them).
Anyways good luck.
void EmulateDrawSection(double& buffer[]) { // if we want a price on every shift instead of zeros, // then we need to emulate what draw section does and in-between the prices ourselves. int lastShift=-1; double c; for (int i=0;i<ArraySize(buffer);i++) { if(buffer[i]>0) { if(lastShift >-1) { c=(buffer[i]-buffer[lastShift]) / (i-lastShift); for(int j=1;j<(i-lastShift);j++) { buffer[lastShift+j]=buffer[lastShift] + c*j; } } lastShift=i; } } }
...Even the simplest of things are turning into a problem...
This time it is reading the indicator data from a test EA. Indicator and test EA attached.
I'm checking for rising slope on the blue line and marking it. This works perfect when done in a loop in the indicator.
But doing it in the test EA results in lots of noise etc, even though the blue line behaves as it should (no noise) in Visual test.
This should be as simple as reading the line value but apparently there is a Gremlin messing things up...
This image shows the indicator graph (top), and the result from the EA (bottom).
Why is this happening ?? I've done the same test on std indicators and it works correctly as expected.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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, This is a MA indicator that is reading MA off a higher TF and used in a lower TF...
In its current state the line appears as a staircase, drop it on a 15M TF and you'll see.
I want it smoothed so that there is a distinct change for every low TF bar, iMA can be used as suggested in the code but
I would prefer linear interpolation, or better yet Spline... I'm almost there with the linear but the (total) lack of debugging capabilities in the editor got me stuck...
I think the problem is properly extracting the XY controlpoint values.
Suggestions ?