• Overview
  • Reviews
  • Comments (4)
  • What's new

Range Bars

The robust charting solution that enables creating custom live range bar charts on the MetaTrader 4 trading platform.

You can apply all of the standard and custom indicators and technical studies directly to the range bar charts and you can run EAs directly on these charts as well* (for details see text below the input summary).

To create a range bar chart you need to attach the Range Bar indicator to a standard time frame (1 minute is recommended) and use the indicator's settings to generate a live custom chart that will be displayed on an offline chart of your choice. All of the available settings are described below:

Bar type definition

  • Candle size (in pips for Forex pairs and in points for others).

Display settings

  • Display on offline chart (M2, M3, M4, M6, M7, M8, M9 or M10).
  • Build history for number of days.
  • Reset Open on each trading day.
  • Re-calculate chart on history updates.
  • Minimum chart update interval (defined in milliseconds).

ATR based bar size calculation

  • Enabled (true/false).
  • Daily ATR period.
  • Percentage of ATR to calculate candle size (high to low).

Alerts and Info

  • Sound signal on new bar (true/false).
  • Only signal reversal bars (true/false).
  • Use Alert Window to display signal (true/false).
  • Sound file to play on bullish bar.
  • Sound file to play on bearish bar.
  • Color of High threshold indicator.
  • Color of Low threshold indicator.
  • Color of an inactive threshold indicator.

* EAs can be used directly on the offline chart, however, a small tweak is required, so you need to have access to your EA source code. Below is an EA skeleton example that is capable of running directly on the offline chart:

#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   // You need to initialize a time to call the OnTimer event.
   // It is used to call OnTick whenever the Bid price changes.
   // The check is made every 250 ms, which should be sufficient.
   
   EventSetMillisecondTimer(250);
      
   //---
   
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   // Remember to destroy timer in the OnDeinit event.
   
   EventKillTimer();

   //---      
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   //
   // This is where all of your EA trading logic resides.
   // I just write to the log in this example...
   //
   
   Print("OnTick function call - bid = "+(string)Bid);
}
//+------------------------------------------------------------------+
//| The OnTimer function is used to call OnTick()                    |
//| whenever the Bid price changes.                                  |
//+------------------------------------------------------------------+
void OnTimer()
{
   RefreshRates();
   static double prevBid = 0; 
   
   if(Bid != prevBid)
   {
      prevBid = Bid;
      OnTick();
   }         
}
//+------------------------------------------------------------------+
No reviews
Version 1.1 - 2017.11.09
Bug fixes