TF-altProjekte/Indukatoren/I-Test/I-Test-V1.mq5
super.admin 84cd1a7ab0 convert
2025-05-30 16:31:33 +02:00

76 lines
2.7 KiB
MQL5

//+------------------------------------------------------------------+
//| I-Test-V1.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
#property indicator_buffers 4
#property indicator_plots 0
//---
#include "..\..\TF-Dateien\TF-Class\TFLog.mqh"
//---
double Buffer_Anzahl[];
double Buffer_T1[];
double Buffer_T2[];
double Buffer_T3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
PrintLogInfo("******************************* Start Indicator ************************");
//--- indicator buffers mapping
SetIndexBuffer(0, Buffer_Anzahl, INDICATOR_CALCULATIONS);
SetIndexBuffer(1, Buffer_T1, INDICATOR_CALCULATIONS);
SetIndexBuffer(2, Buffer_T2, INDICATOR_CALCULATIONS);
SetIndexBuffer(3, Buffer_T3, INDICATOR_CALCULATIONS);
ArraySetAsSeries(Buffer_Anzahl, true);
ArraySetAsSeries(Buffer_T1, true);
ArraySetAsSeries(Buffer_T2, true);
ArraySetAsSeries(Buffer_T3, true);
//---
IndicatorSetString(INDICATOR_SHORTNAME, "Test Indicator");
//---
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[])
{
//---
ArraySetAsSeries(close, true);
int start=rates_total-prev_calculated-1;
//---
if(start<0)
start=0;
//---
for(int i=start; i>=0; i--)
{
Buffer_Anzahl[i]=3;
Buffer_T1[i]=close[i];
Buffer_T2[i]=rates_total;
Buffer_T3[i]=prev_calculated;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+