last works and apply fix on ZigZag Reading ...

This commit is contained in:
2025-09-20 13:55:34 +03:30
parent 6788675c4a
commit becac9983d
5 changed files with 851 additions and 41 deletions
+49 -4
View File
@@ -101,6 +101,7 @@ input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
input int maFastLength = 7; // Fast MA Length
input int maSlowLength = 20; // Slow MA Length
input int maBandLength = 7; // MA Band Length
input int zigzagDepth = 12; // ZigZag Depth
input int zigzagDeviation = 5; // ZigZag Deviation
input int zigzagBackStep = 3; // ZigZag Back Step
@@ -121,6 +122,7 @@ input bool showPV = true; // Show PV
input bool showSAR = true; // Show Sar
input bool showMAFast = true; // Show MA Fast
input bool showMASlow = true; // Show MA Slow
input bool showMABand = true; // Show MA Band
input bool showBarTime = true; // Show Bar Time
input bool showZigZag = true; // Show ZigZag
input bool showFiboZone = true; // Show Fibo Zone
@@ -137,15 +139,19 @@ input int valeArrowCode = 159; // Vales Arrow Code
// Define Local Variables ...
//
// Requirements ...
string eaLogTag; // EA Log Prefix ...
XCBackTesterEA *eaExpert; // EA Expert ...
XCXFIMAPOIDetector *fimaPOIDetector; // EA Fima POI Detector ...
XCMarketPatternDetector *eaPatternDetector; // EA Pattern Detector ...
//
// Registered Signallers ...
XCXFIMAStrategy1Signaller *fima1Signaller; // XFIMA1 Signaller ...
XCXFIMAStrategy2Signaller *fima2Signaller; // XFIMA2 Signaller ...
//
// Drawer and Draws ...
XCPOIDrawer *eaDrawer; // Ea POI Drawer ...
CArrayObj draws; // Drawn Objects ...
@@ -153,7 +159,7 @@ CArrayObj draws; // Drawn Objects ...
XBarTracker eaBarTracker; // EA Bar Traker ...
//
int eaHandler = INVALID_HANDLE; // Indicator Handler ...
// Registered Handlers ...
int eaCTHandler = INVALID_HANDLE; // Candle Timer Handler ...
//
@@ -280,6 +286,7 @@ int OnInit()
fimaInputs.maAppliedTo = maAppliedTo;
fimaInputs.maFastLength = maFastLength;
fimaInputs.maSlowLength = maSlowLength;
fimaInputs.maBandLength = maBandLength;
fimaInputs.zigzagDepth = zigzagDepth;
fimaInputs.zigzagDeviation = zigzagDeviation;
fimaInputs.zigzagBackStep = zigzagBackStep;
@@ -289,6 +296,7 @@ int OnInit()
fimaInputs.showSAR = showSAR;
fimaInputs.showMAFast = showMAFast;
fimaInputs.showMASlow = showMASlow;
fimaInputs.showMABand = showMABand;
fimaInputs.showZigZag = showZigZag;
fimaInputs.showFiboZone = showFiboZone;
fimaInputs.startCalculationForLastBars = startCalculationForLastBars;
@@ -379,6 +387,9 @@ int OnInit()
// Instantiate Market Pattern Detector ...
eaPatternDetector = new XCMarketPatternDetector();
//
fimaPOIDetector = new XCXFIMAPOIDetector();
//
// Instantiate POI Drawer ...
eaDrawer = new XCPOIDrawer();
@@ -410,7 +421,7 @@ void OnDeinit(const int reason)
//
// De Init Indicator ...
IndicatorRelease(eaHandler);
IndicatorRelease(eaCTHandler);
//
eaBarTracker.Clean();
@@ -431,6 +442,10 @@ void OnDeinit(const int reason)
delete fima2Signaller;
ZeroMemory(fima2Signaller);
//
delete fimaPOIDetector;
ZeroMemory(fimaPOIDetector);
//
delete eaExpert;
ZeroMemory(eaExpert);
@@ -608,7 +623,8 @@ void OnSignalTriggered(XSignal &signal)
{
//
// Validate Signal ...
if (!signal.IsValid()) {
if (!signal.IsValid())
{
return;
}
@@ -642,7 +658,6 @@ void OnSignalTriggered(XSignal &signal)
//
// Alert Issued Signal ...
string message = signal.GetMessage();
}
//
@@ -825,6 +840,11 @@ void DetectPatterns()
bool detectSupports = true;
bool detectResistance = true;
//
// XFIMA Patetrns ...
bool detectFIMAPatterns = true;
bool detectZIGZAGPatterns = true;
//
// Checking Momentum Bar ...
if (detectMomentum)
@@ -1164,6 +1184,31 @@ void DetectPatterns()
resistance.Clean();
}
//
// Detecting FIMA Patterns ...
if (detectFIMAPatterns)
{
//
// ZIGZAG Pattern ...
if (detectZIGZAGPatterns)
{
//
XZigZagPoint zigzags[];
int zigzagsCount = fimaPOIDetector.GetZigZagPoint(
cBar,
fima2Signaller.fimaHelper,
zigzags,
3 //
);
has = IsValidSize(zigzagsCount);
if (has)
{
//
Print("Detected ZigZags Points: ", zigzagsCount);
}
}
}
//
cBar.Clean();
}