TF-altProjekte/Indukatoren/I-Modul-Symbol/I-Symbol-V0.mq5

60 lines
2.2 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 16:31:33 +02:00
//+------------------------------------------------------------------+
//| I-Symbol-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,"Symbol-1");
ArraySetAsSeries(i_Buffer0,true);
SetIndexBuffer(1,i_Buffer1,INDICATOR_DATA);
PlotIndexSetString(1,PLOT_LABEL,"Symbol-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]=444;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+