Download MetaTrader 5

BB-Fibs

To add comments, please log in or register
Interested in the Market activity? Come and track!
Niche
5
Niche 2011.01.02 00:41 

New at programming, need help programming a Bollinger Bands - Fibonacci Indicator. It is like a regular BBs but instead of using standard deviation as the measure of volatility, a Wilders Smoothed ATR is used in its place. The middle band remains the same.

UpperBand3:= MidPoint + (factor3 * Smoothed ATR);     Factor3 = 4.236
UpperBand2:= MidPoint + (factor2 * Smoothed ATR);     Factor2 = 2.618
UpperBand1:= MidPoint + (factor1 * Smoothed ATR);     Factor1 = 1.618

MiddleBand = same as Bollinger Bands;

LowerBand1:= MidPoint - (factor1 * Smoothed ATR);     Factor1 = 1.618
LowerBand2:= MidPoint - (factor2 * Smoothed ATR);     Factor2 = 2.618             
LowerBand3:= MidPoint - (factor3 * Smoothed ATR);     Factor3 = 4.236

While compiling there is a problem on the Custom indicator iteration function as shown in the attached image.

I will add my code just in case someone takes a look at it and helps me with my programming skills 

I appreciate the help and looking forward for the book.  

Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Types - Documentation on MQL5
Files:
BBgFibs.jpg 409 kb
Rashid Umarov
Admin
11820
Rashid Umarov 2011.01.13 13:05  

I see 12 parameters in your OnCalculate function on the picture. Must be 10 ones according to https://www.mql5.com/en/docs/basis/function/events#oncalculate

int OnCalculate (const int rates_total,      // size of input timeseries
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   );
Documentation on MQL5: Language Basics / Functions / Event Handling Functions
  • www.mql5.com
Language Basics / Functions / Event Handling Functions - Documentation on MQL5
To add comments, please log in or register