Variation Indicator For MT5
Variation Indicator For MT5 adalah penunjuk trend yang terdapat dalam tiga varian.
Tiga variasi Penunjuk Variasi Untuk MT5 datang sebagai fail MQL5 yang berbeza yang mesti dimasukkan ke folder MQL5Indicator untuk pedagang dapat menggunakannya.
Varian adalah:
• Variasi.mq5
• ColorVariation.mq5
• ColorJVariation.mq5
Setiap tiga indikator itu diplotkan pada carta penunjuk berasingan.
The Variation.mq5 melancarkan garis berayun berwarna merah jambu yang berayun tentang garis pusat 0. Bergantung pada bahagian tengah garisan berayun, seorang peniaga dapat mengenal pasti trend di pasaran. Sekiranya garis berayun berada di atas garis tengah, ia menunjukkan bahawa terdapat trend menaik. Sekiranya garis berayun berada di bawah garis tengah, ia menunjukkan bahawa ada trend menurun.
ColorVariation.mq5 adalah versi yang diperbaiki dari Variation.mq5 dan ia memaparkan garis berayun yang berubah warna dari hijau menjadi merah dan sebaliknya bergantung pada trend pasaran. Penunjuk ini memudahkan peniaga membuka dan menutup perdagangan kerana ia menunjukkan apabila tren berubah daripada menunggu garis untuk menyeberangi garis tengah. Apabila warna garisan berayun bertukar menjadi hijau, ia menunjukkan bahawa ada trend menaik. Apabila garis berayun bertukar merah, ia menunjukkan bahawa terdapat trend menurun.
ColorJVariation.mq5 adalah versi yang lebih baik dari ColorVariation.mq5 yang menggunakan kelas JJMA SmoothAlgorithms.mqh untuk menghapuskan isyarat palsu dan membuat garis berayun lancar.
Memasang Variation Indicator For MT5
Selepas anda memuat turun penunjuk melalui borang di atas, anda perlu unzip fail zip. Kemudian anda perlu menyalin fail colorjvariation.mq5 ke folder MQL5Indicators pemasangan MT5 anda. Selepas itu sila mulakan MT5 dan kemudian anda akan dapat melihat penunjuk dalam senarai petunjuk.
Parameter Variation Indicator For MT5
Variation Indicator For MT5 mempunyai parameter 5 untuk mengkonfigurasi.
input int Period_=12; //period of averaging
input ENUM_MA_METHOD MA_Method_=MODE_SMA; //method of averaging
input int JLength_=3; // depth of JMA smoothing
input int JPhase_=100; // parameter of the JMA smoothing,
input int Shift=0; // horizontal shift of the indicator in bars
Variation Indicator For MT5
Variation Indicator For MT5 menyediakan buffer 2 .
SetIndexBuffer(0,LineBuffer,INDICATOR_DATA);
SetIndexBuffer(1,ColorLineBuffer,INDICATOR_COLOR_INDEX);
Bahagian Utama Kod
int OnCalculate
(
const int rates_total,// number of bars in history at the current tick
const int prev_calculated,// amount of history in bars at the previous tick
const int begin,// number of beginning of reliable counting of bars
const double &price[]// price array for calculation of the indicator
)
{
//---- Checking if the number of bars is sufficient for the calculation
if(rates_total lt min_rates_total+begin) return(0);
//---- Declaration of integer variables
int first1,first2=0,bar;
//---- declaration of variables with a floating point
double ma1,ma2,ma3,jma3;
//---- Declaration of static variables
static int start1,start2,start3,start4;
//---- Initialization of the indicator in the OnCalculate() block
if(prev_calculated gt rates_total || prev_calculated lt =0)// checking for the first start of the indicator calculation
{
first1=begin; // starting number for calculation of all bars
//---- Initialization of variables of the start of data calculation
start1=begin;
if(MA_Method_!=MODE_EMA)
{
start2 = start1 + Period_;
start3 = start2 + Period_;
start4 = start3 + Period_;
first2 = start4 + 30 + 2;
}
else
{
start2 = start1 + 30;
start3 = start2 + 30;
start4 = start3 + 30;
first2 = start4 + 30 + 2;
}
//--- increase the position of the data start by begin bars as a result of the calculation using data of another indicator
if(begin gt 0) PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,first2);
}
else
{
first1=prev_calculated-1; // starting index for calculation of new bars
first2=first1;
}
//---- declaration of the Moving_Average class variables from the SmoothAlgorithms.mqh file
static CMoving_Average MA1,MA2,MA3;
//---- declaration of the JJMA class variables from the SmoothAlgorithms.mqh file
static CJJMA JMA;
//---- Main calculation loop of the indicator
for(bar=first1; bar lt rates_total; bar++)
{
//---- Three call of the function MASeries.
ma1 = MA1.MASeries(start1, prev_calculated, rates_total, Period_, MA_Method_, price[bar], bar, false);
ma2 = MA2.MASeries(start2, prev_calculated, rates_total, Period_, MA_Method_, price[bar]-ma1, bar, false);
ma3 = MA3.MASeries(start3, prev_calculated, rates_total, Period_, MA_Method_, price[bar]-ma2-ma1, bar, false);
//---- One call of the JJMASeries function.
//The parameters Phase and Length don t change at every bar (Din = 0)
jma3=JMA.JJMASeries(start4,prev_calculated,rates_total,0,JPhase_,JLength_,ma3,bar,false);
//----
LineBuffer[bar]=jma3;
}
//---- Main indicator line coloring loop
for(bar=first2; bar lt rates_total; bar++)
{
ColorLineBuffer[bar]=0;
if(LineBuffer[bar] gt LineBuffer[bar-1]) ColorLineBuffer[bar]=1;
if(LineBuffer[bar] lt LineBuffer[bar-1]) ColorLineBuffer[bar]=2;
}
//----
return(rates_total);
}
//+------------------------------------------------------------------+