Hi every one. How can i fix the problem.
Here is an indicator that has two MA (Moving Average) buffers. I want to draw histogram between two buffers in separate window like the first figure but it draw complete histogram shown in second figure.
Here is an indicator that has two MA (Moving Average) buffers. I want to draw histogram between two buffers in separate window like the first figure but it draw complete histogram shown in second figure.
Inserted Code
//+------------------------------------------------------------------+ //| 41.mq4 | //| Ali Mojtabaei. | //| https://telegram.me/mqlbyAliMojtabaei | //+------------------------------------------------------------------+ #property copyright "Ali Mojtabaei." #property link "https://telegram.me/mqlbyAliMojtabaei" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 2 double A[], B[]; int i , limit; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { SetIndexBuffer (0 , A); SetIndexBuffer (1 , B); SetIndexStyle (0 , DRAW_HISTOGRAM , STYLE_SOLID , 1 , clrYellow); SetIndexStyle (1 , DRAW_HISTOGRAM , STYLE_SOLID , 1 , clrRed); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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[]) { limit = (rates_total - prev_calculated); if (prev_calculated == 0) limit--; for (i=0 ; i<=limit ; i++) { A[i]=iMA(Symbol(),PERIOD_CURRENT,10,0,MODE_SMMA,PRICE_TYPICAL,i); B[i]=iMA(Symbol(),PERIOD_CURRENT,100,0,MODE_SMMA,PRICE_TYPICAL,i); } SetIndexDrawBegin(0,100); SetIndexDrawBegin(1,100); return(rates_total); } //+------------------------------------------------------------------+