Histogram buffers

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
1752
DxdCn 2007.12.15 17:33 #
 

candle sticks only work at main window.

in sep-window, Histogram only need one buffer and based on 0 to draw.

 
avatar
2644
phy 2007.12.15 20:07 #
 

Instead of using indicator index, I draw trendlines for the bars as a workaround in sub-windows.

The index pairing does not work in the subwindows.

 
avatar
13
ppc123 2009.08.01 08:05 #
 

"SetIndexStyle" function controls drawing parameters of an indicator array. The drawing mode of DRAW_LINE assumes that lines between values defined in a corresponding indicator array are drawn. The drawing mode of DRAW_HISTOGRAM having been applied to the main window indicator has its special features, as well. A histogram is drawn between corresponding values of two index arrays: an even one (here: SpanA_Buffer) and an odd one (here: SpanB_Buffer). At that, the color of the index array is used the value of which is higher.



Sad...

So, this feature does not exist in indicator_separate_window...

I'm just trying to port a histogram indicator from main window to separate window...

 
avatar
1252
onewithzachy 2010.01.05 11:04 #
 
stringo:
From the article:

"SetIndexStyle" function controls drawing parameters of an indicator array. The drawing mode of DRAW_LINE assumes that lines between values defined in a corresponding indicator array are drawn. The drawing mode of DRAW_HISTOGRAM having been applied to the main window indicator has its special features, as well. A histogram is drawn between corresponding values of two index arrays: an even one (here: SpanA_Buffer) and an odd one (here: SpanB_Buffer). At that, the color of the index array is used the value of which is higher.


See also Heiken Ashi custom indicator as sample.

Dear stringo...

I create main window CI with 5 buffers, 2 to draw histos and 3 to draw lines. The histos is drawn from and to the wrong value. But when I eliminate the line buffers ( so I'm only use 2 buffers for histos), the histos is drawn correctly.


Correct me if I'm wrong : we can not mix DRAW_HISTOGRAM and DRAW_LINE in one CI because that can cause MT4 to draw a wrong histogram(s).


Thanks before and after and ... Happy New Year Twenty Ten

 
avatar
416
cameofx 2010.01.06 08:00 #
 

I'm glad MT5 developer decided to incorporate new drawing styles - but the question remains, will it still not work in separate window?

creating chart or indicator drawn as chart on separate window is very much needed. A programmer has created an indicator somewhat achieving this

(google 'chart clones' - great to get rid of those pesky title bars :)) but I'm hoping this would be a standard feature in MT5!

  • DRAW_CANDLES -- requires four indicator buffers (CandleSample.mq5)
  • DRAW_HISTOGRAM2 -- requires two indicator buffers (HistogramSample.mq5)
  • DRAW_BARS -- requires four indicator buffers (BarsSample.mq5)



     
    avatar
    37
    whitebloodcell 2010.08.17 00:31 #
     

    Have read this thread through a couple of times now but still can't seem to figure out the solution to what I need...

    I am trying to create an indicator that paints the area between two defined standard deviation bands. E.g. The area between the 2nd and 3rd deviations from the central MA. How can I do this? My code is below.

    //+------------------------------------------------------------------+
    //WBC_BollingerBand_Zone                                             |
    //+------------------------------------------------------------------+
    #property copyright "whitebloodcell"
    #property link      ""
    
    #property indicator_chart_window
    #property indicator_buffers 7
    
    #property indicator_color1 DimGray
    #property indicator_color2 DarkGreen
    #property indicator_color3 Red
    #property indicator_color4 Green
    #property indicator_color5 Maroon
    #property indicator_color6 Red
    #property indicator_color7 Green
    
    #property indicator_width1 1
    #property indicator_width2 1
    #property indicator_width3 1
    #property indicator_width4 1
    #property indicator_width5 1
    #property indicator_width6 2
    #property indicator_width7 2
    
    #property indicator_style1 STYLE_SOLID
    #property indicator_style2 STYLE_SOLID
    #property indicator_style3 STYLE_SOLID
    #property indicator_style4 STYLE_SOLID
    #property indicator_style5 STYLE_SOLID
    
    extern int    BandsLength     =    20;
    extern int    BandsMethod     =    MODE_EMA;
    extern int    BandsPrice      = PRICE_CLOSE;
    extern double BandsDeviation1 = 2; 
    extern double BandsDeviation2 = 3; 
    
    double MaBuffer[];
    double UpperBand1[];
    double LowerBand1[];
    double UpperBand2[];
    double LowerBand2[];
    
    double buffer5[];
    double buffer6[];
    
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    
    int init() {
       SetIndexBuffer(0,MaBuffer);
       SetIndexBuffer(1,UpperBand1);
       SetIndexBuffer(2,LowerBand1);
       SetIndexBuffer(3,UpperBand2);
       SetIndexBuffer(4,LowerBand2);
       
       SetIndexBuffer(5,buffer5); 
       SetIndexStyle(5,DRAW_HISTOGRAM);
       SetIndexBuffer(6,buffer6); 
       SetIndexStyle(6,DRAW_HISTOGRAM);
    
       SetIndexLabel(0,"Bands ma");
       SetIndexLabel(1,"Bands upper band 1");
       SetIndexLabel(2,"Bands lower band 1");
       SetIndexLabel(3,"Bands upper band 2");
       SetIndexLabel(4,"Bands lower band 2");
       SetIndexLabel(5,"Zone Upper Bound");
       SetIndexLabel(6,"Zone Lower Bound");
       return(0);
    }
    
    int deinit()
    {
       return(0);
    }
    
    
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    
    int start() {
       double sum,ma;
       int    counted_bars = IndicatorCounted();
       int    limit,i,k;
    
    
       if(counted_bars < 0) {return(-1);}
       if(counted_bars>0) {counted_bars--;}
       
       limit = Bars-counted_bars;
    
       for (i=limit;i>=0;i--) {
          ma = iMA(NULL,0,BandsLength,0,BandsMethod,BandsPrice,i);
                for (sum = 0.0, k = 0; k < BandsLength; k++) {
                     sum += ((Close[k+i]-ma)*(Close[k+i]-ma));
                }     
    
          //
          //
          //
          //
          //
          
          MaBuffer[i] = ma;
          if (BandsDeviation1!=0) {
                UpperBand1[i]  = ma+BandsDeviation1*MathSqrt(sum/BandsLength);
                LowerBand1[i]  = ma-BandsDeviation1*MathSqrt(sum/BandsLength);
          }               
          if (BandsDeviation2!=0) {
                UpperBand2[i]  = ma+BandsDeviation2*MathSqrt(sum/BandsLength);
                LowerBand2[i]  = ma-BandsDeviation2*MathSqrt(sum/BandsLength);
          } 
          //Red
          //buffer6[i] = MaBuffer[i];
          //buffer5[i] = UpperBand2[i]; 
          //buffer5[i] = MaBuffer[i];
          //buffer6[i] = LowerBand2[i]; 
       }            
       return(0);
    }

     
    avatar
    5
    jft 2013.06.07 04:30 #
     

    For working examples check out :   https://forum.mql4.com/37414

    JohnT

    avatar
    14167
    RaptorUK 2013.06.07 09:03 #
     
    jft:

    For working examples check out :   https://forum.mql4.com/37414

    JohnT

    Why are you responding now ?  you are 6 years late . . .   please do not drag up 6 year old posts unless you have a exceptional reason.

     

    Thread started  2007.01.04 

    avatar
    13008
    WHRoeder 2016.02.18 03:30 #
     
    DxdCn: candle sticks only work at main window.

    in sep-window, Histogram only need one buffer and based on 0 to draw.

    phy: Instead of using indicator index, I draw trendlines for the bars as a workaround in sub-windows.
    The index pairing does not work in the subwindows.

    How to Draw Cnadle chart in indicator_separate_window ? - MQL4 forum


    Back to topics list   | 1 2  

    To add comments, please log in or register