90 lines
6.9 KiB
MQL5
90 lines
6.9 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| I-StrategieCSL.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
|
|
|
|
//---
|
|
#include "..\..\TF-Dateien\TF-Class\TFLog.mqh"
|
|
#include "TFGUI.mqh"
|
|
|
|
//---
|
|
//#property indicator_separate_window
|
|
#property indicator_chart_window
|
|
#property indicator_buffers 1
|
|
#property indicator_plots 0
|
|
|
|
input string inp_Strategie="0"; // Input Strategie Nummer
|
|
input string inp_Strategie_Name="Name"; // Input Strategie Name
|
|
input int inp_Strategie_Len=1; // Input Strategie Länge
|
|
//---
|
|
string g_Strategie=inp_Strategie; // Globale Strategie Nummer
|
|
|
|
//---
|
|
double g_Buffer0[]; // Globaler Buffer0
|
|
|
|
//---
|
|
CTFGUI StrategieGui;
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Custom indicator initialization function |
|
|
//+------------------------------------------------------------------+
|
|
int OnInit()
|
|
{
|
|
//---
|
|
StrategieGui.Strategie(g_Strategie);
|
|
StrategieGui.StrategieName(inp_Strategie_Name);
|
|
StrategieGui.SetStringLen(inp_Strategie_Len);
|
|
//---
|
|
if(!StrategieGui.OnInitEvent())
|
|
return(INIT_FAILED);
|
|
//--- indicator buffers mapping
|
|
SetIndexBuffer(0, g_Buffer0, INDICATOR_CALCULATIONS);
|
|
ArraySetAsSeries(g_Buffer0, true);
|
|
//---
|
|
return(INIT_SUCCEEDED);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Custom indicator deinitialization function |
|
|
//+------------------------------------------------------------------+
|
|
void OnDeinit(const int reason)
|
|
{
|
|
//---
|
|
StrategieGui.OnDeInitEvent(reason);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| 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[])
|
|
{
|
|
//---
|
|
g_Buffer0[0]=(double)g_Strategie;
|
|
//--- return value of prev_calculated for next call
|
|
return(rates_total);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| ChartEvent function |
|
|
//+------------------------------------------------------------------+
|
|
void OnChartEvent(const int id,
|
|
const long &lparam,
|
|
const double &dparam,
|
|
const string &sparam)
|
|
{
|
|
//---
|
|
StrategieGui.ChartEvent(id, lparam, dparam, sparam);
|
|
g_Strategie=StrategieGui.Strategie();
|
|
}
|
|
//+------------------------------------------------------------------+
|