Download MetaTrader 5
To add comments, please log in or register
Having troubles understanding the code? Articles can help you!
Proximus
756
Proximus 2014.10.24 05:24 

Hi, can anyone share with me a working source code to build CONSTANT RANGE BAR charts ? Pseudocode is also accepted, i have no clue how to do it, and I cant find any tutorial on the internet which would explain how CRB charts are constructed.

I dont want RENKO CHART, there is a difference, I want CRB chart. So can anyone help me please?

Carl Schreiber
5960
Carl Schreiber 2014.10.24 08:47  
well - google and you'll find a lot!!
Proximus
756
Proximus 2014.10.24 11:23  
gooly:
well - google and you'll find a lot!!
Please give me link, i could not find any that is useful. Most of it crashed after i opened in MT4.
Carl Schreiber
5960
Carl Schreiber 2014.10.24 11:27  

This moght depend on the new version - open them in the mt4 editor and try to compile them and eliminate the problems.

Or google more.

whroeder1
13641
whroeder1 2014.10.24 12:14  
Proximus:

Hi, can anyone share with me a working source code to build CONSTANT RANGE BAR charts ? Pseudocode is also accepted, i have no clue how to do it, and I cant find any tutorial on the internet which would explain how CRB charts are constructed.

I dont want RENKO CHART, there is a difference, I want CRB chart. So can anyone help me please?

  1. My classes attached
    #include "crb.mqh"
    cCRB  gCRB;
    void  ChartUpdated(const cChart& aCrt, bool isFinal=false){
       :  // Update other things depending on CRB
    }
    int OnCalculate (...){
       int    counted_bars  = IndicatorCounted();
       if(counted_bars < 0) return (-1);
       if(counted_bars == 0){  gCRB.Initialize(CRB_Pips); // History refresh
                                                          // or parameter change.
                               counted_bars = 1; }  // Color Lookback
    
       for(int  iBeg = Bars - 1 - counted_bars; iBeg >= 0; --iBeg){
          gCRB.Update(iBeg);
          ChartUpdated(gCRB);  // Update SMI with CRB's current close.
          :
  2. Renko, Point and Figure, Constant Range Bars are all the same, price based chart. They vary by how they start a new bar.
    • Renko: New open in the current direction is one block from the current open. In the opposite direction, two blocks.
    • Point and Figure: No new in the current direction. In the opposite direction, three blocks back from the highest completed block.
    • Constant range bars: New when price exceeds current low plus block size or current high minus block size.
Files:
crb.mqh 5 kb
chart.mqh 5 kb
Proximus
756
Proximus 2014.10.24 12:41  
WHRoeder:
  1. My classes attached
  2. Renko, Point and Figure, Constant Range Bars are all the same, price based chart. They vary by how they start a new bar.
    • Renko: New open in the current direction is one block from the current open. In the opposite direction, two blocks.
    • Point and Figure: No new in the current direction. In the opposite direction, three blocks back from the highest completed block.
    • Constant range bars: New when price exceeds current low plus block size or current high minus block size.

Ok that is a good explanation thanks, so 1 more question.

In the CRB chart, what values do the OPEN,HIGH,LOW,CLOSE get, and how are they calculated. I see that the HIGH-LOW is always the size of the range, but the close may vary so please explain.

whroeder1
13641
whroeder1 2014.10.24 13:13  
Proximus: In the CRB chart, what values do the OPEN,HIGH,LOW,CLOSE get, and how are they calculated. I see that the HIGH-LOW is always the size of the range, but the close may vary so please explain.
Open is equal to the previous bars close (+1 point in my code.)
H/L/C change as price moves up or down just like time based chart.
When C tries to exceed the range, a new bar starts and previous bar's C equals H or L.
Proximus
756
Proximus 2014.10.25 03:58  
WHRoeder:
Open is equal to the previous bars close (+1 point in my code.)
H/L/C change as price moves up or down just like time based chart.
When C tries to exceed the range, a new bar starts and previous bar's C equals H or L.
Thanks, i shall try and build a CRB script from these informations. I don't like translating other people's code I like to build it myself from scratch.
/
To add comments, please log in or register