Download MetaTrader 5
To add comments, please log in or register
Freelance service: the safe way to order a trading robot. Try it!
Thierry Chappuis
Thierry Chappuis 2014.04.28 10:18 


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);


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:

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

Kind regards


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