Indicator Not Painting

 
I am attempting to create an mql5 heiken ashi indicator smoothed and corrected using the attached mq4 version. It seems it is calculating the values correctly as it prints out reasonable numbers, but the values are not painting on the chart. Is there anything obvious I'm missing wrong with the indicator? I'm new to mql5. 
Heiken-Ashi
Heiken-Ashi
  • www.mql5.com
The Heiken-Ashi indicator is looks like the candlestick chart, but it has some difference.The advantage of the Heiken-Ashi charts is a simple trend determination, the upward trend candles are blue,the downward trend candles are red.
 
.
Files:
 

Ernst Van Der Merwe:
.

Hey Ernst! Thank you so much for your help! Unfortunately it seems the two are performing slightly differently. I need them to perform the exact same way. I live in the US and my broker doesn't support MT5 so I need to use MT4 for live trading. But MT5 is a million times faster for backtesting. So I need the ported indicators to perform exactly the same or I'll enter different trades on the live account. The pictures are using identical tick data from dukascopy. I really appreciate the help either way whether or not you want to help me get it to perform identically. It is at least drawing now and looks to be performing very similar.
Testing trading strategies on real ticks
Testing trading strategies on real ticks
  • www.mql5.com
The article provides the results of testing a simple trading strategy in three modes: "1 minute OHLC", "Every tick" and "Every tick based on real ticks" using actual historical data.
Files:
 
M M:
Hey Ernst! Thank you so much for your help! Unfortunately it seems the two are performing slightly differently. I need them to perform the exact same way. I live in the US and my broker doesn't support MT5 so I need to use MT4 for live trading. But MT5 is a million times faster for backtesting. So I need the ported indicators to perform exactly the same or I'll enter different trades on the live account. The pictures are using identical tick data from dukascopy. I really appreciate the help either way whether or not you want to help me get it to perform identically. It is at least drawing now and looks to be performing very similar.

No worries. Here's the MT4 version.

Files:
 
Ernst Van Der Merwe:

No worries. Here's the MT4 version.

Hey Ernst, I actually meant I wanted the new mq5 version to perform the same as the original mq4 version I posted. But I was able to modify your script to get it almost there. The main difference is you were averaging open/close/high/low by the close price instead of the open by the open, the close by the close, etc. However it seems off still a little bit. The only differences I see are:

  1. The original paints a histogram on the main chart to draw the heiken ashi candle, the mt5 version draws a candle.
  2. The original uses a shifting SMMA and LWMA, the mt5 version does not use any shift.

 
M M:

Hey Ernst, I actually meant I wanted the new mq5 version to perform the same as the original mq4 version I posted. But I was able to modify your script to get it almost there. The main difference is you were averaging open/close/high/low by the close price instead of the open by the open, the close by the close, etc. However it seems off still a little bit. The only differences I see are:

  1. The original paints a histogram on the main chart to draw the heiken ashi candle, the mt5 version draws a candle.
  2. The original uses a shifting SMMA and LWMA, the mt5 version does not use any shift.

.
Reason: