27 Mar 2020, 15:13

Hello,
@fxDreema
I am trying to code an indicator in MQL4, then use fxdreema's "custom MQL Code" to view it on the chart. Ideally, I would like to use buffers to develop a strategy based on the indicator.

The negative volume indicator is explained (here) quite well.

I have no experience coding MQL4, which is why I use fxdreema, however, I have experience with other coding languages. I'm not a programmer or computer scientist (I'm a mechanical engineer), but do have experience with C++, little bit of visual basic, and MATLAB coding languages.

I took the Custom Moving Average Code in MT4 and tried to modify it in MetaEditor and implement it on the chart. However, even though I get the code to compile in MetaEditor, it doesnt show me anything on the chart. There is a bug somewhere in the code and I was wondering if someone could help me fix it? Part of the strategy requires to take the moving average (period 255 ) of the NVI indicator, but I saw in another forum post that this is not possible with fxdreema. I was hoping to add on to the NVI script to automatically compute MA(255) of the first indicator's data like that shown below.

In the script, I deleted all different types of moving averages and only use the exponential (EMA). Attached is the .mq4

Really the "juice" of the code is as follows:
{... if ( volume[i]- volume[i-1] < 0)
ExtLineBuffer[i]=ExtLineBuffer[i-1]+((close[i]- close[i-1])/ close[i]);
else if(volume[i]- volume[i-1]>=0)
ExtLineBuffer[i]=ExtLineBuffer[i-1];
}
NVI_indicator_draft1.mq4
The NVI is similar to Accumulation/Distribution which is what is shown in the figure, below, but a little different.

![no image](0_1585321421446_Picture1.png image url)