Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Thierry Chappuis
7
Thierry Chappuis 2014.04.28 10:18 

Hi,

As a test of the DRAW_FILLING functionality with MT4 build 625, I wrote the following simple code:

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots 1

// Plot 1
#property indicator_label1 "Candle spread"
#property indicator_type1 DRAW_FILLING
#property indicator_color1 clrAqua,clrOrange
#property indicator_width1 1

// Indicator buffers
double fillBuffer1[];
double fillBuffer2[];

int OnInit()
{
SetIndexBuffer(0, fillBuffer1, INDICATOR_DATA);
SetIndexBuffer(1, fillBuffer2, INDICATOR_DATA);

return INIT_SUCCEEDED;
}

void OnDeinit(const int reason)
{
// Nothing to deinit
}

int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
ArraySetAsSeries(fillBuffer1, false);
ArraySetAsSeries(fillBuffer2, false);

ArraySetAsSeries(high, false);
ArraySetAsSeries(low, false);

for (int i = 0; i < rates_total; i++)
{
fillBuffer1[i] = high[i];
fillBuffer2[i] = low[i];
}

return rates_total;

}


This code gives unexpected results since only the upper boundary of the channel is drawn in the separate window:

http://gyazo.com/f7731aa65dc71a8ff0a18a4ca37e5ac5

Is there plan to implement this DRAW_FILLING functionality in the future builds or the problem lies in my code?

Kind regards

Thierry

qjol
3243
qjol 2014.04.28 10:22  
AFAIK it is not working in mt4 only in mt5
/
To add comments, please log in or register