58 lines
2.4 KiB
MQL5
58 lines
2.4 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| ProfitLossCalculator.mq5 |
|
|
//| Copyright 2020, Thomas Schwabhaeuser |
|
|
//| schwabts@gmail.com |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2020, Thomas Schwabhaeuser"
|
|
#property link "schwabts@gmail.com"
|
|
#define VERSION "1.0"
|
|
#property version VERSION
|
|
#property description "Profit Loss Calculator"
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
#include "ProfitLossCalculator.mqh"
|
|
//+------------------------------------------------------------------+
|
|
//| Global Variables |
|
|
//+------------------------------------------------------------------+
|
|
CProfitLossCalculator calculator;
|
|
//+------------------------------------------------------------------+
|
|
//| Expert initialization function |
|
|
//+------------------------------------------------------------------+
|
|
int OnInit()
|
|
{
|
|
Print(MQLInfoString(MQL_PROGRAM_NAME)+" v"+VERSION);
|
|
//---
|
|
ResetLastError();
|
|
if(!calculator.Create(0, "PLC by Grid", 0, 20, 20, 366, 166))
|
|
{
|
|
Print("Creating calculator failed. Error #", GetLastError());
|
|
return(-1);
|
|
}
|
|
calculator.Run();
|
|
//---
|
|
return(0);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Expert deinitialization function |
|
|
//+------------------------------------------------------------------+
|
|
void OnDeinit(const int reason)
|
|
{
|
|
//---
|
|
calculator.Destroy(reason);
|
|
//---
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| ChartEvent function |
|
|
//+------------------------------------------------------------------+
|
|
void OnChartEvent(const int id,
|
|
const long &lparam,
|
|
const double &dparam,
|
|
const string &sparam)
|
|
{
|
|
//---
|
|
calculator.ChartEvent(id, lparam, dparam, sparam);
|
|
calculator.OnEventLine(id, lparam, dparam, sparam);
|
|
//---
|
|
}
|
|
//+------------------------------------------------------------------+
|