[i]BollTrade_Ron_MT4_v05a

Download script
Author: Ron Thompson
[i]BollTrade_Ron_MT4_v05a

Overview of the BollTrade Indicator

The BollTrade Indicator is a technical analysis tool designed for MetaTrader platforms to identify potential trade entries and automated price targets (Take Profit and Stop Loss levels) based on market volatility and price extremes. It combines traditional Bollinger Band theory with dynamic adjustments to help traders spot when prices have moved significantly away from their average.

Core Logic and Mechanics

The indicator functions by analyzing three primary components of market movement:

1. Baseline Volatility (Bollinger Bands) The script first establishes a "normal" trading range by calculating a Moving Average (the center line) and two outer boundaries (Upper and Lower Bands). These bands represent the standard deviation of price movement over a specific period. When the price stays within these bands, it is considered to be behaving normally.

2. Expansion Zones (The "Plus" Thresholds) Unlike standard Bollinger Bands, this script creates an additional buffer zone beyond the outer boundaries.

  • Standard Mode: It adds a fixed amount of distance to the bands to create "UpperPlus" and "LowerPlus" levels.
  • ATR Mode (Volatility Adjusted): If enabled, the indicator uses the Average True Range (ATR). This means the buffer size automatically expands or shrinks based on how volatile the market is currently behaving. For example, in a wild, high-volatility market, the buffer gets wider; in a quiet market, it narrows.

3. Trade Signal Generation The indicator looks for specific "exhaustion" points where the price pushes past these expanded boundaries:

  • Sell Signals: Triggered when the market's high price reaches or exceeds the UpperPlus level. This suggests the market may be overextended to the upside and could be due for a reversal or correction.
  • Buy Signals: Triggered when the market's low price reaches or falls below the LowerPlus level. This suggests the market is overextended to the downside and may be primed for a bounce back up.

Automated Target Calculation

One of the key features of this script is its ability to automatically calculate risk management levels at the exact moment a signal occurs. Depending on your settings, it calculates:

  • Take Profit (TP): A target price where the trade should ideally close to lock in gains.
  • Stop Loss (SL): A safety net price designed to exit the trade if the market moves against you, limiting potential losses.

These targets are either calculated using a fixed pip amount or scaled dynamically based on the ATR volatility metric, ensuring that your risk is proportional to current market conditions.

Visual Representation

On your chart, the indicator provides clear visual cues:

  • Lines: Show the moving average and the standard Bollinger Bands.
  • Dots/Boxes: Identify the expanded "Plus" boundaries.
  • Arrows/Icons: Clearly mark the Buy and Sell entries, along with specific markers for where your Take Profit and Stop Loss levels should be placed.
Indicators Used
Moving average indicatorStandard Deviation indicatorIndicator of the average true range
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
[i]BollTrade_Ron_MT4_v05a
//
//
//+--------------------------+
//| BollTrade Indicator v05a
//+--------------------------+
//
//
#property copyright "Ron Thompson"
#property link      "http://www.lightpatch.com/forex/"
 
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 White
#property indicator_color4 Gray
#property indicator_color5 Gray
#property indicator_color6 White
#property indicator_color7 LimeGreen
#property indicator_color8 Red


extern int    BPeriod      =      15;    // Bollinger period
extern double Deviation    =       1.8;  // Bollinger deviation
extern double BDistance    =      14;    // plus how much
extern double ProfitMade   =       8;
extern double LossLimit    =       9;

extern bool   UseATR            =   false;
extern int    ATR_Period        =       4;
extern double ATR_BDistanceMult =       1.4;
extern double ATR_LossLimitMult =       3.6;
extern double ATR_ProfitMadeMult=       0.8;

//---- buffers
int       mybars=1000;
double    BollMA[1000];
double BollUpper[1000];
double BollLower[1000];
double UpperPlus[1000];
double LowerPlus[1000];
double   BuySell[1000];
double        TP[1000];
double        SL[1000];


//+----------------+
//| Custom init    |
//+----------------+
int init()
  {
   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   // 158 little dot
   // 168 open square
   // 120 box with X
     
   IndicatorBuffers(8);
   
   SetIndexStyle(0,DRAW_LINE); //bollinger ma
   SetIndexArrow(0,158);
   SetIndexBuffer(0,BollMA);
   
   SetIndexStyle(1,DRAW_LINE); //bollinger upper
   SetIndexArrow(1,158);
   SetIndexBuffer(1,BollUpper);

   SetIndexStyle(2,DRAW_LINE); //bollinger lower
   SetIndexArrow(2,158);
   SetIndexBuffer(2,BollLower);

   SetIndexStyle(3,DRAW_LINE); //upperplus
   SetIndexArrow(3,158);
   SetIndexBuffer(3,UpperPlus);

   SetIndexStyle(4,DRAW_LINE); //lowerplus
   SetIndexArrow(4,168);
   SetIndexBuffer(4,LowerPlus);

   SetIndexStyle(5,DRAW_ARROW); //buysell
   SetIndexArrow(5,168);
   SetIndexBuffer(5,BuySell);

   SetIndexStyle(6,DRAW_ARROW); //TP
   SetIndexArrow(6,120);
   SetIndexBuffer(6,TP);

   SetIndexStyle(7,DRAW_ARROW); //SL
   SetIndexArrow(7,120);
   SetIndexBuffer(7,SL);

  }

  
//+----------------+
//| Custom DE-init |
//+----------------+
int deinit()
  {
   Print("DE-Init happened ",CurTime());
   Comment(" ");
  }

  
//+-----+
//| TPB |
//+-----+
int start()
  {   
   
   int i;

	double stddev;
   double bup0;
   double bdn0;

   double myBDistance;
   double myATR;
   double myProfitMade;
   double myLossLimit;
   
   for (i=mybars; i>=0; i--) 
     { 
      // Bollinger moving average
      BollMA[i] = iMA(Symbol(),0,BPeriod,0,MODE_SMA,PRICE_OPEN,i);
      
      // upper & lower bands
      stddev = iStdDev(Symbol(),0,BPeriod,0,MODE_SMA,PRICE_OPEN,i);   
      BollUpper[i] = BollMA[i] + (Deviation*stddev); //upper
      BollLower[i] = BollMA[i] - (Deviation*stddev); //lower

      // buy/sell limit cross
      if(UseATR)
        {
         myATR=iATR(Symbol(),0,ATR_Period,i);       // expressed as .xxxx
         myBDistance = (ATR_BDistanceMult * myATR); // so doesn't need Point 
         UpperPlus[i] = BollUpper[i]+(myBDistance); //upperplus
         LowerPlus[i] = BollLower[i]-(myBDistance); //lowerplus
        }
        else
        {
         myBDistance=BDistance;
         UpperPlus[i] = BollUpper[i]+(myBDistance*Point); //upperplus
         LowerPlus[i] = BollLower[i]-(myBDistance*Point); //lowerplus
        }


      if( High[i]>=UpperPlus[i])
        {
         BuySell[i]=UpperPlus[i]; //SELL
         if(UseATR)
           {
            TP[i]=UpperPlus[i]-(myATR*ATR_ProfitMadeMult);
            SL[i]=UpperPlus[i]+(myATR*ATR_LossLimitMult);
           }
           else
           {
            TP[i]=UpperPlus[i]-(ProfitMade*Point);
            SL[i]=UpperPlus[i]+(LossLimit*Point);
           }
        }


      if( Low[i]<=LowerPlus[i])
        {
         BuySell[i]=LowerPlus[i]; //BUY
         if(UseATR)
           {
            TP[i]=LowerPlus[i]+(myATR*ATR_ProfitMadeMult);
            SL[i]=LowerPlus[i]-(myATR*ATR_LossLimitMult);
           }
           else
           {
            TP[i]=LowerPlus[i]+(ProfitMade*Point);
            SL[i]=LowerPlus[i]-(LossLimit*Point);
           }

        }

     }//for
 
  }//start
  

Comments