[i]BollTrade_Ron_MT4_v05b

Download script
Author: Ron Thompson
[i]BollTrade_Ron_MT4_v05b

Overview of the BollTrade Indicator Logic

The BollTrade indicator is a specialized trading tool designed for technical analysis, specifically optimized for the EURUSD currency pair on a 15-minute timeframe. It operates on the principle of "mean reversion," which suggests that when price action moves too far in one direction, it will eventually pull back toward its average.

Core Trading Mechanics

The system identifies potential trading opportunities by monitoring how far the current market price deviates from standard price bands (Bollinger Bands). Rather than entering a trade as soon as the price touches these bands, the logic looks for instances of "exhaustion"—points where the price has pushed significantly beyond the normal range.

The indicator follows a counter-trade strategy:

  • Sell Signals: When the price climbs above the upper boundary, it indicates an overextended upward move. The system suggests entering a Sell order.
  • Buy Signals: When the price drops below the lower boundary, it indicates an overextended downward move. The system suggests entering a Buy order.

Visual Indicators and Guidance

To assist the user in identifying these moments, the script provides several visual layers on the chart:

  • Boundary Lines: It plots the standard Bollinger Bands along with "plus" zones (represented by gray lines). These gray lines mark the specific distance beyond the bands where a trade should be considered.
  • Entry Markers: White squares appear at the exact price points where the market has exceeded these boundaries, highlighting the recommended entry zone for a market order.
  • Target Zones: Once an entry signal is identified, the script automatically calculates and displays two specific markers:
    • Green Marker: Represents the "Profit Made" target (Take Profit).
    • Red Marker: Represents the "Loss Limit" (Stop Loss).

Dynamic Adjustment Modes

The logic offers two distinct ways to calculate these boundaries and targets depending on market volatility:

  1. Fixed Mode (Standard): In this mode, the distances for entries, profits, and losses are set as fixed pip values. This is ideal for stable market conditions where the user prefers consistent, predetermined price targets.
  2. ATR Mode (Adaptive): If enabled, the indicator uses the Average True Range (ATR). This allows the boundaries and profit/loss targets to expand or contract automatically based on current market volatility. In high-volatility environments, the targets widen; in low-volatility environments, they tighten.

Operational Rules

To maintain the integrity of the strategy, the logic is designed around specific trading constraints:

  • One Trade at a Time: The system is intended to manage one position at a time.
  • Bar Restriction: It is designed to trigger only one trade per candle (bar) to prevent over-trading or "stacking" multiple entries in a single volatile moment.
Indicators Used
Moving average indicatorStandard Deviation indicatorIndicator of the average true range
Miscellaneous
Implements a curve of type %1
17 Views
0 Downloads
0 Favorites
[i]BollTrade_Ron_MT4_v05b
//
//
//+--------------------------+
//| BollTrade Indicator v05a
//+--------------------------+
//
//
#property copyright "Ron Thompson"
#property link      "http://www.ForexMT4.com/"

// This INDICATOR is NEVER TO BE SOLD individually 
// This INDICATOR is NEVER TO BE INCLUDED as part of a collection that is SOLD

/*

===== Theory =====

This is designed for EURUSD M15

You should place BUY and SELL MARKET ORDERS depending on how far outside the 
Bollinger Bands the current price falls. This is a counter-trade system, that
is, you should SELL when the UPPER bands are exceeded by BDistance pips and
BUY when the LOWER Band is exceeded. 

BDistance, BPeriod and Deviation control the Bollinger Bands

It depends on retracement and exhaustion to make profit.

You should only places one trade per bar, and one trade at a time.



===== Operation =====

The Gray lines are BDistance from the Bollinger bands

White square is where the price exceeds the upper/lower BDistance value
and where you would place your market order (Sell if upper, Buy if lower)

Red is LossLimit from the white marker, Green is ProfitMade

If you set UseATR true then the chart markers will reflect ATR-derived
bands, and use the ATR_* properties for LossLimit and ProfitMade.


*/
 

#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