87 lines
2.9 KiB
MQL5
87 lines
2.9 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| DreizackEA.mq5 |
|
|
//| Copyright 2024, MetaQuotes Ltd. |
|
|
//| https://www.mql5.com |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2024, MetaQuotes Ltd."
|
|
#property link "https://www.mql5.com"
|
|
#property version "1.00"
|
|
//+------------------------------------------------------------------+
|
|
//| Inputs |
|
|
//+------------------------------------------------------------------+
|
|
|
|
input group "=== General Settings ==="
|
|
static input long InpMagicnumber = 123145; //magic number
|
|
static input double InpLotSize = 0.01; // lot size
|
|
input ENUM_TIMEFRAMES InpTimeframe = PERIOD_M5; //timeframe
|
|
input int InpTakeProfit = 400; // take profit in points 0=off
|
|
input int InpStopLoss = 200; // stop loss in points 0=off
|
|
input int InpTradingTimeStart = 8; // Trading Time Start
|
|
input int InpTradingTimeStop = 16; // Trading Time Stop
|
|
|
|
|
|
input group "=== Indicator Settings ==="
|
|
input int InpSlowEMA = 100; // slow EMA period
|
|
input int InpMidEMA = 50; // mid EMA period
|
|
input int InpFastEMA = 25; // fast EMA period
|
|
input int InpTriggerPeriod = 5; //max candle between signal and trigger
|
|
input int InpDistance = 20; // difference between EMAs
|
|
|
|
|
|
|
|
|
|
int OnInit(){
|
|
|
|
|
|
if(!CheckInputs()){return INIT_PARAMETERS_INCORRECT;}
|
|
|
|
|
|
return(INIT_SUCCEEDED);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Expert deinitialization function |
|
|
//+------------------------------------------------------------------+
|
|
void OnDeinit(const int reason)
|
|
{
|
|
//---
|
|
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Expert tick function |
|
|
//+------------------------------------------------------------------+
|
|
void OnTick()
|
|
{
|
|
//---
|
|
|
|
}
|
|
|
|
|
|
bool CheckInputs(){
|
|
|
|
if(InpMagicnumber<=0){
|
|
Alert("wrong input: magicnumber <= 0");
|
|
return false;
|
|
}
|
|
if(InpLotSize<=0){
|
|
Alert("wrong input: lot size <= 0");
|
|
return false;
|
|
}
|
|
if(InpStopLoss<0){
|
|
Alert("wrong input: stoploss < 0");
|
|
return false;
|
|
}
|
|
if(InpTakeProfit<0){
|
|
Alert("wrong input: take profit < 0");
|
|
return false;
|
|
}
|
|
if(InpTradingTimeStart<0 && InpTradingTimeStart > 24 ){
|
|
Alert("wrong input: time start < 0 and >24");
|
|
return false;
|
|
}
|
|
if(InpTradingTimeStop<0 && InpTradingTimeStart > 24){
|
|
Alert("wrong input: time start < 0 and >24");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|