last works on FIMA Back Tester ...

This commit is contained in:
2025-09-19 15:10:55 +03:30
parent 38d741da18
commit 5872d9f29b
4 changed files with 395 additions and 48 deletions
+100 -44
View File
@@ -27,7 +27,7 @@
#include "../Classes/x-saherelm.x-backtester.expert.class.mq5"
#include "../Classes/x-saherelm.x-market.pattern.class.mq5"
#include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
#include "../Helpers/x-saherelm.xom1.helper.mq5"
#include "../XFIMA/Classes/x-saherelm.xfima.signaller.class.mq5"
//
// Definitions ...
@@ -132,6 +132,7 @@ input int valeArrowCode = 159; // Vales Arrow Code
//
string eaLogTag; // EA Log Prefix ...
XCBackTesterEA *eaExpert; // EA Expert ...
XCXFIMAStrategy1Signaller *fima1Signaller; // XFIMA1 Signaller ...
XCMarketPatternDetector *eaPatternDetector; // EA Pattern Detector ...
//
@@ -235,50 +236,70 @@ int OnInit()
}
//
// Initial Indicator Handler ...
eaHandler = iCustom(
// Here Instantiate Signaller Class ...
//
// Preparing Indicator Inputs ...
XFIMAInputs fimaInputs;
//
// This is Default Configuration ...
fimaInputs.Default();
fimaInputs.Hide();
fimaInputs.showZigZag = true;
//
// Here we Attach Inputs to Indicator ...
fimaInputs.scMethod = scMethod;
fimaInputs.scPeriod = scPeriod;
fimaInputs.mcMethod = mcMethod;
fimaInputs.mcPeriod = mcPeriod;
fimaInputs.lcMethod = lcMethod;
fimaInputs.lcPeriod = lcPeriod;
fimaInputs.hcMethod = hcMethod;
fimaInputs.hcPeriod = hcPeriod;
fimaInputs.upperMode = upperMode;
fimaInputs.lowerMode = lowerMode;
fimaInputs.fiboUpperZoneLevel = fiboUpperZoneLevel;
fimaInputs.fiboMiddleZoneLevel = fiboMiddleZoneLevel;
fimaInputs.fiboLowerZoneLevel = fiboLowerZoneLevel;
fimaInputs.sarStep = sarStep;
fimaInputs.sarMax = sarMax;
fimaInputs.maMethod = maMethod;
fimaInputs.maAppliedTo = maAppliedTo;
fimaInputs.maFastLength = maFastLength;
fimaInputs.maSlowLength = maSlowLength;
fimaInputs.zigzagDepth = zigzagDepth;
fimaInputs.zigzagDeviation = zigzagDeviation;
fimaInputs.zigzagBackStep = zigzagBackStep;
fimaInputs.zigzagUppersMode = zigzagUppersMode;
fimaInputs.zigzagLowersMode = zigzagLowersMode;
fimaInputs.showPV = showPV;
fimaInputs.showSAR = showSAR;
fimaInputs.showMAFast = showMAFast;
fimaInputs.showMASlow = showMASlow;
fimaInputs.showZigZag = showZigZag;
fimaInputs.showFiboZone = showFiboZone;
fimaInputs.startCalculationForLastBars = startCalculationForLastBars;
fimaInputs.sarArrowCode = sarArrowCode;
fimaInputs.peakArrowCode = peakArrowCode;
fimaInputs.valeArrowCode = valeArrowCode;
//
// Instantiate Signaller ...
fima1Signaller = new XCXFIMAStrategy1Signaller(
_Symbol,
_Period,
"x-saherelm.xfima",
"", // Calculation ...
scMethod,
scPeriod,
mcMethod,
mcPeriod,
lcMethod,
lcPeriod,
hcMethod,
hcPeriod,
upperMode,
lowerMode,
fiboUpperZoneLevel,
fiboMiddleZoneLevel,
fiboLowerZoneLevel,
sarStep,
sarMax,
maMethod,
maAppliedTo,
maFastLength,
maSlowLength,
zigzagDepth,
zigzagDeviation,
zigzagBackStep,
zigzagUppersMode,
zigzagLowersMode,
"", // Presentation ...
showPV,
showSAR,
showMAFast,
showMASlow,
showZigZag,
showFiboZone,
startCalculationForLastBars,
sarArrowCode,
peakArrowCode,
valeArrowCode
//
fimaInputs,
true, // Process All Ticks ...
2.0, // Signaller Risk to Reward Ratio ...
50, // Default Risk In Points ...
0.01 // Defaul Volume ...
);
isInited = eaHandler != INVALID_HANDLE;
fima1Signaller.AddOnSignalEventHandler(OnSignalTriggered);
//
isInited = fima1Signaller.IsValid();
if (!isInited)
{
//
@@ -387,6 +408,9 @@ void OnTick()
//
DetectPatterns();
//
fima1Signaller.OnTick();
}
//
@@ -526,6 +550,38 @@ void DestroyTimer()
// EventKillTimer();
}
/**
* Trigger OnSignal Event ...
*
* @param signal: XSignal
*/
void OnSignalTriggered(XSignal &signal)
{
//
CChartObjectVLine *iObj = new CChartObjectVLine();
//
string iName = signal.GetTag();
color iColor = IsLong(signal.type) ? clrLime : clrRed;
//
bool has = iObj.Create(
eaDrawer.ChartIdentification(),
iName,
eaDrawer.SubWindowIdentification(),
signal.time //
);
if (has)
{
//
iObj.Width(2);
iObj.Color(iColor);
//
draws.Add(iObj);
}
}
//
// Trade Event Handlers ...
@@ -704,8 +760,8 @@ void DetectPatterns()
bool detectSwingTrendBreakes = false;
//
bool detectSupports = false;
bool detectResistance = false;
bool detectSupports = true;
bool detectResistance = true;
//
// Checking Momentum Bar ...