last works ...
This commit is contained in:
@@ -63,7 +63,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
* @param bar: XOHCL, Specified Bar ...
|
* @param bar: XOHCL, Specified Bar ...
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
||||||
* @param requiredBars: int, bar range for approve Momentum ...
|
* @param requiredBars: int, bar range for approve Momentum ...
|
||||||
* @param approvedMultiplier: int, a Multipler for approve Momentum ...
|
* @param approvedMultiplier: double, a Multipler for approve Momentum ...
|
||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
@@ -71,7 +71,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
XOHCL &bar,
|
XOHCL &bar,
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
int requiredBars = 3,
|
int requiredBars = 3,
|
||||||
int approvedMultiplier = 2 //
|
double approvedMultiplier = 2 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -84,7 +84,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
//
|
//
|
||||||
// Normalizing ...
|
// Normalizing ...
|
||||||
requiredBars = NormalizeInt(requiredBars, 3, 10);
|
requiredBars = NormalizeInt(requiredBars, 3, 10);
|
||||||
approvedMultiplier = NormalizeInt(approvedMultiplier, 2, 5);
|
approvedMultiplier = NormalizeDouble(approvedMultiplier, 2, 5);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate ...
|
// Validate ...
|
||||||
@@ -344,7 +344,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
*
|
*
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
* @param bar: XOHCL, Specified Bar ...
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
||||||
* @param shadowApprovedMultiplier: int, Shadow Size Approve Multiplier ...
|
* @param shadowApprovedMultiplier: double, Shadow Size Approve Multiplier ...
|
||||||
* @param minimumPinBarRangeMultiplier: doubble, Range Size Approve Multiplier in Point ...
|
* @param minimumPinBarRangeMultiplier: doubble, Range Size Approve Multiplier in Point ...
|
||||||
* @param forceDirection: bool, Apply Force Bar Type ...
|
* @param forceDirection: bool, Apply Force Bar Type ...
|
||||||
*
|
*
|
||||||
@@ -353,7 +353,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
bool IsPinnedBar(
|
bool IsPinnedBar(
|
||||||
XOHCL &bar,
|
XOHCL &bar,
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
int shadowApprovedMultiplier = 3,
|
double shadowApprovedMultiplier = 3,
|
||||||
double minimumPinBarRangeMultiplier = 4,
|
double minimumPinBarRangeMultiplier = 4,
|
||||||
bool forceDirection = false //
|
bool forceDirection = false //
|
||||||
)
|
)
|
||||||
@@ -367,7 +367,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Normalizing ...
|
// Normalizing ...
|
||||||
shadowApprovedMultiplier = NormalizeInt(shadowApprovedMultiplier, 2, 5);
|
shadowApprovedMultiplier = NormalizeDouble(shadowApprovedMultiplier, 2, 5);
|
||||||
minimumPinBarRangeMultiplier = NormalizeDouble(minimumPinBarRangeMultiplier, 2, 100);
|
minimumPinBarRangeMultiplier = NormalizeDouble(minimumPinBarRangeMultiplier, 2, 100);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -919,7 +919,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
*
|
*
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
* @param bar: XOHCL, Specified Bar ...
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
||||||
* @param shadowApprovedMultiplier: int, Shadow Size Approve Multiplier ...
|
* @param shadowApprovedMultiplier: double, Shadow Size Approve Multiplier ...
|
||||||
* @param minimumPinBarRangeMultiplier: doubble, Range Size Approve Multiplier in Point ...
|
* @param minimumPinBarRangeMultiplier: doubble, Range Size Approve Multiplier in Point ...
|
||||||
* @param forceDirection: bool, Apply Force Bar Type ...
|
* @param forceDirection: bool, Apply Force Bar Type ...
|
||||||
*
|
*
|
||||||
@@ -928,7 +928,7 @@ class XCMarketPatternDetector : public XCBase
|
|||||||
bool IsSignalKeyBarPattern(
|
bool IsSignalKeyBarPattern(
|
||||||
XOHCL &bar,
|
XOHCL &bar,
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
int shadowApprovedMultiplier = 3,
|
double shadowApprovedMultiplier = 3,
|
||||||
double minimumPinBarRangeMultiplier = 4,
|
double minimumPinBarRangeMultiplier = 4,
|
||||||
bool forceDirection = false //
|
bool forceDirection = false //
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,699 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Check Market Conditions for Pattern Detection ...
|
||||||
|
*/
|
||||||
|
void DetectPatterns()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!eaIsNewBar)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize 1 Indexed Bar ...
|
||||||
|
XOHCL cBar;
|
||||||
|
bool has = cBar.Init(
|
||||||
|
_Symbol,
|
||||||
|
_Period,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Analysis ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define Detection Flags ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectPinned = false;
|
||||||
|
bool detectMomentum = false;
|
||||||
|
bool detectEngulfed = false;
|
||||||
|
bool detectTrueGaped = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectStarPattern = false;
|
||||||
|
bool detectFlagPattern = false;
|
||||||
|
bool detectRisingPattern = false;
|
||||||
|
bool detectPiercingPattern = false;
|
||||||
|
bool detectSignalKeyBarPattern = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectSwingTrend = false;
|
||||||
|
bool detectSwingTrendBreakes = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectSupports = false;
|
||||||
|
bool detectResistance = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XFIMA Patetrns ...
|
||||||
|
bool detectFIMAPatterns = true;
|
||||||
|
//
|
||||||
|
bool detectFIMAPVPatterns = false;
|
||||||
|
bool detectFIMAMAPatterns = false;
|
||||||
|
bool detectFIMASARPatterns = false;
|
||||||
|
bool detectFIMAZigZagPatterns = false;
|
||||||
|
//
|
||||||
|
bool analyseFIMAPVPivots = true;
|
||||||
|
bool analyseFIMAMAPivots = true;
|
||||||
|
bool analyseFIMASARPivots = true;
|
||||||
|
bool analyseFIMAZigZagPivots = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Required Pivots ...
|
||||||
|
int numberOfRequiredPivots = 15;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Momentum Bar ...
|
||||||
|
if (detectMomentum)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isMomentum = fima2Signaller.poiDetector.IsMomentumBar(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishMomentum = isMomentum &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishMomentum = isMomentum &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isMomentum)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " Momentum Bar: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Engulfed Bar ...
|
||||||
|
if (detectEngulfed)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isEngulfed = fima2Signaller.poiDetector.IsEngulfedBar(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishEngulfed = isEngulfed &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishEngulfed = isEngulfed &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isEngulfed)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " Engulfed Bar: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking TruGaped Bar ...
|
||||||
|
if (detectTrueGaped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isTrueGaped = fima2Signaller.poiDetector.IsTrueGapedBar(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishTrueGaped = isTrueGaped &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishTrueGaped = isTrueGaped &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isTrueGaped)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " TrueGapped Bar: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Pinned Bar ...
|
||||||
|
if (detectPinned)
|
||||||
|
{
|
||||||
|
bool isPinned = fima2Signaller.poiDetector.IsPinnedBar(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishPinned = isPinned &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishPinned = isPinned &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isPinned)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " Pinned Bar: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Star Pattern ...
|
||||||
|
if (detectStarPattern)
|
||||||
|
{
|
||||||
|
bool isStarPattern = fima2Signaller.poiDetector.IsStartPattern(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishStarPattern = isStarPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishStarPattern = isStarPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isStarPattern)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " Star Pattern: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Piercing Pattern ...
|
||||||
|
if (detectPiercingPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isPiercingPattern = fima2Signaller.poiDetector.IsPiercingPattern(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishPiercingPattern = isPiercingPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishPiercingPattern = isPiercingPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isPiercingPattern)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " Piercing Pattern: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Rising Pattern ...
|
||||||
|
if (detectRisingPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isRisingPattern = fima2Signaller.poiDetector.IsRisingPattern(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishRisingPattern = isRisingPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishRisingPattern = isRisingPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isRisingPattern)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " Rising Pattern: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Flag Pattern ...
|
||||||
|
if (detectFlagPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL swingBar;
|
||||||
|
bool isFlagPattern = fima2Signaller.poiDetector.IsFlagPattern(
|
||||||
|
cBar,
|
||||||
|
iDir,
|
||||||
|
swingBar //
|
||||||
|
);
|
||||||
|
bool isBullishFlagPattern = isFlagPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishFlagPattern = isFlagPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isFlagPattern)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " Flag Pattern: ", cBar.time, ", Swing: ", swingBar.time);
|
||||||
|
}
|
||||||
|
swingBar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect SignalKey Bar Pattern ...
|
||||||
|
if (detectSignalKeyBarPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isSignalKeyBar = fima2Signaller.poiDetector.IsSignalKeyBarPattern(
|
||||||
|
cBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishSignalKeyBar = isSignalKeyBar &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishSignalKeyBar = isSignalKeyBar &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isSignalKeyBar)
|
||||||
|
{
|
||||||
|
Print(ToXString(iDir), " SignalKey Bar Pattern: ", cBar.time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Swing Trend ...
|
||||||
|
if (detectSwingTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL swings[];
|
||||||
|
bool hasSwingTrend = fima2Signaller.poiDetector.HasSwingTrend(
|
||||||
|
cBar,
|
||||||
|
iDir,
|
||||||
|
swings //
|
||||||
|
);
|
||||||
|
bool hasBullishSwingTrend = hasSwingTrend &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool hasBearishSwingTrend = hasSwingTrend &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (hasSwingTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Print(ToXString(iDir), " Swing Trend: ", cBar.time);
|
||||||
|
|
||||||
|
//
|
||||||
|
CChartObjectTrend *iObj;
|
||||||
|
has = fima2Signaller.poiDrawer.DrawSwingTrend(
|
||||||
|
swings,
|
||||||
|
iDir,
|
||||||
|
iObj,
|
||||||
|
true // Ray Right ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
eaDraws.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SpecifiedClean(swings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Trend Breakes ...
|
||||||
|
if (detectSwingTrendBreakes)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL swings[];
|
||||||
|
bool hasSwingTrend = fima2Signaller.poiDetector.HasSwingTrend(
|
||||||
|
cBar,
|
||||||
|
iDir,
|
||||||
|
swings //
|
||||||
|
);
|
||||||
|
bool hasBullishSwingTrend = hasSwingTrend &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool hasBearishSwingTrend = hasSwingTrend &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (hasSwingTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!HasDirection(trendDir))
|
||||||
|
{
|
||||||
|
trendDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Breaked Detection ...
|
||||||
|
if (trendDir != iDir)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Print("Trend Dir Breaked to: ", ToXString(iDir));
|
||||||
|
trendDir = iDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
SpecifiedClean(swings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Supports ...
|
||||||
|
if (detectSupports)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL support;
|
||||||
|
bool hasSupport = fima2Signaller.poiDetector.HasSupport(
|
||||||
|
cBar,
|
||||||
|
support //
|
||||||
|
);
|
||||||
|
if (hasSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone supportBox;
|
||||||
|
has = ToSupportBox(support, supportBox);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw Box ...
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = fima2Signaller.poiDrawer.DrawBox(
|
||||||
|
supportBox,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
eaDraws.Add(iObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(iObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
supportBox.Clean();
|
||||||
|
}
|
||||||
|
support.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Resistance ...
|
||||||
|
if (detectResistance)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL resistance;
|
||||||
|
bool hasResistance = fima2Signaller.poiDetector.HasResistance(
|
||||||
|
cBar,
|
||||||
|
resistance //
|
||||||
|
);
|
||||||
|
if (hasResistance)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone resistanceBox;
|
||||||
|
has = ToResistanceBox(resistance, resistanceBox);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw Box ...
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = fima2Signaller.poiDrawer.DrawBox(
|
||||||
|
resistanceBox,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
eaDraws.Add(iObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(iObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
resistanceBox.Clean();
|
||||||
|
}
|
||||||
|
resistance.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting FIMA Patterns ...
|
||||||
|
if (detectFIMAPatterns)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check For PV Pivots ...
|
||||||
|
if (detectFIMAPVPatterns)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivot pivots[];
|
||||||
|
int pivotsCount = fima2Signaller.poiDetector.ExtractPVPivots(
|
||||||
|
pivots, // Result ...
|
||||||
|
cBar.Index(), // Bar Index ...
|
||||||
|
numberOfRequiredPivots, // Required Number of Pivots ...
|
||||||
|
1500, // Max Allowed Loopback ...
|
||||||
|
10 // Validation Length ...
|
||||||
|
);
|
||||||
|
has = IsValidSize(pivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
CArrayObj *drawnPivots = new CArrayObj();
|
||||||
|
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
||||||
|
pivots,
|
||||||
|
drawnPivots //
|
||||||
|
);
|
||||||
|
has = IsValidSize(drawnPivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddObjects(
|
||||||
|
drawnPivots,
|
||||||
|
eaDraws //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("Pivots Extracted ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(drawnPivots);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for MA Patterns ...
|
||||||
|
if (detectFIMAMAPatterns)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivot pivots[];
|
||||||
|
int pivotsCount = fima2Signaller.poiDetector.ExtractMAPivots(
|
||||||
|
pivots, // Result ...
|
||||||
|
cBar.Index(), // Bar Index ...
|
||||||
|
numberOfRequiredPivots, // Required Number of Pivots ...
|
||||||
|
1500, // Max Allowed Loopback ...
|
||||||
|
0 // Validation Length ...
|
||||||
|
);
|
||||||
|
has = IsValidSize(pivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
CArrayObj *drawnPivots = new CArrayObj();
|
||||||
|
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
||||||
|
pivots,
|
||||||
|
drawnPivots //
|
||||||
|
);
|
||||||
|
has = IsValidSize(drawnPivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddObjects(
|
||||||
|
drawnPivots,
|
||||||
|
eaDraws //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("Pivots Extracted ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(drawnPivots);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for SAR Pivots ...
|
||||||
|
if (detectFIMASARPatterns)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivot pivots[];
|
||||||
|
int pivotsCount = fima2Signaller.poiDetector.ExtractSARPivots(
|
||||||
|
pivots, // Result ...
|
||||||
|
cBar.Index(), // Bar Index ...
|
||||||
|
numberOfRequiredPivots, // Required Number of Pivots ...
|
||||||
|
1500 // Max Allowed Loopback ...
|
||||||
|
);
|
||||||
|
has = IsValidSize(pivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
CArrayObj *drawnPivots = new CArrayObj();
|
||||||
|
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
||||||
|
pivots,
|
||||||
|
drawnPivots //
|
||||||
|
);
|
||||||
|
has = IsValidSize(drawnPivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddObjects(
|
||||||
|
drawnPivots,
|
||||||
|
eaDraws //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("Pivots Extracted ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(drawnPivots);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for ZigZag Pivots ...
|
||||||
|
if (detectFIMAZigZagPatterns)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivot pivots[];
|
||||||
|
int pivotsCount = fima2Signaller.poiDetector.ExtractZigZagPivots(
|
||||||
|
pivots,
|
||||||
|
cBar.Index(),
|
||||||
|
numberOfRequiredPivots,
|
||||||
|
1500 //
|
||||||
|
);
|
||||||
|
has = IsValidSize(pivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
CArrayObj *drawnPivots = new CArrayObj();
|
||||||
|
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
||||||
|
pivots,
|
||||||
|
drawnPivots //
|
||||||
|
);
|
||||||
|
has = IsValidSize(drawnPivotsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddObjects(
|
||||||
|
drawnPivots,
|
||||||
|
eaDraws //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("Pivots Extracted ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(drawnPivots);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analysers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on PV ...
|
||||||
|
if (analyseFIMAPVPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = fima2Signaller.poiDetector.AnalysePVPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
cBar.Index(), // Bar Index ...
|
||||||
|
numberOfRequiredPivots, // Required Number of Pivots ...
|
||||||
|
1500, // Max Allowed Loopback ...
|
||||||
|
10 // Validation Length ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw Analysis ...
|
||||||
|
DestroyObject(pvAnalysisObject);
|
||||||
|
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
||||||
|
analysis,
|
||||||
|
pvAnalysisObject,
|
||||||
|
true // Draw Pivots ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// eaDraws.Add(iObj);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("FIMA PV Pivots Analysed ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on MA ...
|
||||||
|
if (analyseFIMAMAPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = fima2Signaller.poiDetector.AnalyseMAPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
cBar.Index(), // Bar Index ...
|
||||||
|
numberOfRequiredPivots, // Required Number of Pivots ...
|
||||||
|
1500, // Max Allowed Loopback ...
|
||||||
|
0 // Validation Length ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw Analysis ...
|
||||||
|
DestroyObject(maAnalysisObject);
|
||||||
|
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
||||||
|
analysis,
|
||||||
|
maAnalysisObject,
|
||||||
|
true // Draw Pivots ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// eaDraws.Add(iObj);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("FIMA MA Pivots Analysed ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on SAR ...
|
||||||
|
if (analyseFIMASARPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = fima2Signaller.poiDetector.AnalyseSARPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
cBar.Index(), // Bar Index ...
|
||||||
|
numberOfRequiredPivots, // Required Number of Pivots ...
|
||||||
|
1500 // Max Allowed Loopback ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw Analysis ...
|
||||||
|
DestroyObject(sarAnalysisObject);
|
||||||
|
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
||||||
|
analysis,
|
||||||
|
sarAnalysisObject,
|
||||||
|
true // Draw Pivots ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// eaDraws.Add(iObj);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("FIMA Sar Pivots Analysed ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on ZigZag ...
|
||||||
|
if (analyseFIMAZigZagPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = fima2Signaller.poiDetector.AnalyseZigZagPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
cBar.Index(), // Bar Index ...
|
||||||
|
numberOfRequiredPivots, // Required Number of Pivots ...
|
||||||
|
1500 // Max Allowed Loopback ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw Analysis ...
|
||||||
|
DestroyObject(zigzagAnalysisObject);
|
||||||
|
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
||||||
|
analysis,
|
||||||
|
zigzagAnalysisObject,
|
||||||
|
true // Draw Pivots ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// eaDraws.Add(iObj);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("FIMA ZigZag Pivots Analysed ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
cBar.Clean();
|
||||||
|
}
|
||||||
@@ -147,14 +147,12 @@ XCXFIMAStrategy1Signaller *fima1Signaller; // XFIMA1 Signaller ...
|
|||||||
XCXFIMAStrategy2Signaller *fima2Signaller; // XFIMA2 Signaller ...
|
XCXFIMAStrategy2Signaller *fima2Signaller; // XFIMA2 Signaller ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Drawer and eaDraws ...
|
XFIMAMarketStructure marketStructure; // POI Analysis Result ...
|
||||||
CArrayObj eaDraws; // Drawn Objects ...
|
XFIMAPatternDetectorConfig detectorConfig; // POI Detector Config ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XCPivotAnalysisObject *pvAnalysisObject; // PV Analysis Object ...
|
// Drawer and eaDraws ...
|
||||||
XCPivotAnalysisObject *maAnalysisObject; // MA Analysis Object ...
|
CArrayObj eaDraws; // Drawn Objects ...
|
||||||
XCPivotAnalysisObject *sarAnalysisObject; // SAR Analysis Object ...
|
|
||||||
XCPivotAnalysisObject *zigzagAnalysisObject; // ZigZag Analysis Object ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
XBarTracker eaBarTracker; // EA Bar Traker ...
|
XBarTracker eaBarTracker; // EA Bar Traker ...
|
||||||
@@ -165,7 +163,6 @@ int eaCTHandler = INVALID_HANDLE; // Candle Timer Handler ...
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool eaIsNewBar; // Check New Bar ...
|
bool eaIsNewBar; // Check New Bar ...
|
||||||
ENUM_X_DIRECTION trendDir = X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define Indicators Here ...
|
// Define Indicators Here ...
|
||||||
@@ -385,6 +382,10 @@ int OnInit()
|
|||||||
return INIT_FAILED;
|
return INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Configure XFIMA POI Detector ...
|
||||||
|
detectorConfig.Default();
|
||||||
|
|
||||||
//
|
//
|
||||||
Print(ShortName, ": Initialized Successfully ...");
|
Print(ShortName, ": Initialized Successfully ...");
|
||||||
return INIT_SUCCEEDED;
|
return INIT_SUCCEEDED;
|
||||||
@@ -448,12 +449,26 @@ void OnTick()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
DetectPatterns();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// fima1Signaller.OnTick();
|
// fima1Signaller.OnTick();
|
||||||
fima2Signaller.OnTick();
|
fima2Signaller.OnTick();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initial Bar for Analysis ...
|
||||||
|
XOHCL cBar;
|
||||||
|
bool isInited = cBar.Init(
|
||||||
|
_Symbol,
|
||||||
|
_Period,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Market ...
|
||||||
|
fima2Signaller.poiDetector.AnalyseMarket(
|
||||||
|
cBar,
|
||||||
|
marketStructure,
|
||||||
|
detectorConfig //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -765,703 +780,4 @@ void OnTradeStateChanged(const XOnTradeHandlerState &state)
|
|||||||
eaExpert.HandleOnTradeStateChanged(state);
|
eaExpert.HandleOnTradeStateChanged(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Market Conditions for Pattern Detection ...
|
|
||||||
*/
|
|
||||||
void DetectPatterns()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!eaIsNewBar)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Initialize 1 Indexed Bar ...
|
|
||||||
XOHCL cBar;
|
|
||||||
bool has = cBar.Init(
|
|
||||||
_Symbol,
|
|
||||||
_Period,
|
|
||||||
1 //
|
|
||||||
);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Analysis ...
|
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Define Detection Flags ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool detectPinned = false;
|
|
||||||
bool detectMomentum = false;
|
|
||||||
bool detectEngulfed = false;
|
|
||||||
bool detectTrueGaped = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool detectStarPattern = false;
|
|
||||||
bool detectFlagPattern = false;
|
|
||||||
bool detectRisingPattern = false;
|
|
||||||
bool detectPiercingPattern = false;
|
|
||||||
bool detectSignalKeyBarPattern = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool detectSwingTrend = false;
|
|
||||||
bool detectSwingTrendBreakes = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool detectSupports = false;
|
|
||||||
bool detectResistance = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XFIMA Patetrns ...
|
|
||||||
bool detectFIMAPatterns = true;
|
|
||||||
//
|
|
||||||
bool detectFIMAPVPatterns = false;
|
|
||||||
bool detectFIMAMAPatterns = false;
|
|
||||||
bool detectFIMASARPatterns = false;
|
|
||||||
bool detectFIMAZigZagPatterns = false;
|
|
||||||
//
|
|
||||||
bool analyseFIMAPVPivots = true;
|
|
||||||
bool analyseFIMAMAPivots = true;
|
|
||||||
bool analyseFIMASARPivots = true;
|
|
||||||
bool analyseFIMAZigZagPivots = true;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Required Pivots ...
|
|
||||||
int numberOfRequiredPivots = 15;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Momentum Bar ...
|
|
||||||
if (detectMomentum)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isMomentum = fima2Signaller.poiDetector.IsMomentumBar(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishMomentum = isMomentum &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishMomentum = isMomentum &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isMomentum)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " Momentum Bar: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Engulfed Bar ...
|
|
||||||
if (detectEngulfed)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isEngulfed = fima2Signaller.poiDetector.IsEngulfedBar(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishEngulfed = isEngulfed &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishEngulfed = isEngulfed &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isEngulfed)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " Engulfed Bar: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking TruGaped Bar ...
|
|
||||||
if (detectTrueGaped)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isTrueGaped = fima2Signaller.poiDetector.IsTrueGapedBar(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishTrueGaped = isTrueGaped &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishTrueGaped = isTrueGaped &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isTrueGaped)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " TrueGapped Bar: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Pinned Bar ...
|
|
||||||
if (detectPinned)
|
|
||||||
{
|
|
||||||
bool isPinned = fima2Signaller.poiDetector.IsPinnedBar(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishPinned = isPinned &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishPinned = isPinned &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isPinned)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " Pinned Bar: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Star Pattern ...
|
|
||||||
if (detectStarPattern)
|
|
||||||
{
|
|
||||||
bool isStarPattern = fima2Signaller.poiDetector.IsStartPattern(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishStarPattern = isStarPattern &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishStarPattern = isStarPattern &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isStarPattern)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " Star Pattern: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Piercing Pattern ...
|
|
||||||
if (detectPiercingPattern)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isPiercingPattern = fima2Signaller.poiDetector.IsPiercingPattern(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishPiercingPattern = isPiercingPattern &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishPiercingPattern = isPiercingPattern &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isPiercingPattern)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " Piercing Pattern: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Rising Pattern ...
|
|
||||||
if (detectRisingPattern)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isRisingPattern = fima2Signaller.poiDetector.IsRisingPattern(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishRisingPattern = isRisingPattern &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishRisingPattern = isRisingPattern &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isRisingPattern)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " Rising Pattern: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Flag Pattern ...
|
|
||||||
if (detectFlagPattern)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL swingBar;
|
|
||||||
bool isFlagPattern = fima2Signaller.poiDetector.IsFlagPattern(
|
|
||||||
cBar,
|
|
||||||
iDir,
|
|
||||||
swingBar //
|
|
||||||
);
|
|
||||||
bool isBullishFlagPattern = isFlagPattern &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishFlagPattern = isFlagPattern &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isFlagPattern)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " Flag Pattern: ", cBar.time, ", Swing: ", swingBar.time);
|
|
||||||
}
|
|
||||||
swingBar.Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect SignalKey Bar Pattern ...
|
|
||||||
if (detectSignalKeyBarPattern)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isSignalKeyBar = fima2Signaller.poiDetector.IsSignalKeyBarPattern(
|
|
||||||
cBar,
|
|
||||||
iDir //
|
|
||||||
);
|
|
||||||
bool isBullishSignalKeyBar = isSignalKeyBar &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool isBearishSignalKeyBar = isSignalKeyBar &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (isSignalKeyBar)
|
|
||||||
{
|
|
||||||
Print(ToXString(iDir), " SignalKey Bar Pattern: ", cBar.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Swing Trend ...
|
|
||||||
if (detectSwingTrend)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL swings[];
|
|
||||||
bool hasSwingTrend = fima2Signaller.poiDetector.HasSwingTrend(
|
|
||||||
cBar,
|
|
||||||
iDir,
|
|
||||||
swings //
|
|
||||||
);
|
|
||||||
bool hasBullishSwingTrend = hasSwingTrend &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool hasBearishSwingTrend = hasSwingTrend &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (hasSwingTrend)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Print(ToXString(iDir), " Swing Trend: ", cBar.time);
|
|
||||||
|
|
||||||
//
|
|
||||||
CChartObjectTrend *iObj;
|
|
||||||
has = fima2Signaller.poiDrawer.DrawSwingTrend(
|
|
||||||
swings,
|
|
||||||
iDir,
|
|
||||||
iObj,
|
|
||||||
true // Ray Right ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
eaDraws.Add(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SpecifiedClean(swings);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Swing Trend Breakes ...
|
|
||||||
if (detectSwingTrendBreakes)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL swings[];
|
|
||||||
bool hasSwingTrend = fima2Signaller.poiDetector.HasSwingTrend(
|
|
||||||
cBar,
|
|
||||||
iDir,
|
|
||||||
swings //
|
|
||||||
);
|
|
||||||
bool hasBullishSwingTrend = hasSwingTrend &&
|
|
||||||
IsSpecifiedBullish(iDir);
|
|
||||||
bool hasBearishSwingTrend = hasSwingTrend &&
|
|
||||||
IsSpecifiedBearish(iDir);
|
|
||||||
if (hasSwingTrend)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!HasDirection(trendDir))
|
|
||||||
{
|
|
||||||
trendDir = iDir;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Breaked Detection ...
|
|
||||||
if (trendDir != iDir)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Print("Trend Dir Breaked to: ", ToXString(iDir));
|
|
||||||
trendDir = iDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
SpecifiedClean(swings);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Supports ...
|
|
||||||
if (detectSupports)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL support;
|
|
||||||
bool hasSupport = fima2Signaller.poiDetector.HasSupport(
|
|
||||||
cBar,
|
|
||||||
support //
|
|
||||||
);
|
|
||||||
if (hasSupport)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XBoxZone supportBox;
|
|
||||||
has = ToSupportBox(support, supportBox);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw Box ...
|
|
||||||
XCBoxObject *iObj;
|
|
||||||
has = fima2Signaller.poiDrawer.DrawBox(
|
|
||||||
supportBox,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
eaDraws.Add(iObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(iObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
supportBox.Clean();
|
|
||||||
}
|
|
||||||
support.Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Resistance ...
|
|
||||||
if (detectResistance)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL resistance;
|
|
||||||
bool hasResistance = fima2Signaller.poiDetector.HasResistance(
|
|
||||||
cBar,
|
|
||||||
resistance //
|
|
||||||
);
|
|
||||||
if (hasResistance)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XBoxZone resistanceBox;
|
|
||||||
has = ToResistanceBox(resistance, resistanceBox);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw Box ...
|
|
||||||
XCBoxObject *iObj;
|
|
||||||
has = fima2Signaller.poiDrawer.DrawBox(
|
|
||||||
resistanceBox,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
eaDraws.Add(iObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(iObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
resistanceBox.Clean();
|
|
||||||
}
|
|
||||||
resistance.Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detecting FIMA Patterns ...
|
|
||||||
if (detectFIMAPatterns)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Check For PV Pivots ...
|
|
||||||
if (detectFIMAPVPatterns)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivot pivots[];
|
|
||||||
int pivotsCount = fima2Signaller.poiDetector.ExtractPVPivots(
|
|
||||||
pivots, // Result ...
|
|
||||||
cBar.Index(), // Bar Index ...
|
|
||||||
numberOfRequiredPivots, // Required Number of Pivots ...
|
|
||||||
1500, // Max Allowed Loopback ...
|
|
||||||
10 // Validation Length ...
|
|
||||||
);
|
|
||||||
has = IsValidSize(pivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
CArrayObj *drawnPivots = new CArrayObj();
|
|
||||||
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
|
||||||
pivots,
|
|
||||||
drawnPivots //
|
|
||||||
);
|
|
||||||
has = IsValidSize(drawnPivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddObjects(
|
|
||||||
drawnPivots,
|
|
||||||
eaDraws //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("Pivots Extracted ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(drawnPivots);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check for MA Patterns ...
|
|
||||||
if (detectFIMAMAPatterns)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivot pivots[];
|
|
||||||
int pivotsCount = fima2Signaller.poiDetector.ExtractMAPivots(
|
|
||||||
pivots, // Result ...
|
|
||||||
cBar.Index(), // Bar Index ...
|
|
||||||
numberOfRequiredPivots, // Required Number of Pivots ...
|
|
||||||
1500, // Max Allowed Loopback ...
|
|
||||||
0 // Validation Length ...
|
|
||||||
);
|
|
||||||
has = IsValidSize(pivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
CArrayObj *drawnPivots = new CArrayObj();
|
|
||||||
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
|
||||||
pivots,
|
|
||||||
drawnPivots //
|
|
||||||
);
|
|
||||||
has = IsValidSize(drawnPivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddObjects(
|
|
||||||
drawnPivots,
|
|
||||||
eaDraws //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("Pivots Extracted ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(drawnPivots);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check for SAR Pivots ...
|
|
||||||
if (detectFIMASARPatterns)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivot pivots[];
|
|
||||||
int pivotsCount = fima2Signaller.poiDetector.ExtractSARPivots(
|
|
||||||
pivots, // Result ...
|
|
||||||
cBar.Index(), // Bar Index ...
|
|
||||||
numberOfRequiredPivots, // Required Number of Pivots ...
|
|
||||||
1500 // Max Allowed Loopback ...
|
|
||||||
);
|
|
||||||
has = IsValidSize(pivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
CArrayObj *drawnPivots = new CArrayObj();
|
|
||||||
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
|
||||||
pivots,
|
|
||||||
drawnPivots //
|
|
||||||
);
|
|
||||||
has = IsValidSize(drawnPivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddObjects(
|
|
||||||
drawnPivots,
|
|
||||||
eaDraws //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("Pivots Extracted ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(drawnPivots);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check for ZigZag Pivots ...
|
|
||||||
if (detectFIMAZigZagPatterns)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivot pivots[];
|
|
||||||
int pivotsCount = fima2Signaller.poiDetector.ExtractZigZagPivots(
|
|
||||||
pivots,
|
|
||||||
cBar.Index(),
|
|
||||||
numberOfRequiredPivots,
|
|
||||||
1500 //
|
|
||||||
);
|
|
||||||
has = IsValidSize(pivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
CArrayObj *drawnPivots = new CArrayObj();
|
|
||||||
int drawnPivotsCount = fima2Signaller.poiDrawer.DrawPivots(
|
|
||||||
pivots,
|
|
||||||
drawnPivots //
|
|
||||||
);
|
|
||||||
has = IsValidSize(drawnPivotsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddObjects(
|
|
||||||
drawnPivots,
|
|
||||||
eaDraws //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("Pivots Extracted ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(drawnPivots);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analysers ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analyse Based on PV ...
|
|
||||||
if (analyseFIMAPVPivots)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivotAnalysis analysis;
|
|
||||||
has = fima2Signaller.poiDetector.AnalysePVPivots(
|
|
||||||
analysis, // Result ...
|
|
||||||
cBar.Index(), // Bar Index ...
|
|
||||||
numberOfRequiredPivots, // Required Number of Pivots ...
|
|
||||||
1500, // Max Allowed Loopback ...
|
|
||||||
10 // Validation Length ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw Analysis ...
|
|
||||||
DestroyObject(pvAnalysisObject);
|
|
||||||
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
|
||||||
analysis,
|
|
||||||
pvAnalysisObject,
|
|
||||||
true // Draw Pivots ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// eaDraws.Add(iObj);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("FIMA PV Pivots Analysed ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analyse Based on MA ...
|
|
||||||
if (analyseFIMAMAPivots)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivotAnalysis analysis;
|
|
||||||
has = fima2Signaller.poiDetector.AnalyseMAPivots(
|
|
||||||
analysis, // Result ...
|
|
||||||
cBar.Index(), // Bar Index ...
|
|
||||||
numberOfRequiredPivots, // Required Number of Pivots ...
|
|
||||||
1500, // Max Allowed Loopback ...
|
|
||||||
0 // Validation Length ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw Analysis ...
|
|
||||||
DestroyObject(maAnalysisObject);
|
|
||||||
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
|
||||||
analysis,
|
|
||||||
maAnalysisObject,
|
|
||||||
true // Draw Pivots ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// eaDraws.Add(iObj);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("FIMA MA Pivots Analysed ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analyse Based on SAR ...
|
|
||||||
if (analyseFIMASARPivots)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivotAnalysis analysis;
|
|
||||||
has = fima2Signaller.poiDetector.AnalyseSARPivots(
|
|
||||||
analysis, // Result ...
|
|
||||||
cBar.Index(), // Bar Index ...
|
|
||||||
numberOfRequiredPivots, // Required Number of Pivots ...
|
|
||||||
1500 // Max Allowed Loopback ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw Analysis ...
|
|
||||||
DestroyObject(sarAnalysisObject);
|
|
||||||
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
|
||||||
analysis,
|
|
||||||
sarAnalysisObject,
|
|
||||||
true // Draw Pivots ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// eaDraws.Add(iObj);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("FIMA Sar Pivots Analysed ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analyse Based on ZigZag ...
|
|
||||||
if (analyseFIMAZigZagPivots)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPivotAnalysis analysis;
|
|
||||||
has = fima2Signaller.poiDetector.AnalyseZigZagPivots(
|
|
||||||
analysis, // Result ...
|
|
||||||
cBar.Index(), // Bar Index ...
|
|
||||||
numberOfRequiredPivots, // Required Number of Pivots ...
|
|
||||||
1500 // Max Allowed Loopback ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw Analysis ...
|
|
||||||
DestroyObject(zigzagAnalysisObject);
|
|
||||||
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
|
|
||||||
analysis,
|
|
||||||
zigzagAnalysisObject,
|
|
||||||
true // Draw Pivots ...
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// eaDraws.Add(iObj);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Print("FIMA ZigZag Pivots Analysed ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
cBar.Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -480,6 +480,437 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
|
|||||||
ZeroMemory(barAnalyser);
|
ZeroMemory(barAnalyser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Testers ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Analyse Market based on Specified Bar ...
|
||||||
|
*
|
||||||
|
* @param forBar: XOHCL, reference Specified Bar for Analyse Market ...
|
||||||
|
* @param structure: XFIMAMarketStructure, reference to holds result ...
|
||||||
|
* @param config: XFIMAPatternDetectorConfig, reference to Configure Detector ...
|
||||||
|
*/
|
||||||
|
void AnalyseMarket(
|
||||||
|
XOHCL &forBar,
|
||||||
|
XFIMAMarketStructure &structure,
|
||||||
|
XFIMAPatternDetectorConfig &config //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Prepare ...
|
||||||
|
structure.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
if (!forBar.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Analysis ...
|
||||||
|
|
||||||
|
//
|
||||||
|
structure.bar = forBar;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool has = false;
|
||||||
|
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting POI Based on Config ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Block ...
|
||||||
|
if (config.detectOB)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isOB = HasOB(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
structure.ob,
|
||||||
|
config.obLoopback //
|
||||||
|
);
|
||||||
|
bool isBullishOB = isOB &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishOB = isOB &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (!isOB)
|
||||||
|
{
|
||||||
|
structure.ob.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gap ...
|
||||||
|
if (config.detectFVG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isFVG = HasFVG(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
structure.fvg,
|
||||||
|
config.fvgLoopback //
|
||||||
|
);
|
||||||
|
bool isBullishOB = isFVG &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishOB = isFVG &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (!isFVG)
|
||||||
|
{
|
||||||
|
structure.fvg.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Momentum Bar ...
|
||||||
|
if (config.detectMomentum)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isMomentum = IsMomentumBar(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
config.momentumBarRangeLength,
|
||||||
|
config.momentumBarApprovedMultiplier //
|
||||||
|
);
|
||||||
|
bool isBullishMomentum = isMomentum &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishMomentum = isMomentum &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isMomentum)
|
||||||
|
{
|
||||||
|
structure.momentumDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Engulfed Bar ...
|
||||||
|
if (config.detectEngulfed)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isEngulfed = IsEngulfedBar(
|
||||||
|
forBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishEngulfed = isEngulfed &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishEngulfed = isEngulfed &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isEngulfed)
|
||||||
|
{
|
||||||
|
structure.engulfedDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking TruGaped Bar ...
|
||||||
|
if (config.detectTrueGaped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isTrueGaped = IsTrueGapedBar(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
config.truwGapApprovedPointMultiplier //
|
||||||
|
);
|
||||||
|
bool isBullishTrueGaped = isTrueGaped &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishTrueGaped = isTrueGaped &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isTrueGaped)
|
||||||
|
{
|
||||||
|
structure.trueGapedDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Pinned Bar ...
|
||||||
|
if (config.detectPinned)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isPinned = IsPinnedBar(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
config.pinnedBaarShadowApprovedMultiplier,
|
||||||
|
config.pinnedBarMinimumPinBarRangeMultiplier,
|
||||||
|
config.pinnedBarForceDirection //
|
||||||
|
);
|
||||||
|
bool isBullishPinned = isPinned &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishPinned = isPinned &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isPinned)
|
||||||
|
{
|
||||||
|
structure.pinnedDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Star Pattern ...
|
||||||
|
if (config.detectStarPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isStarPattern = IsStartPattern(
|
||||||
|
forBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishStarPattern = isStarPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishStarPattern = isStarPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isStarPattern)
|
||||||
|
{
|
||||||
|
structure.starPatternDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Piercing Pattern ...
|
||||||
|
if (config.detectPiercingPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isPiercingPattern = IsPiercingPattern(
|
||||||
|
forBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishPiercingPattern = isPiercingPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishPiercingPattern = isPiercingPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isPiercingPattern)
|
||||||
|
{
|
||||||
|
structure.piercingPatternDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Rising Pattern ...
|
||||||
|
if (config.detectRisingPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isRisingPattern = IsRisingPattern(
|
||||||
|
forBar,
|
||||||
|
iDir //
|
||||||
|
);
|
||||||
|
bool isBullishRisingPattern = isRisingPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishRisingPattern = isRisingPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isRisingPattern)
|
||||||
|
{
|
||||||
|
structure.risingPatternDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Flag Pattern ...
|
||||||
|
if (config.detectFlagPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL swingBar;
|
||||||
|
bool isFlagPattern = IsFlagPattern(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
swingBar,
|
||||||
|
config.flagPatternMinimumPullbackBars //
|
||||||
|
);
|
||||||
|
bool isBullishFlagPattern = isFlagPattern &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishFlagPattern = isFlagPattern &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isFlagPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
structure.flagSwing = swingBar;
|
||||||
|
structure.flagPatternDir = iDir;
|
||||||
|
}
|
||||||
|
swingBar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect SignalKey Bar Pattern ...
|
||||||
|
if (config.detectSignalKeyBarPattern)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isSignalKeyBar = IsSignalKeyBarPattern(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
config.signalKeyBarShadowApprovedMultiplier,
|
||||||
|
config.signalKeyBarMinimumPinBarRangeMultiplier,
|
||||||
|
config.signalKeyBarForceDirection //
|
||||||
|
);
|
||||||
|
bool isBullishSignalKeyBar = isSignalKeyBar &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool isBearishSignalKeyBar = isSignalKeyBar &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (isSignalKeyBar)
|
||||||
|
{
|
||||||
|
structure.signalKeyBarPatternDir = iDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Swing Trend ...
|
||||||
|
if (config.detectSwingTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL swings[];
|
||||||
|
bool hasSwingTrend = HasSwingTrend(
|
||||||
|
forBar,
|
||||||
|
iDir,
|
||||||
|
swings,
|
||||||
|
config.trendingNumberOfSwings,
|
||||||
|
config.trendingSwingShoulders //
|
||||||
|
);
|
||||||
|
bool hasBullishSwingTrend = hasSwingTrend &&
|
||||||
|
IsSpecifiedBullish(iDir);
|
||||||
|
bool hasBearishSwingTrend = hasSwingTrend &&
|
||||||
|
IsSpecifiedBearish(iDir);
|
||||||
|
if (hasSwingTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
swings,
|
||||||
|
structure.trendSwings //
|
||||||
|
);
|
||||||
|
structure.trendDir = iDir;
|
||||||
|
}
|
||||||
|
SpecifiedClean(swings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Supports ...
|
||||||
|
if (config.detectSupports)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL support;
|
||||||
|
bool hasSupport = HasSupport(
|
||||||
|
forBar,
|
||||||
|
support,
|
||||||
|
config.supportAndResistanceValidationLength,
|
||||||
|
config.supportAndResistanceMaxAllowedLoopback //
|
||||||
|
);
|
||||||
|
if (hasSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone supportBox;
|
||||||
|
has = ToSupportBox(support, supportBox);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
structure.support = supportBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
supportBox.Clean();
|
||||||
|
}
|
||||||
|
support.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Resistance ...
|
||||||
|
if (config.detectResistance)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL resistance;
|
||||||
|
bool hasResistance = HasResistance(
|
||||||
|
forBar,
|
||||||
|
resistance,
|
||||||
|
config.supportAndResistanceValidationLength,
|
||||||
|
config.supportAndResistanceMaxAllowedLoopback //
|
||||||
|
);
|
||||||
|
if (hasResistance)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone resistanceBox;
|
||||||
|
has = ToResistanceBox(resistance, resistanceBox);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
structure.resistance = resistanceBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
resistanceBox.Clean();
|
||||||
|
}
|
||||||
|
resistance.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analysers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on PV ...
|
||||||
|
if (config.analyseFIMAPVPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = AnalysePVPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
forBar.Index(), // Bar Index ...
|
||||||
|
config.numberOfRequiredPivotsForAnalysis, // Required Number of Pivots ...
|
||||||
|
config.maxAllowedLoopbackLengthForAnalysis, // Max Allowed Loopback ...
|
||||||
|
config.pvPivotsValidationLength // Validation Length ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
structure.pvAnalysis = analysis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on MA ...
|
||||||
|
if (config.analyseFIMAMAPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = AnalyseMAPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
forBar.Index(), // Bar Index ...
|
||||||
|
config.numberOfRequiredPivotsForAnalysis, // Required Number of Pivots ...
|
||||||
|
config.maxAllowedLoopbackLengthForAnalysis, // Max Allowed Loopback ...
|
||||||
|
config.pvPivotsValidationLength // Validation Length ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
structure.maAnalysis = analysis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on SAR ...
|
||||||
|
if (config.analyseFIMASARPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = AnalyseSARPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
forBar.Index(), // Bar Index ...
|
||||||
|
config.numberOfRequiredPivotsForAnalysis, // Required Number of Pivots ...
|
||||||
|
config.maxAllowedLoopbackLengthForAnalysis // Max Allowed Loopback ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
structure.sarAnalysis = analysis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Based on ZigZag ...
|
||||||
|
if (config.analyseFIMAZigZagPivots)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPivotAnalysis analysis;
|
||||||
|
has = AnalyseZigZagPivots(
|
||||||
|
analysis, // Result ...
|
||||||
|
forBar.Index(), // Bar Index ...
|
||||||
|
config.numberOfRequiredPivotsForAnalysis, // Required Number of Pivots ...
|
||||||
|
config.maxAllowedLoopbackLengthForAnalysis // Max Allowed Loopback ...
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
structure.zigzagAnalysis = analysis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protected ...
|
// Protected ...
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -33,6 +33,112 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
|
|||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
|
|
||||||
|
void DrawMarketStructure(
|
||||||
|
XFIMAMarketStructure &structure,
|
||||||
|
XFIMAMarketStructureDrawerConfig &config,
|
||||||
|
CArrayObj *&objects //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Prepare ...
|
||||||
|
objects.Clear();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Apply Drawing Methods ...
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawOB)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawFVG)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawSupports)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawResistance)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawSwingTrend)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawStarPattern)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawFlagPattern)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawRisingPattern)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawPiercingPattern)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawSignalKeyBarPattern)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawPinned)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawMomentum)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawEngulfed)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawTrueGaped)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawFIMAPVPivotsAnalysis)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawFIMAMAPivotsAnalysis)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawFIMASARPivotsAnalysis)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (config.drawFIMAZigZagPivotsAnalysis)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,460 @@
|
|||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../../Classes/x-saherelm.x-cobject.class.mq5"
|
#include "../../Classes/x-saherelm.x-cobject.class.mq5"
|
||||||
#include "../../Helpers/x-saherelm.xfima.helper.mq5"
|
#include "../../Helpers/x-saherelm.xfima.helper.mq5"
|
||||||
|
#include "../../Libraries/x-saherelm.x-pivot.analysis.lib.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions ...
|
// Definitions ...
|
||||||
|
|
||||||
//
|
/**
|
||||||
// Structs ...
|
* Configure Market Structure Detection ...
|
||||||
|
**/
|
||||||
|
struct XFIMAPatternDetectorConfig
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectSupports;
|
||||||
|
bool detectResistance;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectSwingTrend;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectOB;
|
||||||
|
bool detectFVG;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectStarPattern;
|
||||||
|
bool detectFlagPattern;
|
||||||
|
bool detectRisingPattern;
|
||||||
|
bool detectPiercingPattern;
|
||||||
|
bool detectSignalKeyBarPattern;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool detectPinned;
|
||||||
|
bool detectMomentum;
|
||||||
|
bool detectEngulfed;
|
||||||
|
bool detectTrueGaped;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool analyseFIMAPVPivots;
|
||||||
|
bool analyseFIMAMAPivots;
|
||||||
|
bool analyseFIMASARPivots;
|
||||||
|
bool analyseFIMAZigZagPivots;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Configs ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// OB / FVG ...
|
||||||
|
int obLoopback;
|
||||||
|
int fvgLoopback;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trending ...
|
||||||
|
int trendingNumberOfSwings;
|
||||||
|
int trendingSwingShoulders;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support and Resistance ...
|
||||||
|
int supportAndResistanceValidationLength;
|
||||||
|
int supportAndResistanceMaxAllowedLoopback;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TrueGap ...
|
||||||
|
double truwGapApprovedPointMultiplier;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flag Pattern ...
|
||||||
|
int flagPatternMinimumPullbackBars;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Momentum Bar ...
|
||||||
|
int momentumBarRangeLength;
|
||||||
|
double momentumBarApprovedMultiplier;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Pinned Bar ...
|
||||||
|
double pinnedBaarShadowApprovedMultiplier;
|
||||||
|
double pinnedBarMinimumPinBarRangeMultiplier;
|
||||||
|
bool pinnedBarForceDirection;
|
||||||
|
|
||||||
|
//
|
||||||
|
// SignalKey Bar ...
|
||||||
|
double signalKeyBarShadowApprovedMultiplier;
|
||||||
|
double signalKeyBarMinimumPinBarRangeMultiplier;
|
||||||
|
bool signalKeyBarForceDirection;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyser ...
|
||||||
|
int pvPivotsValidationLength;
|
||||||
|
int maPivotsValidationLength;
|
||||||
|
int numberOfRequiredPivotsForAnalysis;
|
||||||
|
int maxAllowedLoopbackLengthForAnalysis;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XFIMAPatternDetectorConfig()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup Model ...
|
||||||
|
*/
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
detectOB = false;
|
||||||
|
detectFVG = false;
|
||||||
|
detectSupports = false;
|
||||||
|
detectResistance = false;
|
||||||
|
detectSwingTrend = false;
|
||||||
|
detectStarPattern = false;
|
||||||
|
detectFlagPattern = false;
|
||||||
|
detectRisingPattern = false;
|
||||||
|
detectPiercingPattern = false;
|
||||||
|
detectSignalKeyBarPattern = false;
|
||||||
|
detectPinned = false;
|
||||||
|
detectMomentum = false;
|
||||||
|
detectEngulfed = false;
|
||||||
|
detectTrueGaped = false;
|
||||||
|
analyseFIMAPVPivots = false;
|
||||||
|
analyseFIMAMAPivots = false;
|
||||||
|
analyseFIMASARPivots = false;
|
||||||
|
analyseFIMAZigZagPivots = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
obLoopback = 0;
|
||||||
|
fvgLoopback = 0;
|
||||||
|
trendingNumberOfSwings = 0;
|
||||||
|
trendingSwingShoulders = 0;
|
||||||
|
supportAndResistanceValidationLength = 0;
|
||||||
|
supportAndResistanceMaxAllowedLoopback = 0;
|
||||||
|
truwGapApprovedPointMultiplier = 0;
|
||||||
|
flagPatternMinimumPullbackBars = 0;
|
||||||
|
momentumBarRangeLength = 0;
|
||||||
|
momentumBarApprovedMultiplier = 0;
|
||||||
|
pinnedBaarShadowApprovedMultiplier = 0;
|
||||||
|
pinnedBarMinimumPinBarRangeMultiplier = 0;
|
||||||
|
pinnedBarForceDirection = false;
|
||||||
|
signalKeyBarShadowApprovedMultiplier = 0;
|
||||||
|
signalKeyBarMinimumPinBarRangeMultiplier = 0;
|
||||||
|
signalKeyBarForceDirection = false;
|
||||||
|
pvPivotsValidationLength = 0;
|
||||||
|
maPivotsValidationLength = 0;
|
||||||
|
numberOfRequiredPivotsForAnalysis = 0;
|
||||||
|
maxAllowedLoopbackLengthForAnalysis = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Model ...
|
||||||
|
*/
|
||||||
|
void Default()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// OB / FVG ...
|
||||||
|
detectOB = true;
|
||||||
|
detectFVG = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support and Resistances ...
|
||||||
|
detectSupports = true;
|
||||||
|
detectResistance = true;
|
||||||
|
detectSwingTrend = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Patterns ...
|
||||||
|
detectStarPattern = false;
|
||||||
|
detectFlagPattern = false;
|
||||||
|
detectRisingPattern = false;
|
||||||
|
detectPiercingPattern = false;
|
||||||
|
detectSignalKeyBarPattern = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bars ...
|
||||||
|
detectPinned = false;
|
||||||
|
detectMomentum = false;
|
||||||
|
detectEngulfed = false;
|
||||||
|
detectTrueGaped = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analysers ...
|
||||||
|
analyseFIMAPVPivots = false;
|
||||||
|
analyseFIMAMAPivots = false;
|
||||||
|
analyseFIMASARPivots = false;
|
||||||
|
analyseFIMAZigZagPivots = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// OB / FVg ...
|
||||||
|
obLoopback = 5;
|
||||||
|
fvgLoopback = 5;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trending ...
|
||||||
|
trendingNumberOfSwings = 3;
|
||||||
|
trendingSwingShoulders = 7;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support and Resistance ...
|
||||||
|
supportAndResistanceValidationLength = 21;
|
||||||
|
supportAndResistanceMaxAllowedLoopback = 1500;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TrueGap ...
|
||||||
|
truwGapApprovedPointMultiplier = 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flag Pattern ...
|
||||||
|
flagPatternMinimumPullbackBars = 3;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Momentum Bar ...
|
||||||
|
momentumBarRangeLength = 3;
|
||||||
|
momentumBarApprovedMultiplier = 2;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Pinned Bar ...
|
||||||
|
pinnedBaarShadowApprovedMultiplier = 3;
|
||||||
|
pinnedBarMinimumPinBarRangeMultiplier = 4;
|
||||||
|
pinnedBarForceDirection = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// SignalKey Bar ...
|
||||||
|
signalKeyBarShadowApprovedMultiplier = 3;
|
||||||
|
signalKeyBarMinimumPinBarRangeMultiplier = 4;
|
||||||
|
signalKeyBarForceDirection = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Length ...
|
||||||
|
pvPivotsValidationLength = 10;
|
||||||
|
maPivotsValidationLength = 0;
|
||||||
|
numberOfRequiredPivotsForAnalysis = 50;
|
||||||
|
maxAllowedLoopbackLengthForAnalysis = 1500;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XFIMA Base Market Structure ...
|
||||||
|
* AnalyseMarket result ...
|
||||||
|
**/
|
||||||
|
struct XFIMAMarketStructure
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL bar;
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone ob;
|
||||||
|
XBoxZone fvg;
|
||||||
|
XBoxZone support;
|
||||||
|
XBoxZone resistance;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analysis ...
|
||||||
|
XPivotAnalysis pvAnalysis;
|
||||||
|
XPivotAnalysis maAnalysis;
|
||||||
|
XPivotAnalysis sarAnalysis;
|
||||||
|
XPivotAnalysis zigzagAnalysis;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION pinnedDir;
|
||||||
|
ENUM_X_DIRECTION momentumDir;
|
||||||
|
ENUM_X_DIRECTION engulfedDir;
|
||||||
|
ENUM_X_DIRECTION trueGapedDir;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL flagSwing;
|
||||||
|
ENUM_X_DIRECTION flagPatternDir;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL trendSwings[];
|
||||||
|
ENUM_X_DIRECTION trendDir;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION starPatternDir;
|
||||||
|
ENUM_X_DIRECTION risingPatternDir;
|
||||||
|
ENUM_X_DIRECTION piercingPatternDir;
|
||||||
|
ENUM_X_DIRECTION signalKeyBarPatternDir;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XFIMAMarketStructure()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup Model ...
|
||||||
|
*/
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ob.Clean();
|
||||||
|
fvg.Clean();
|
||||||
|
support.Clean();
|
||||||
|
resistance.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
flagSwing.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
pvAnalysis.Clean();
|
||||||
|
maAnalysis.Clean();
|
||||||
|
sarAnalysis.Clean();
|
||||||
|
zigzagAnalysis.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
trendDir = X_DIRECTION_NONE;
|
||||||
|
pinnedDir = X_DIRECTION_NONE;
|
||||||
|
momentumDir = X_DIRECTION_NONE;
|
||||||
|
engulfedDir = X_DIRECTION_NONE;
|
||||||
|
trueGapedDir = X_DIRECTION_NONE;
|
||||||
|
flagPatternDir = X_DIRECTION_NONE;
|
||||||
|
starPatternDir = X_DIRECTION_NONE;
|
||||||
|
risingPatternDir = X_DIRECTION_NONE;
|
||||||
|
piercingPatternDir = X_DIRECTION_NONE;
|
||||||
|
signalKeyBarPatternDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
SpecifiedClean(trendSwings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checker Functions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure Market Structure Drawer ...
|
||||||
|
**/
|
||||||
|
struct XFIMAMarketStructureDrawerConfig
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawSupports;
|
||||||
|
bool drawResistance;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawSwingTrend;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawOB;
|
||||||
|
bool drawFVG;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawStarPattern;
|
||||||
|
bool drawFlagPattern;
|
||||||
|
bool drawRisingPattern;
|
||||||
|
bool drawPiercingPattern;
|
||||||
|
bool drawSignalKeyBarPattern;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawPinned;
|
||||||
|
bool drawMomentum;
|
||||||
|
bool drawEngulfed;
|
||||||
|
bool drawTrueGaped;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawFIMAPVPivotsAnalysis;
|
||||||
|
bool drawFIMAPVPivotsAnalysisPivots;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawFIMAMAPivotsAnalysis;
|
||||||
|
bool drawFIMAMAPivotsAnalysisPivots;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawFIMASARPivotsAnalysis;
|
||||||
|
bool drawFIMASARPivotsAnalysisPivots;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawFIMAZigZagPivotsAnalysis;
|
||||||
|
bool drawFIMAZigZagPivotsAnalysisPivots;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XFIMAMarketStructureDrawerConfig()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup Model ...
|
||||||
|
*/
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
drawOB = false;
|
||||||
|
drawFVG = false;
|
||||||
|
drawPinned = false;
|
||||||
|
drawMomentum = false;
|
||||||
|
drawSupports = false;
|
||||||
|
drawEngulfed = false;
|
||||||
|
drawTrueGaped = false;
|
||||||
|
drawResistance = false;
|
||||||
|
drawSwingTrend = false;
|
||||||
|
drawStarPattern = false;
|
||||||
|
drawFlagPattern = false;
|
||||||
|
drawRisingPattern = false;
|
||||||
|
drawPiercingPattern = false;
|
||||||
|
drawSignalKeyBarPattern = false;
|
||||||
|
drawFIMAPVPivotsAnalysis = false;
|
||||||
|
drawFIMAMAPivotsAnalysis = false;
|
||||||
|
drawFIMASARPivotsAnalysis = false;
|
||||||
|
drawFIMAZigZagPivotsAnalysis = false;
|
||||||
|
drawFIMAPVPivotsAnalysisPivots = false;
|
||||||
|
drawFIMAMAPivotsAnalysisPivots = false;
|
||||||
|
drawFIMASARPivotsAnalysisPivots = false;
|
||||||
|
drawFIMAZigZagPivotsAnalysisPivots = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Model ...
|
||||||
|
*/
|
||||||
|
void Default()
|
||||||
|
{
|
||||||
|
drawOB = true;
|
||||||
|
drawFVG = true;
|
||||||
|
drawPinned = true;
|
||||||
|
drawMomentum = true;
|
||||||
|
drawSupports = true;
|
||||||
|
drawEngulfed = true;
|
||||||
|
drawTrueGaped = true;
|
||||||
|
drawResistance = true;
|
||||||
|
drawSwingTrend = true;
|
||||||
|
drawStarPattern = true;
|
||||||
|
drawFlagPattern = true;
|
||||||
|
drawRisingPattern = true;
|
||||||
|
drawPiercingPattern = true;
|
||||||
|
drawSignalKeyBarPattern = true;
|
||||||
|
drawFIMAPVPivotsAnalysis = true;
|
||||||
|
drawFIMAMAPivotsAnalysis = true;
|
||||||
|
drawFIMASARPivotsAnalysis = true;
|
||||||
|
drawFIMAZigZagPivotsAnalysis = true;
|
||||||
|
drawFIMAPVPivotsAnalysisPivots = false;
|
||||||
|
drawFIMAMAPivotsAnalysisPivots = false;
|
||||||
|
drawFIMASARPivotsAnalysisPivots = false;
|
||||||
|
drawFIMAZigZagPivotsAnalysisPivots = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user