preparing Strategy 2 of Signaller 2 of XFIMA ...

This commit is contained in:
2025-10-01 01:55:40 +03:30
parent cfba2b3e3a
commit 7ea0128540
5 changed files with 1338 additions and 626 deletions
+511
View File
@@ -0,0 +1,511 @@
//
// Testing Bar Zones ...
// XBoxZone barZones[];
// int barCounts = fima2Signaller.fimaHelper.ExtractBarZones(
// barZones,
// 1, // Bar Index ...
// 50, // Number of Zones ...
// 3, // Break Validation Length ...
// true, // Validate Fake Breakes ...
// 5, // Shadow Multiplier ...
// 1, // Strength ...
// 14 // Validation Length ...
// );
// if (IsValidSize(barCounts))
// {
// //
// // XCBoxObject *iObj;
// // for (int i = 0; i < barCounts; i++)
// // {
// // //
// // iObj = NULL;
// // bool isCreated = fima2Signaller.poiDrawer.DrawBox(
// // barZones[i],
// // iObj,
// // true, // Ignore At ...
// // barZones[i].type // Name ...
// // );
// // //
// // ZeroMemory(iObj);
// // }
// // //
// // Print("Bar Zones Detected ...");
// }
//
// Testing HK Zones ...
// XBoxZone hkZones[];
// int hkCounts = fima2Signaller.fimaHelper.ExtractHKZones(
// hkZones,
// 1, // Bar Index ...
// 50, // Number of Zones ...
// 5, // Shadow Multiplier ...
// 1, // Strength ...
// 14 // Validation Length ...
// );
// if (IsValidSize(hkCounts))
// {
// // //
// // XCBoxObject *iObj;
// // for (int i = 0; i < hkCounts; i++)
// // {
// // //
// // iObj = NULL;
// // bool isCreated = fima2Signaller.poiDrawer.DrawBox(
// // hkZones[i],
// // iObj,
// // true, // Ignore At ...
// // hkZones[i].type // Name ...
// // );
// // //
// // ZeroMemory(iObj);
// // }
// // //
// // Print("HK Zones Detected ...");
// }
//
// Testing XFIMA MA Pivots ...
// XPivot maPivots[];
// int maPivotsCount = fimaHelper.ExtractMAPivots(
// maPivots,
// 1, // Bar Index ...
// 50, // Number of Pivots ...
// 1 // Validation Diff ...
// );
// if (IsValidSize(maPivotsCount))
// {
// //
// // CArrayObj *iPivotsObj;
// // maPivotsCount = poiDrawer.DrawPivots(
// // maPivots,
// // iPivotsObj //
// // );
// //
// // Print("MA Pivots Detected ...");
// }
//
// Custom Indicator Direction Shifts ...
bool hasMACross = HasDirection(structure.maCrossDir);
bool hasHKSwitch = HasDirection(structure.hkSwitchDir);
bool hasSARSwitch = HasDirection(structure.sarSwitchDir);
//
// Check Required Pattern Exists ...
bool hasPinnedBar = HasDirection(structure.pinnedDir);
bool hasEngulfedBar = HasDirection(structure.engulfedDir);
bool hasFlagPattern = HasDirection(structure.flagPatternDir);
bool hasStarPattern = HasDirection(structure.starPatternDir);
bool hasRisingPattern = HasDirection(structure.risingPatternDir);
bool hasPiercingPattern = HasDirection(structure.piercingPatternDir);
bool hasSignalKeyBar = HasDirection(structure.signalKeyBarPatternDir);
//
// Check Bar Pattern Exists ...
// and Select Pattern Direction and Price and Price Type ...
has = hasPinnedBar ||
hasEngulfedBar ||
hasFlagPattern ||
hasStarPattern ||
hasSignalKeyBar ||
hasRisingPattern ||
hasPiercingPattern;
if (has)
{
//
if (hasPinnedBar)
{
//
iDir = structure.pinnedDir;
iName = "XPinned_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time));
}
else if (hasEngulfedBar)
{
//
iDir = structure.engulfedDir;
iName = "XEngulfed_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time));
}
else if (hasFlagPattern)
{
//
iDir = structure.flagPatternDir;
iName = "XFlag_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time));
}
else if (hasStarPattern)
{
//
iDir = structure.starPatternDir;
iName = "XStar_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time));
}
else if (hasSignalKeyBar)
{
//
iDir = structure.risingPatternDir;
iName = "XRising_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time));
}
else if (hasRisingPattern)
{
//
iDir = structure.piercingPatternDir;
iName = "XPiercing_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time));
}
else if (hasPiercingPattern)
{
//
iDir = structure.signalKeyBarPatternDir;
iName = "XSignalKey_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time));
}
//
isBullish = IsSpecifiedBullish(iDir);
isBearish = IsSpecifiedBearish(iDir);
//
// Retrieve Price Type for Validate ...
iPriceType = isBullish
? X_PRICE_DOWN
: X_PRICE_UP;
iPriceEdgeType = isBullish
? X_PRICE_LOW
: X_PRICE_HIGH;
//
iPrice = bar.GetPrice(iPriceType);
iPriceEdge = bar.GetPrice(iPriceEdgeType);
//
// Validate Calculations ...
has = HasDirection(iDir) &&
(isBullish ||
isBearish) &&
NotEmptyZero(iPrice) &&
NotEmptyZero(iPriceEdge) &&
iPrice != iPriceEdge;
if (!has)
{
//
isBullish = false;
isBearish = false;
iDir = X_DIRECTION_NONE;
}
}
//
// Disable Signallers ...
has = false;
// Strategy 1 ...
// Works on Support or Resistances Areas ...
// has = Strategy1HasSignal(
// bar,
// iZone,
// iName,
// supports,
// resistances,
// iDir,
// structure,
// fimaConditions //
// );
//
// Do all Draws Here ...
bool canDraw = false;
if (canDraw && has)
{
//
int iWidth = 2;
XPOIStyle iStyle;
XCBoxObject *iBoxObj = NULL;
color iClr = isBullish
? clrYellow
: clrDarkOrange;
//
// Supports ...
has = HasChild(supports);
if (has)
{
//
count = ArraySize(supports);
for (int i = 0; i < count; i++)
{
//
has = poiDrawer.DrawBox(
supports[i],
iBoxObj,
true, // Ignore At ...
supports[i].type // Name ...
);
if (has)
{
//
poiDrawer.GetBoxStyle(
iStyle,
supports[i].dir //
);
//
poiDrawer.ApplyBoxStyle(
iBoxObj,
iStyle //
);
}
//
iStyle.Clean();
ZeroMemory(iBoxObj);
}
}
//
// Resistances ...
has = HasChild(resistances);
if (has)
{
//
count = ArraySize(resistances);
for (int i = 0; i < count; i++)
{
//
has = poiDrawer.DrawBox(
resistances[i],
iBoxObj,
true, // Ignore At ...
resistances[i].type // Name ...
);
if (has)
{
//
poiDrawer.GetBoxStyle(
iStyle,
resistances[i].dir //
);
//
poiDrawer.ApplyBoxStyle(
iBoxObj,
iStyle //
);
}
//
iStyle.Clean();
ZeroMemory(iBoxObj);
}
}
//
// Selected Zone ...
has = iZone.IsValid();
if (has)
{
//
has = poiDrawer.DrawBox(
iZone,
iBoxObj,
true, // Ignore At ...
iZone.type // Name ...
);
if (has)
{
//
poiDrawer.GetBoxStyle(
iStyle,
iZone.dir //
);
//
iStyle.clr = iClr;
iStyle.width = iWidth;
//
poiDrawer.ApplyBoxStyle(
iBoxObj,
iStyle //
);
}
}
//
// TrendLines ...
//
// Pivots ...
//
has = HasChild(pvPivots);
if (has)
{
//
CArrayObj *drawnPivots = new CArrayObj();
count = poiDrawer.DrawPivots(
pvPivots,
drawnPivots //
);
}
//
has = HasChild(zgPivots);
if (has)
{
//
CArrayObj *drawnPivots = new CArrayObj();
count = poiDrawer.DrawPivots(
zgPivots,
drawnPivots //
);
}
//
// Patterns Bar ...
has = HasDirection(iDir);
if (has)
{
//
int iCode = 159;
ENUM_ARROW_ANCHOR iAnchor = isBullish
? ANCHOR_TOP
: ANCHOR_BOTTOM;
//
XCBarArrowObject *iPatternObj;
has = poiDrawer.DrawBarArrow(
bar,
iPatternObj,
iPriceEdgeType,
iCode,
iClr,
iWidth,
iAnchor,
iName,
true, // Ignore Bar Tag ...
10 // Threshold ...
);
}
}
/////////////////////////////////////////////////
/**
* Check Pattern Has Signal Based on Strategy 2 ...
*
* @param bar: XOHCL, reference to Pattern Bar ...
* @param iZone: XBoxZone, reference to holds affected zone ...
* @param patternName: string, detected pattern's name ...
* @param supports: XBoxZone, array reference to Provide Exists Supports ...
* @param resistances: XBoxZone, array reference to Provide Exists Resistances ...
* @param patternDir: ENUM_X_DIRECTION, detected pattern's direction ...
* @param fimaConditions: XFIMAConditions, reference to Bar Specified XFIMA Conditions ...
* @param fimaMarketStructure: XFIMAMarketStructure, refrence to Provides Market Structure ...
*
* @return ( bool )
*/
bool Strategy2HasSignal(
XOHCL &bar,
XBoxZone &iZone,
string patternName,
XBoxZone &supports[],
XBoxZone &resistances[],
ENUM_X_DIRECTION patternDir,
XFIMAMarketStructure &structure,
XFIMAConditions &fimaConditions,
XFIMAMarketStructure &fimaMarketStructure //
)
{
//
bool result = false;
//
// Prepare ...
iZone.Clean();
//
// Validate ...
//
// Do Detection ...
//
// Validate result ...
//
// Cleanup Resources ...
//
return result;
}
/**
* Check Pattern Has Signal Based on Strategy 1 ...
*
* @param bar: XOHCL, reference to Pattern Bar ...
* @param iZone: XBoxZone, reference to holds affected zone ...
* @param supports: XBoxZone, array reference to Provide Exists Supports ...
* @param resistances: XBoxZone, array reference to Provide Exists Resistances ...
* @param structure: XFIMAMarketStructure, refrence to Provides Market Structure ...
* @param fimaConditions: XFIMAConditions, reference to Bar Specified XFIMA Conditions ...
*
* @return ( bool )
*/
bool Strategy3HasSignal(
XOHCL &bar,
XBoxZone &iZone,
XBoxZone &supports[],
XBoxZone &resistances[],
XFIMAMarketStructure &structure,
XFIMAConditions &fimaConditions //
)
{
//
bool result = false;
//
// Prepare ...
iZone.Clean();
//
// Validate ...
result = bar.IsValid();
if (!result)
{
return result;
}
//
// Reading XHK ...
//
// Bar 1 ...
double cHKO = fimaConditions.hkOpenBuffer[0];
double cHKH = fimaConditions.hkHighBuffer[0];
double cHKL = fimaConditions.hkLowBuffer[0];
double cHKC = fimaConditions.hkCloseBuffer[0];
//
// Bar 2 ...
double pHKO = fimaConditions.hkOpenBuffer[1];
double pHKH = fimaConditions.hkHighBuffer[1];
double pHKL = fimaConditions.hkLowBuffer[1];
double pHKC = fimaConditions.hkCloseBuffer[1];
//
bool isCHKBullish = cHKO < cHKC;
bool isCHKBearish = cHKO > cHKC;
//
bool isPHKBullish = pHKO < pHKC;
bool isPHKBearish = pHKO > pHKC;
//
bool isCHKSwitchedToBullish = isCHKBullish && !isPHKBullish;
bool isCHKSwitchedToBearish = isCHKBearish && !isPHKBearish;
//
return result;
}
+513 -115
View File
@@ -943,6 +943,311 @@ class XCXFIMAHelper : public XCBaseHelper
//
// Pivot Actions ...
/**
* Check Specified Bar has MA Cross or not ...
*
* @param dir: reference for holds cross Direction ...
* @param barIndex: int, Specified Bar Index ...
* @param validCrossDiffMultiplier: double, validate diff between MAs on Cross happens ...
*
* @return ( bool )
*/
bool HasMACross(
ENUM_X_DIRECTION &dir,
int barIndex = 0,
double validCrossDiffMultiplier = 1 //
)
{
//
bool result = false;
//
// Prepare ...
dir = X_DIRECTION_NONE;
//
// Normalize ...
barIndex = NormalizeInt(barIndex, 0);
validCrossDiffMultiplier = NormalizeDouble(validCrossDiffMultiplier, 0);
//
double fast[];
double slow[];
double upper[];
double lower[];
int count = ReadMAValues(
fast,
slow,
upper,
lower,
barIndex,
2 //
);
//
bool isBullish = false;
bool isBearish = false;
//
// Validate Readed Values ...
result = IsValidSize(count) && count >= 2;
if (result)
{
//
// Detect Direction Change ...
//
bool notEmpty =
NotEmptyZero(fast[0]) &&
NotEmptyZero(fast[1]) &&
NotEmptyZero(slow[0]) &&
NotEmptyZero(slow[1]);
//
isBullish =
notEmpty &&
fast[0] > slow[0] &&
fast[1] < slow[1];
//
isBearish =
notEmpty &&
fast[0] < slow[0] &&
fast[1] > slow[1];
//
result =
isBullish ||
isBearish;
//
// Validate Direction Change ...
if (result &&
validCrossDiffMultiplier > 0)
{
//
double _points = GetPoints(GetSymbol());
double diff = MathAbs(fast[0] - slow[0]);
//
result = diff >= (validCrossDiffMultiplier * _points);
}
}
//
if (result)
{
//
// Setting Direction ...
dir =
isBullish
? X_DIRECTION_BULLISH
: isBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
// Cleanup Resources ...
XClean(fast);
XClean(slow);
XClean(upper);
XClean(lower);
//
return result;
}
/**
* Check Specified Bar has HK Switch or not ...
*
* @param dir: reference for holds cross Direction ...
* @param barIndex: int, Specified Bar Index ...
*
* @return ( bool )
*/
bool HasHKSwitch(
ENUM_X_DIRECTION &dir,
int barIndex = 0 //
)
{
//
bool result = false;
//
// Prepare ...
dir = X_DIRECTION_NONE;
//
// Normalize ...
barIndex = NormalizeInt(barIndex, 0);
//
double low[];
double open[];
double high[];
double close[];
int count = ReadHKBars(
open,
high,
low,
close,
barIndex,
2 //
);
//
bool isBullish = false;
bool isBearish = false;
//
// Validate Readed Values ...
result = IsValidSize(count) && count >= 2;
if (result)
{
//
// Detect Direction Change ...
//
bool notEmpty =
NotEmptyZero(open[0]) &&
NotEmptyZero(open[1]) &&
NotEmptyZero(close[0]) &&
NotEmptyZero(close[1]);
//
isBullish =
notEmpty &&
open[0] < close[0] &&
open[1] > close[1];
//
isBearish =
notEmpty &&
open[0] > close[0] &&
open[1] < close[1];
//
result =
isBullish ||
isBearish;
}
//
if (result)
{
//
// Setting Direction ...
dir =
isBullish
? X_DIRECTION_BULLISH
: isBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
// Cleanup Resources ...
XClean(low);
XClean(open);
XClean(high);
XClean(close);
//
return result;
}
/**
* Check Specified Bar has SAR Switch or not ...
*
* @param dir: reference for holds cross Direction ...
* @param barIndex: int, Specified Bar Index ...
*
* @return ( bool )
*/
bool HasSARSwitch(
ENUM_X_DIRECTION &dir,
int barIndex = 0 //
)
{
//
bool result = false;
//
// Prepare ...
dir = X_DIRECTION_NONE;
//
// Normalize ...
barIndex = NormalizeInt(barIndex, 0);
//
// Validate ...
result = mHandler != INVALID_HANDLE;
if (!result)
{
return result;
}
//
double sars[];
int count = CopyBuffer(
mHandler,
XFIMA_SAR_STATE_LINE,
barIndex,
2,
sars //
);
//
bool isBullish = false;
bool isBearish = false;
//
// Validate Readed Values ...
result = IsValidSize(count) && count >= 2;
if (result)
{
//
// Detect Direction Change ...
//
isBullish =
sars[0] >= 1 &&
sars[1] <= -1;
//
isBearish =
sars[0] <= -1 &&
sars[1] >= 1;
//
result =
isBullish ||
isBearish;
}
//
if (result)
{
//
// Setting Direction ...
dir =
isBullish
? X_DIRECTION_BULLISH
: isBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
// Cleanup Resources ...
XClean(sars);
//
return result;
}
/**
* Extract Specified Kind of Pivots ...
*
@@ -1254,121 +1559,6 @@ class XCXFIMAHelper : public XCBaseHelper
return result;
}
/**
* Check Specified Bar has MA Cross or not ...
*
* @param dir: reference for holds cross Direction ...
* @param barIndex: int, Specified Bar Index ...
* @param validCrossDiffMultiplier: double, validate diff between MAs on Cross happens ...
*
* @return ( bool )
*/
bool HasMACross(
ENUM_X_DIRECTION &dir,
int barIndex = 0,
double validCrossDiffMultiplier = 1 //
)
{
//
bool result = false;
//
// Prepare ...
dir = X_DIRECTION_NONE;
//
// Normalize ...
barIndex = NormalizeInt(barIndex, 0);
validCrossDiffMultiplier = NormalizeDouble(validCrossDiffMultiplier, 0);
//
double fast[];
double slow[];
double upper[];
double lower[];
int count = ReadMAValues(
fast,
slow,
upper,
lower,
barIndex,
2 //
);
//
bool isBullish = false;
bool isBearish = false;
//
// Validate Readed Values ...
result = IsValidSize(count) && count >= 2;
if (result)
{
//
// Detect Direction Change ...
//
bool notEmpty =
NotEmptyZero(fast[0]) &&
NotEmptyZero(fast[1]) &&
NotEmptyZero(slow[0]) &&
NotEmptyZero(slow[1]);
//
isBullish =
notEmpty &&
fast[0] > slow[0] &&
fast[1] < slow[1];
//
isBearish =
notEmpty &&
fast[0] < slow[0] &&
fast[1] > slow[1];
//
result =
isBullish ||
isBearish;
//
// Validate Direction Change ...
if (result &&
validCrossDiffMultiplier > 0)
{
//
double _points = GetPoints(GetSymbol());
double diff = MathAbs(fast[0] - slow[0]);
//
result = diff >= (validCrossDiffMultiplier * _points);
}
}
//
if (result)
{
//
// Setting Direction ...
dir =
isBullish
? X_DIRECTION_BULLISH
: isBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
// Cleanup Resources ...
XClean(fast);
XClean(slow);
XClean(upper);
XClean(lower);
//
return result;
}
/**
* Extract Specified Kind of Pivots ...
*
@@ -1596,6 +1786,214 @@ class XCXFIMAHelper : public XCBaseHelper
return result;
}
/**
* Extract Specified Kind of Pivots ...
*
* @param pivots: XPivot, refrence Collection to hold Extracted pivots ...
* @param barIndex: int, Specified Bar Index ...
* @param requiredNumberOFPivots: int, Specified which Number of Pivots must be Extracted ...
* @param maxAllowedLoopbackLength: int, Specified Maximum Loopback Length for Pivot Extraction ...
*
* @return ( int )
*/
int ExtractHKPivots(
XPivot &pivots[],
int barIndex = 0,
int requiredNumberOFPivots = 50,
int maxAllowedLoopbackLength = 1500 //
)
{
//
int result = 0;
//
// Prepare ...
SpecifiedClean(pivots);
//
// Normalize ...
barIndex = NormalizeInt(barIndex, 0);
requiredNumberOFPivots = NormalizeInt(requiredNumberOFPivots, 2);
maxAllowedLoopbackLength = NormalizeInt(maxAllowedLoopbackLength, 50);
//
// Validate ...
if (mHandler == INVALID_HANDLE)
{
return result;
}
//
double low[];
double open[];
XPivot iPivot;
int count = 0;
double high[];
double close[];
bool has = false;
int idx = barIndex - 1;
datetime iPivotTime = NULL;
string symbol = GetSymbol();
bool isSwitchedToBullish = false;
bool isSwitchedToBearish = false;
double iSelectedValue = EMPTY_VALUE;
ENUM_TIMEFRAMES period = GetPeriod();
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
ENUM_X_PIVOT_TYPE iType = X_PIVOT_TYPE_NONE;
int maxAllowed = barIndex + maxAllowedLoopbackLength - 1;
while (idx < maxAllowed &&
ArraySize(pivots) < requiredNumberOFPivots)
{
//
idx++;
//
// Prepare ...
iPivot.Clean();
SpecifiedClean(low);
SpecifiedClean(open);
SpecifiedClean(high);
SpecifiedClean(close);
//
// Ignore First Item ...
if (idx == barIndex)
{
continue;
}
//
// Reading Buffer ...
count = ReadHKBars(
open,
high,
low,
close,
idx,
2 //
);
has = IsValidSize(count);
//
// Validate Value ...
has =
HasHKSwitch(
iDir,
idx //
) &&
NotEmptyZero(open[0]) &&
NotEmptyZero(open[1]) &&
NotEmptyZero(close[0]) &&
NotEmptyZero(close[1]);
if (has)
{
//
// Check Direction Changed ...
isSwitchedToBullish = IsXBullish(iDir);
isSwitchedToBearish = IsXBearish(iDir);
has =
isSwitchedToBullish ||
isSwitchedToBearish;
if (has)
{
//
// Calculate and Validate Type ...
// Peaks Only Valid when Confirmed by Bar High ...
iType =
isSwitchedToBearish
? X_PIVOT_TYPE_PEAK
: isSwitchedToBullish
? X_PIVOT_TYPE_VALE
: X_PIVOT_TYPE_NONE;
has = IsXValid(iType);
//
// Calculate and Validate Dir ...
iDir = IsXPeak(iType)
? X_DIRECTION_BEARISH
: IsXVale(iType)
? X_DIRECTION_BULLISH
: X_DIRECTION_NONE;
has = has &&
HasDirection(iDir);
//
if (has)
{
//
iPivotTime = GetBarTime(
symbol,
period,
idx //
);
//
// Select Value based on Pivot Type ...
iSelectedValue = IsXPeak(iType)
? MathMax(open[0], close[0])
: MathMin(open[0], close[0]);
//
// Initialize and Validate Pivot ...
has = iPivot.Init(
iSelectedValue,
iPivotTime,
symbol,
iDir,
period,
iType //
);
if (has)
{
//
// Add Pivot to Collection only if not Exists ...
AddIfNotExists(
iPivot,
pivots //
);
}
}
//
// Cleanup Resources ...
iPivot.Clean();
}
}
//
// Cleanup Resources ...
iPivot.Clean();
SpecifiedClean(low);
SpecifiedClean(open);
SpecifiedClean(high);
SpecifiedClean(close);
//
// Check Moving Forward Condition ...
has =
idx < maxAllowed &&
ArraySize(pivots) < requiredNumberOFPivots;
if (!has)
{
break;
}
}
//
result = ArraySize(pivots);
//
// Cleanup Resources ...
iPivot.Clean();
SpecifiedClean(low);
SpecifiedClean(open);
SpecifiedClean(high);
SpecifiedClean(close);
//
return result;
}
/**
* Extract Specified Kind of Pivots ...
*
File diff suppressed because it is too large Load Diff
@@ -916,6 +916,9 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
resistance.Clean();
}
//
// Custom Indicator Pivots ...
//
// Detecting MA Crosses ...
if (config.detectMACrosses)
@@ -933,13 +936,52 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
structure.maCrosses,
idx,
config.recentlyPatternsMaxAllowedCollecting,
config.validMACrossDiffMultiplier,
config.validMACrossDiffMultiplier,
config.recentlyPatternsMaxLookupLength //
);
}
//
// Analysers ...
// Detecting HK Switches ...
if (config.detectHKSwitches)
{
//
idx = forBar.Index();
has = fimaHelper.HasHKSwitch(
structure.hkSwitchDir,
idx //
);
//
fimaHelper.ExtractHKPivots(
structure.hkSwitches,
idx,
config.recentlyPatternsMaxAllowedCollecting,
config.recentlyPatternsMaxLookupLength //
);
}
//
// Detecting SAR Switches ...
if (config.detectSARSwitches) {
//
idx = forBar.Index();
has = fimaHelper.HasSARSwitch(
structure.sarSwitchDir,
idx //
);
//
fimaHelper.ExtractSARPivots(
structure.sarSwitches,
idx,
config.recentlyPatternsMaxAllowedCollecting,
config.recentlyPatternsMaxLookupLength //
);
}
//
// Custom Analysers ...
//
// Analyse Based on PV ...
@@ -73,6 +73,10 @@ struct XFIMAPatternDetectorConfig
bool detectMACrosses;
double validMACrossDiffMultiplier;
//
bool detectHKSwitches;
bool detectSARSwitches;
//
// Configs ...
@@ -167,6 +171,10 @@ struct XFIMAPatternDetectorConfig
detectMACrosses = false;
validMACrossDiffMultiplier = 0;
//
detectHKSwitches = false;
detectSARSwitches = false;
//
obLoopback = 0;
fvgLoopback = 0;
@@ -238,6 +246,10 @@ struct XFIMAPatternDetectorConfig
detectMACrosses = true;
validMACrossDiffMultiplier = 1;
//
detectHKSwitches = true;
detectSARSwitches = true;
//
// OB / FVg ...
obLoopback = 5;
@@ -329,6 +341,8 @@ struct XFIMAPatternDetectorConfig
//
detectMACrosses = true;
detectHKSwitches = true;
detectSARSwitches = true;
}
/**
@@ -370,6 +384,8 @@ struct XFIMAPatternDetectorConfig
//
detectMACrosses = false;
detectHKSwitches = false;
detectSARSwitches = false;
}
//
@@ -450,6 +466,14 @@ struct XFIMAMarketStructure
ENUM_X_DIRECTION maCrossDir;
XPivot maCrosses[];
//
ENUM_X_DIRECTION hkSwitchDir;
XPivot hkSwitches[];
//
ENUM_X_DIRECTION sarSwitchDir;
XPivot sarSwitches[];
//
// Constructor ...
XFIMAMarketStructure()
@@ -499,6 +523,14 @@ struct XFIMAMarketStructure
maCrossDir = X_DIRECTION_NONE;
SpecifiedClean(maCrosses);
//
hkSwitchDir = X_DIRECTION_NONE;
SpecifiedClean(hkSwitches);
//
sarSwitchDir = X_DIRECTION_NONE;
SpecifiedClean(sarSwitches);
//
SpecifiedClean(obs);
SpecifiedClean(fvgs);