last ...
This commit is contained in:
@@ -59,7 +59,7 @@ input string eaLogSuffix = ""; // Log Suffix
|
|||||||
// [XFIMA1|EURUSDb|M5||25.0|5|]
|
// [XFIMA1|EURUSDb|M5||25.0|5|]
|
||||||
// [XFIMA1|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,1,0,2,0)]
|
// [XFIMA1|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,1,0,2,0)]
|
||||||
// [XFIMA1|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,3,0,2,0)]
|
// [XFIMA1|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,3,0,2,0)]
|
||||||
input string eaSymbolConfiguration = "[XFIMA1|EURUSDb|M5||25.0|5|]"; // Symbol Configurations
|
input string eaSymbolConfiguration = "[XFIMA1|EURUSDb|M15||25.0|5|]"; // Symbol Configurations
|
||||||
|
|
||||||
//
|
//
|
||||||
// Management ...
|
// Management ...
|
||||||
@@ -418,6 +418,16 @@ void OnSignalTriggered(XSignal &signal)
|
|||||||
eaExpert.HandleOnSignalTriggered(signal);
|
eaExpert.HandleOnSignalTriggered(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger OnSignal Executed Event ...
|
||||||
|
*
|
||||||
|
* @param signal: XSignal
|
||||||
|
*/
|
||||||
|
void OnSignalExecuted(XSignal &signal)
|
||||||
|
{
|
||||||
|
eaExpert.HandleOnSignalExecuted(signal);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle StopLoss Triggered Positions ...
|
* Handle StopLoss Triggered Positions ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3074,6 +3074,223 @@ class XCXFIMAHelper : public XCBaseHelper
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ZigZag Pivots With Liquidity ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check ZigZag has Lower Low by Liquidity or Not ...
|
||||||
|
*
|
||||||
|
* @param barIndex: int, Specified Bar Index ...
|
||||||
|
* @param forceBarValidation: bool, Force Bar Price based on Pivot ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool HasZigZagLowerLowByLiquidity(
|
||||||
|
int barIndex = 0,
|
||||||
|
bool forceBarValidation = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize ...
|
||||||
|
XOHCL bar;
|
||||||
|
barIndex = NormalizeBarIndex(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = IsValid() &&
|
||||||
|
bar.Init(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Pivots ...
|
||||||
|
XPivot pivots[];
|
||||||
|
int count = ExtractZigZagPivots(
|
||||||
|
pivots,
|
||||||
|
barIndex,
|
||||||
|
10,
|
||||||
|
200 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Pivots and Nearest Pivot is Low ...
|
||||||
|
result = IsValidSize(count) &&
|
||||||
|
pivots[0].IsVale();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
XClean(pivots);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Directional Pivots ...
|
||||||
|
XPivot selected[];
|
||||||
|
count = ExtractPivots(
|
||||||
|
selected,
|
||||||
|
pivots,
|
||||||
|
X_PIVOT_TYPE_VALE //
|
||||||
|
);
|
||||||
|
result = IsValidSize(count) &&
|
||||||
|
count >= 3;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
XClean(pivots);
|
||||||
|
XClean(selected);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Calculations ...
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
// Check Pivot ...
|
||||||
|
selected[0].value < selected[1].value &&
|
||||||
|
//
|
||||||
|
// Check Liquidity ...
|
||||||
|
selected[1].value > selected[2].value &&
|
||||||
|
//
|
||||||
|
// Check Bar Place ...
|
||||||
|
(!forceBarValidation
|
||||||
|
? true
|
||||||
|
: bar.open > selected[0].value &&
|
||||||
|
bar.close > selected[0].value);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
bar.Clean();
|
||||||
|
XClean(pivots);
|
||||||
|
XClean(selected);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check ZigZag has Higher High by Liquidity or Not ...
|
||||||
|
*
|
||||||
|
* @param barIndex: int, Specified Bar Index ...
|
||||||
|
* @param forceBarValidation: bool, Force Bar Price based on Pivot ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool HasZigZagHigherHighByLiquidity(
|
||||||
|
int barIndex = 0,
|
||||||
|
bool forceBarValidation = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize ...
|
||||||
|
XOHCL bar;
|
||||||
|
barIndex = NormalizeBarIndex(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = IsValid() &&
|
||||||
|
bar.Init(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Pivots ...
|
||||||
|
XPivot pivots[];
|
||||||
|
int count = ExtractZigZagPivots(
|
||||||
|
pivots,
|
||||||
|
barIndex,
|
||||||
|
10,
|
||||||
|
200 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Pivots and Nearest Pivot is Low ...
|
||||||
|
result = IsValidSize(count) &&
|
||||||
|
pivots[0].IsPeak();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
XClean(pivots);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Directional Pivots ...
|
||||||
|
XPivot selected[];
|
||||||
|
count = ExtractPivots(
|
||||||
|
selected,
|
||||||
|
pivots,
|
||||||
|
X_PIVOT_TYPE_PEAK //
|
||||||
|
);
|
||||||
|
result = IsValidSize(count) &&
|
||||||
|
count >= 3;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
XClean(pivots);
|
||||||
|
XClean(selected);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Calculations ...
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
// Check Pivot ...
|
||||||
|
selected[0].value > selected[1].value &&
|
||||||
|
//
|
||||||
|
// Check Liquidity ...
|
||||||
|
selected[1].value < selected[2].value &&
|
||||||
|
//
|
||||||
|
// Check Bar Place ...
|
||||||
|
(!forceBarValidation
|
||||||
|
? true
|
||||||
|
: bar.open < selected[0].value &&
|
||||||
|
bar.close < selected[0].value);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
bar.Clean();
|
||||||
|
XClean(pivots);
|
||||||
|
XClean(selected);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extractions ...
|
// Extractions ...
|
||||||
|
|
||||||
|
|||||||
@@ -372,11 +372,11 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
structureConfig,
|
structureConfig,
|
||||||
barIndex //
|
barIndex //
|
||||||
);
|
);
|
||||||
// poiDrawer.drawnObjects.Clear();
|
poiDrawer.drawnObjects.Clear();
|
||||||
// poiDrawer.DrawMarketStructure(
|
poiDrawer.DrawMarketStructure(
|
||||||
// structure,
|
structure,
|
||||||
// structureDrawConfig //
|
structureDrawConfig //
|
||||||
// );
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Strategy 1 ...
|
// Strategy 1 ...
|
||||||
@@ -395,7 +395,22 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
if (!has)
|
if (!has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
has = Strategy2HasSignal(
|
// has = Strategy2HasSignal(
|
||||||
|
// iBar,
|
||||||
|
// iZone,
|
||||||
|
// iTargets,
|
||||||
|
// iDir,
|
||||||
|
// iFIMAConditions,
|
||||||
|
// structure //
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Strategy 3 ...
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = Strategy3HasSignal(
|
||||||
iBar,
|
iBar,
|
||||||
iZone,
|
iZone,
|
||||||
iTargets,
|
iTargets,
|
||||||
@@ -406,7 +421,17 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
has = HasDirection(iDir);
|
has = HasDirection(iDir) &&
|
||||||
|
iZone.IsValid();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = false;
|
||||||
|
iZone.Clean();
|
||||||
|
iDir = X_DIRECTION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -848,7 +873,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Bar Has Signal Based on Strategy 1 ...
|
* Check Bar Has Signal Based on Strategy 2 ...
|
||||||
*
|
*
|
||||||
* @param bar: XOHCL, reference to Bar ...
|
* @param bar: XOHCL, reference to Bar ...
|
||||||
* @param zone: XBoxZone, reference to holds affected zone ...
|
* @param zone: XBoxZone, reference to holds affected zone ...
|
||||||
@@ -1165,6 +1190,102 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Bar Has Signal Based on Strategy 3 ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL, reference to Bar ...
|
||||||
|
* @param zone: XBoxZone, reference to holds affected zone ...
|
||||||
|
* @param targets: XTarget, reference to detected Signal's Targets collections ...
|
||||||
|
* @param dir: ENUM_X_DIRECTION, detected Signal's direction ...
|
||||||
|
* @param conditions: XFIMAConditions, reference to Bar Specified XFIMA Conditions ...
|
||||||
|
* @param structure: XFIMAMarketStructure, refrence to Provides Market Structure ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool Strategy3HasSignal(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &zone,
|
||||||
|
XTarget &targets[],
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
XFIMAConditions &conditions,
|
||||||
|
XFIMAMarketStructure &_structure //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare ...
|
||||||
|
zone.Clean();
|
||||||
|
XClean(targets);
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define Requirements ...
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
int barIndex = bar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Conditions Checking ...
|
||||||
|
|
||||||
|
//
|
||||||
|
result = fimaHelper.HasMACross(
|
||||||
|
dir,
|
||||||
|
barIndex,
|
||||||
|
structureConfig.maCrossValidationDiffMultiplier //
|
||||||
|
);
|
||||||
|
isBullish =
|
||||||
|
result &&
|
||||||
|
IsXBullish(dir);
|
||||||
|
isBearish =
|
||||||
|
result &&
|
||||||
|
IsXBearish(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Zone ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Zone Detection ...
|
||||||
|
|
||||||
|
//
|
||||||
|
result = zone.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Targets ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Target Handling ...
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zone.Clean();
|
||||||
|
XClean(targets);
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user