Hello,
I found an interesting indicator on Trading View - Z-Score Heikin-Ashi Transformed by EliCobra (tradingview.com/script/MFW8vsmU-Z-Score-Heikin-Ashi-Transformed)
I am trying to create it MQL5 and I think I am almost done but at the end of the day it fails.
Plotting regular HeikinAshi on the window works fine, but when I try to pass it trough Z-Score function I am facing issues. I have no idea how to pass price through that function and get a Z-Score transformed value.
A snippet of PineScrip function I am referring to:
And mine attempt to recreate it in MQL5:
And the full code here:
I also think the f_z function math is a bit odd because in comparison to TradingView the value difference is pretty big eg. -0.7 in MT5 to 0.4 in TradingView and that's not because of differences in quotes - those are close to 0.
I am pretty sure I am missing something small here.
I would be extremely grateful for some fresh look at my code and any suggestions. I am loosing my mind because of that issue haha
double f_z(ENUM_APPLIED_PRICE src, int len) { double sma = iMA(_Symbol, PERIOD_CURRENT, len, 0, MODE_SMA, src); Print("SMA: ", sma); double stdev = iStdDev(_Symbol, PERIOD_CURRENT, len, 0, MODE_SMA, src); Print("StdDev: ", stdev); double math = (src - sma) / stdev; Print("Math: ", math); return math; }
The iMA function is incorrect, and should also be called only once, in the OnInit() function ( iMA - Technical Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5 )- it returns a handle for use with CopyBuffer() to read the indicator values.
- www.mql5.com
The iMA function is incorrect, and should also be called only once, in the OnInit() function ( iMA - Technical Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5 )- it returns a handle for use with CopyBuffer() to read the indicator values.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I found an interesting indicator on Trading View - Z-Score Heikin-Ashi Transformed by EliCobra (tradingview.com/script/MFW8vsmU-Z-Score-Heikin-Ashi-Transformed)
I am trying to create it MQL5 and I think I am almost done but at the end of the day it fails.
Plotting regular HeikinAshi on the window works fine, but when I try to pass it trough Z-Score function I am facing issues. I have no idea how to pass price through that function and get a Z-Score transformed value.
A snippet of PineScrip function I am referring to:
And mine attempt to recreate it in MQL5:
And the full code here:
I also think the f_z function math is a bit odd because in comparison to TradingView the value difference is pretty big eg. -0.7 in MT5 to 0.4 in TradingView and that's not because of differences in quotes - those are close to 0.
I am pretty sure I am missing something small here.
I would be extremely grateful for some fresh look at my code and any suggestions. I am loosing my mind because of that issue haha