65 lines
1.9 KiB
MQL5
65 lines
1.9 KiB
MQL5
//+------------------------------------------------------------------+
| |
//| Chapter2.mqh |
| |
//| Copyright 2025, MetaQuotes Ltd. |
| |
//| https://www.mql5.com |
| |
//+------------------------------------------------------------------+
| |
#property copyright "Copyright 2025, MetaQuotes Ltd."
| |
#property link "https://www.mql5.com"
| |
#property version "1.00"
| |
| |
#include "IAnalyser.mqh"
| |
#include "../Configs/TfBarSeries.mqh"
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
class Chapter2: public IAnalyser//---
| |
{
| |
private:
| |
bool isStartup;
| |
public:
| |
| |
Chapter2() {}
| |
~Chapter2() {}
| |
| |
| |
| |
virtual string GetAnalyserName() override { return "Chapter2"; }
| |
| |
virtual void ProcessBar(TfBarSeries &series, int barIndex) override
| |
{
| |
| |
| |
//detectSwings(series, barIndex);
| |
| |
| |
| |
| |
| |
}
| |
| |
void detectSwings(TfBarSeries &series, int barIndex)
| |
{
| |
int sB = barIndex - 3;
| |
if(IsSwingHigh(barIndex - 3, series.GetIndicator(0)))
| |
{Print("IsSwingHigh");
| |
| |
SwingDetactedEvent* s = new SwingDetactedEvent(series.symbol, series.tf, BULL, series.Time(sB), series.High(sB));
| |
eventBus.Push(s);
| |
}
| |
| |
if(IsSwingLow(barIndex - 3, series.GetIndicator(0)))
| |
{Print("IsSwingLow");
| |
| |
SwingDetactedEvent* s = new SwingDetactedEvent(series.symbol, series.tf, BEAR, series.Time(sB), series.Low(sB));
| |
eventBus.Push(s);
| |
}
| |
| |
}
| |
| |
bool isBullCandle(double open, double close)
| |
{
| |
| |
return (open < close);
| |
}
| |
};
| |
//+------------------------------------------------------------------+
|