
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
One thing that's difficult at least for me is trying to debug a loop with only Pint or Alert as a tool. So I add a text object painter inside both ADI Ea & SuperTrend.
It turned out, calling iCustom to an indicator that has ObjectCreate in it triggers its drawing also. So I decided to add SuperTrend2 to compare them with drawing made from SuperTrend (which was not attached but drawing text also), just to make sure. All other calculations are left intact.
With SuperTrend2 you can opt for using drawing from inside the loop or outside. The text will indicate ST2o when UseInsideLoop input is set to false.
Have a try at them. I use them on USDCAD M1 so I can see new bar values forming quickly. Don't forget to select scale option (F8) to Scale Fix One to One to check past candles and AutoScroll turned-off.
... and SuperTrend2 (seems files can't be attached all at once). Remember only the ADI and SuperTrend2 are attached to chart.
I observe a glitch occured once (I can't confirmed it) when the Supertrend2 value suddenly change past value (bar 200 something). But overall, it seems the whole calculate-all-bars-on-every-tick thing -- although I still would not personally use it as is -- is not generating anything flawed on a constant basis.
So this three experts serve as a confirmation that all values from EA & indicator matched bar per bar on every tick.
So to further convince you that the mistake was not from the iteration (my previous culprit), but from the incorrect interpreting of your Print/Alert debugger... I quote this from page 2.
I use D1. values in EA are unambiguously wrong!!!. See please the time information 9. - 11.11.2010 by print debugging in. There entry 1.42000000 is absent.
Position i=0 10.11.2010 and i=1 11.11.2010 must be 1.42000000
The bars you're comparing are different though the date was the same. Why was the date the same I will leave that to you... but let's compare both parts for debugging on EA
... and HeikenAshiTK1 As I've said the indicator's Print didn't have a chance to display value of 0 bar and time from Time[0], while your EA conveniently display Time[0] on every tick. That's a very different source of values for comparison. Try your previous debugging on M1 to see this more clearly, or see if you can replicate that 'incorrect' result (having new perspective in mind). Hope that helps.Thank you for your engagement and detailed reasons. This is great!!
Unfortunately, as I have already written, the simple SuperTrend 101109 indicator (1-step super trend logic) returns correct values in EA but the complexe Heiken Ashi and TK1 indicator(1.step Heiken Ashi logic and 2.step SuperTrend logic), incorrect values. Difference between the two indicators is only the Heiken Ashi logic, which is upstream in the complexe Heiken Ashi and TK1 indicator. I.e. for SuperTrend logic will not take the values from the chart, but from Heiken Ashi logic.
I brought the simple SuperTrend 101109 indicator in the game, only you can prove to that the super trend logic is correct. Conclusion: you have proved what I already knew, that delivers SuperTrend 101109 right values.
This to me is not easier to find the error, if EA is working with the complexe Heiken Ashi and TK1 indicator.Cameofx, nevertheless many thanks!
After an intensive search, I found that the error is generated by the ATR calculation in the complexe indicator.
I.e. Call returns correct indicator values in my EA:
Call returns the wrong indicator value in my EA:
Unfortunately, the first call, it only programmatically correct, expertly not, because it is based on the chart values instead Heiken Ashi values.
The ATR logic (part of Heiken Ashi and TK1 indicator) that leads to the problem is:
I have the logic of the standard ATR indicator in this source code taken
Conclusion:
My complexe IIndicator need logic based on Heiken Ashi values. I.e. I have the source of errors but no final solution.