59 lines
2.3 KiB
MQL5
59 lines
2.3 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| I-Strategie-Close-V0.mq5 |
|
|
//| Thorsten Fischer Copyright 2020 |
|
|
//| https://mql5.tfsystem.de |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Thorsten Fischer Copyright 2020"
|
|
#property link "https://mql5.tfsystem.de"
|
|
#property version "1.00"
|
|
#property strict
|
|
#property indicator_chart_window
|
|
//--- Number of buffers to calculate the indicator
|
|
#property indicator_buffers 2
|
|
//--- Number of graphic series in the indicator
|
|
#property indicator_plots 2
|
|
//---
|
|
double i_Buffer0[];
|
|
double i_Buffer1[];
|
|
//+------------------------------------------------------------------+
|
|
//| Custom indicator initialization function |
|
|
//+------------------------------------------------------------------+
|
|
int OnInit()
|
|
{
|
|
//--- indicator buffers mapping
|
|
SetIndexBuffer(0,i_Buffer0,INDICATOR_DATA);
|
|
PlotIndexSetString(0,PLOT_LABEL,"S-close-1");
|
|
ArraySetAsSeries(i_Buffer0,true);
|
|
SetIndexBuffer(1,i_Buffer1,INDICATOR_DATA);
|
|
PlotIndexSetString(1,PLOT_LABEL,"S-close-2");
|
|
ArraySetAsSeries(i_Buffer1,true);
|
|
//---
|
|
return(INIT_SUCCEEDED);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Custom indicator iteration function |
|
|
//+------------------------------------------------------------------+
|
|
int OnCalculate(const int rates_total,
|
|
const int prev_calculated,
|
|
const datetime &time[],
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &low[],
|
|
const double &close[],
|
|
const long &tick_volume[],
|
|
const long &volume[],
|
|
const int &spread[])
|
|
{
|
|
//---
|
|
int start=rates_total-prev_calculated-1;
|
|
if(start<0) start=0;
|
|
//---
|
|
for(int i=start; i>=0; i--)
|
|
{
|
|
i_Buffer0[i]=1;
|
|
i_Buffer1[i]=666;
|
|
}
|
|
//--- return value of prev_calculated for next call
|
|
return(rates_total);
|
|
}
|
|
//+------------------------------------------------------------------+
|