mirror of
https://github.com/rithsila/MT5-EA-Sniper-Strategy.git
synced 2026-08-15 19:58:12 +00:00
51 lines
1.6 KiB
Plaintext
51 lines
1.6 KiB
Plaintext
//+------------------------------------------------------------------+
|
|
//| NewCandleAlert.mq4 |
|
|
//| Copyright 2022, Nkondog Anselme Venceslas. |
|
|
//| https://www.linkedin.com/in/nkondog |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2022, Nkondog Anselme Venceslas."
|
|
#property link "https://www.linkedin.com/in/nkondog"
|
|
#property version "1.00"
|
|
#property strict
|
|
//+------------------------------------------------------------------+
|
|
//| Expert initialization function |
|
|
//+------------------------------------------------------------------+
|
|
int OnInit()
|
|
{
|
|
//---
|
|
|
|
//---
|
|
return(INIT_SUCCEEDED);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Expert deinitialization function |
|
|
//+------------------------------------------------------------------+
|
|
void OnDeinit(const int reason)
|
|
{
|
|
//---
|
|
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Expert tick function |
|
|
//+------------------------------------------------------------------+
|
|
void OnTick()
|
|
{
|
|
//---
|
|
newBar();
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
|
|
bool newBar()
|
|
{
|
|
static datetime prevTime = 0;
|
|
datetime currentTime = iTime(Symbol(), PERIOD_CURRENT, 0);
|
|
if(currentTime != prevTime)
|
|
{
|
|
prevTime = currentTime;
|
|
|
|
Alert("New candle");
|
|
|
|
return(true);
|
|
}
|
|
return(false);
|
|
} |