//+------------------------------------------------------------------+ //| CandleCount.mq5 | //| Copyright 2022, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2022, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #include #include //EA paramters #include //Trading hours checks #include //Trading conditions checks #include //Trading conditions checks #include //Lot size calculator #include //Lot size calculator //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ #include CiMA* sma; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { //--- sma = new CiMA(); sma.Create(gSymbol, InpTimeFrame, InpPeriods, InpAppliedPrice, InpMethod, PRICE_CLOSE); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- TimeCurrent(dt); SymbolInfoTick(InpInstrument1,last_tick); SymbolInfoTick(InpInstrument2, blast_tick); sma.Refresh(-1); gSma = sma.Main(1); CheckOperationHours(); CheckPreChecks(); ScanPositions(); if(!gIsPreChecksOk) return; Print("Good for trading..."); ExecuteEntry(); } //+------------------------------------------------------------------+