forked from LengKundee/NUNA
109 lines
10 KiB
MQL5
109 lines
10 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Bollinger Bands beginner tutorial.mq5 |
|
|
//| Copyright 2023, GwDs |
|
|
//| Need more help? Contact me on |
|
|
//| https://www.mql5.com/fr/users/william210 |
|
|
//+------------------------------------------------------------------+
|
|
//+-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-
|
|
//+-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
|
|
|
#property copyright "Copyright 2023, GwDs"
|
|
#property version "1.01" // 940
|
|
|
|
#property description "My apologies, this code is no longer available and I don't know how to remove/hide it from codebase"
|
|
|
|
//+-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-
|
|
/*--- Indicator preference */
|
|
input group "Bollinger Bands beginner tutorial to learn"
|
|
input uchar g_BBPeriod = 20; // Averaging period
|
|
input uchar g_BBShift = 0; // Horizontal shift
|
|
input double g_BBDeviation = 2.0; // number of standard deviations
|
|
input ENUM_APPLIED_PRICE g_BBApplied = PRICE_CLOSE; // Type of price
|
|
|
|
//+-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
|
//--- Graph placement
|
|
#property indicator_chart_window // On the graph
|
|
|
|
//+-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
|
// --- Buffer declaration
|
|
#property indicator_buffers 3 // Number of buffer displayed
|
|
int g_PtBB = INVALID_HANDLE; // Pointer of the BB function
|
|
|
|
double g_BufferBBMi[]; // Data buffer middle
|
|
#define g_indexBuffBBMi 0 // Index of buffer middle
|
|
|
|
double g_BufferBBUp[]; // Data buffer Upper
|
|
#define g_indexBuffBBUp 1 // Index of buffer upper
|
|
|
|
double g_BufferBBLo[]; // Data buffer Lower
|
|
#define g_indexBuffBBLo 2 // Index of buffer lower
|
|
|
|
#property indicator_plots 3 // number of plot on the graph
|
|
|
|
//+-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
|
// --- Buffer plot characteristics
|
|
#property indicator_label1 "Band Bollinger Middle" // Label
|
|
#property indicator_type1 DRAW_LINE // Plot type
|
|
#property indicator_color1 clrGray // Color
|
|
#property indicator_style1 STYLE_DOT // Plot style
|
|
#property indicator_width3 1 // Plot width
|
|
|
|
#property indicator_label2 "Band Bollinger upper"
|
|
#property indicator_type2 DRAW_LINE
|
|
#property indicator_color2 clrGreen
|
|
#property indicator_style2 STYLE_SOLID
|
|
#property indicator_width2 1
|
|
|
|
#property indicator_label3 "Band Bollinger Lower"
|
|
#property indicator_type3 DRAW_LINE
|
|
#property indicator_color3 clrRed
|
|
#property indicator_style3 STYLE_SOLID
|
|
#property indicator_width3 1
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| OnInit |
|
|
//+------------------------------------------------------------------+
|
|
int OnInit()
|
|
|
|
{
|
|
Comment( "My apologies, this code is no longer available and I don't know how to remove/hide it from codebase");
|
|
|
|
//+-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-
|
|
return(INIT_SUCCEEDED);
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| OnCalculate |
|
|
//+------------------------------------------------------------------+
|
|
int OnCalculate( const int rates_total, // Total number of bars to be processed
|
|
const int prev_calculated, // Number of bars calculated in the previous call
|
|
const datetime &time[], // Array of bar times
|
|
const double &open[], // Array of bar open prices
|
|
const double &high[], // Array of bar high prices
|
|
const double &low[], // Array of bar low prices
|
|
const double &close[], // Array of bar close prices
|
|
const long &tick_volume[], // Array of tick volumes for each bar
|
|
const long &volume[], // Array of real volumes for each bar
|
|
const int &spread[]) // Array of spreads for each bar
|
|
|
|
{
|
|
|
|
return(rates_total);
|
|
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| OnDeinit |
|
|
//+------------------------------------------------------------------+
|
|
void OnDeinit(const int reason)
|
|
|
|
{
|
|
//+-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-
|
|
/// Raz
|
|
Comment("");
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| The End, That’s All Folks! |
|
|
//+------------------------------------------------------------------+
|
|
//+-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-__-
|
|
//+-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|