Last Works on Validating Order Blocks ...
This commit is contained in:
@@ -520,7 +520,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
//
|
||||
XBarTracker mBarTracker; // Strategy Time Tracker ...
|
||||
XCBarAnalyser mBarAnalyser; // Bar Analyser Instance
|
||||
// X121SMCStrategyConditions mConditions; // Market Conditions ...
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
@@ -120,12 +120,18 @@ class XC121SMCCycleHelper : public XCBase
|
||||
bool Init(
|
||||
string symbol,
|
||||
ENUM_TIMEFRAMES period,
|
||||
X121Inputs &x121Inputs //
|
||||
X121Inputs &x121Inputs,
|
||||
int requiredPOIS = 50 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (requiredPOIS < 10) {
|
||||
requiredPOIS = 10;
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValid(symbol) &&
|
||||
IsValid(period);
|
||||
@@ -152,7 +158,7 @@ class XC121SMCCycleHelper : public XCBase
|
||||
symbol,
|
||||
period //
|
||||
);
|
||||
mPOIDetector.MaxNumberOfRequiredPOIs(10);
|
||||
mPOIDetector.MaxNumberOfRequiredPOIs(requiredPOIS);
|
||||
mPOIDetector.Init();
|
||||
|
||||
//
|
||||
|
||||
@@ -257,9 +257,10 @@ struct X121SMCStrategyConditions
|
||||
ENUM_X_DIRECTION signalDir;
|
||||
|
||||
//
|
||||
XPriceZones priceZones;
|
||||
XPriceZones decisionZones;
|
||||
XMarketStructure marketStructure;
|
||||
X121Conditions conditions;
|
||||
// XPriceZones priceZones;
|
||||
// XPriceZones decisionZones;
|
||||
// XMarketStructure marketStructure;
|
||||
|
||||
//
|
||||
void X121SMCStrategyConditions()
|
||||
@@ -287,9 +288,10 @@ struct X121SMCStrategyConditions
|
||||
signalDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
priceZones.Clean();
|
||||
decisionZones.Clean();
|
||||
marketStructure.Clean();
|
||||
conditions.Clean();
|
||||
// priceZones.Clean();
|
||||
// decisionZones.Clean();
|
||||
// marketStructure.Clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,75 +539,75 @@ int DrawX121SMCStrategyConditions(
|
||||
//
|
||||
bool isBullish = IsBullish(conditions.signalDir);
|
||||
|
||||
//
|
||||
bool hasPriceZones = conditions.priceZones.IsValid();
|
||||
if (hasPriceZones &&
|
||||
drawPriceZones)
|
||||
{
|
||||
//
|
||||
XCBaseObject *objects[];
|
||||
int objectsCount = drawer.DrawPriceZone(
|
||||
conditions.priceZones,
|
||||
objects,
|
||||
conditions.signalDir,
|
||||
drawOnlyPriceZonesBoundary //
|
||||
);
|
||||
if (IsValidSize(objectsCount))
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
objects,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
}
|
||||
}
|
||||
// //
|
||||
// bool hasPriceZones = conditions.priceZones.IsValid();
|
||||
// if (hasPriceZones &&
|
||||
// drawPriceZones)
|
||||
// {
|
||||
// //
|
||||
// XCBaseObject *objects[];
|
||||
// int objectsCount = drawer.DrawPriceZone(
|
||||
// conditions.priceZones,
|
||||
// objects,
|
||||
// conditions.signalDir,
|
||||
// drawOnlyPriceZonesBoundary //
|
||||
// );
|
||||
// if (IsValidSize(objectsCount))
|
||||
// {
|
||||
// //
|
||||
// Copy(
|
||||
// objects,
|
||||
// drawnObjects,
|
||||
// false //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
bool hasDecisionZones = conditions.decisionZones.IsValid();
|
||||
if (hasDecisionZones &&
|
||||
drawDecisionZones)
|
||||
{
|
||||
//
|
||||
XCBaseObject *objects[];
|
||||
int objectsCount = drawer.DrawPriceZone(
|
||||
conditions.decisionZones,
|
||||
objects,
|
||||
conditions.signalDir,
|
||||
drawOnlyPriceZonesBoundary //
|
||||
);
|
||||
if (IsValidSize(objectsCount))
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
objects,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
}
|
||||
}
|
||||
// //
|
||||
// bool hasDecisionZones = conditions.decisionZones.IsValid();
|
||||
// if (hasDecisionZones &&
|
||||
// drawDecisionZones)
|
||||
// {
|
||||
// //
|
||||
// XCBaseObject *objects[];
|
||||
// int objectsCount = drawer.DrawPriceZone(
|
||||
// conditions.decisionZones,
|
||||
// objects,
|
||||
// conditions.signalDir,
|
||||
// drawOnlyPriceZonesBoundary //
|
||||
// );
|
||||
// if (IsValidSize(objectsCount))
|
||||
// {
|
||||
// //
|
||||
// Copy(
|
||||
// objects,
|
||||
// drawnObjects,
|
||||
// false //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
bool hasMarketStructure = conditions.marketStructure.IsValid();
|
||||
if (hasMarketStructure &&
|
||||
drawMarketStructure)
|
||||
{
|
||||
//
|
||||
XCBaseObject *objects[];
|
||||
int objectsCount = drawer.DrawMarketStructure(
|
||||
conditions.marketStructure,
|
||||
objects //
|
||||
);
|
||||
if (IsValidSize(objectsCount))
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
objects,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
}
|
||||
}
|
||||
// //
|
||||
// bool hasMarketStructure = conditions.marketStructure.IsValid();
|
||||
// if (hasMarketStructure &&
|
||||
// drawMarketStructure)
|
||||
// {
|
||||
// //
|
||||
// XCBaseObject *objects[];
|
||||
// int objectsCount = drawer.DrawMarketStructure(
|
||||
// conditions.marketStructure,
|
||||
// objects //
|
||||
// );
|
||||
// if (IsValidSize(objectsCount))
|
||||
// {
|
||||
// //
|
||||
// Copy(
|
||||
// objects,
|
||||
// drawnObjects,
|
||||
// false //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
result = ArraySize(drawnObjects);
|
||||
@@ -713,4 +715,142 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
bool TestPOIState(
|
||||
XCPOIDrawer *drawer,
|
||||
ENUM_X_DIRECTION forDir, // Test For Specified Direction ...
|
||||
XPOIState &biggerState, // Bigger TF POI(s) ...
|
||||
XPOIState &midState, // Mid TF POI(s) ...
|
||||
XPOIState &triggerState, // Trigger TF POI(s) ...
|
||||
int barIndex = 0 // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
result =
|
||||
drawer != NULL &&
|
||||
HasDirection(forDir) &&
|
||||
biggerState.HasChild() &&
|
||||
midState.HasChild() &&
|
||||
triggerState.HasChild();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string symbol = biggerState.symbol;
|
||||
ENUM_TIMEFRAMES period = biggerState.period;
|
||||
|
||||
//
|
||||
// Retrieve Bars ...
|
||||
XOHCL triggerCBar;
|
||||
result = triggerCBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
// Select Order Blocks Which Has Big Changes ...
|
||||
int count = 0;
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
XCOrderBlock *bullishOrderBlocks[];
|
||||
int bullishOrderBlocksCount = biggerState.CountBullishOrderBlocks();
|
||||
count = bullishOrderBlocksCount;
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = count - 1; i >= 0; i--)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOb = biggerState.bullishOrderBlocks[i];
|
||||
iOb.To(cTime);
|
||||
|
||||
//
|
||||
// Find Exit Bar of Bullish OrderBlock Upper ...
|
||||
XOHCL breakerBar;
|
||||
bool hasBreakerBar = iOb.DetectBreakerBar(breakerBar);
|
||||
if (!hasBreakerBar)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Order Block is Hunted Or Not ...
|
||||
XOHCL huntedBar;
|
||||
bool isHunted = iOb.IsHunted(huntedBar);
|
||||
if (isHunted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
XCBullishOrderBlockObject *iOBObject;
|
||||
bool isInited = drawer.CreateBullishOrderBlock(
|
||||
iOb,
|
||||
iOBObject //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
XCOHCLObject *iBarObj;
|
||||
isInited = drawer.CreateBar(
|
||||
breakerBar,
|
||||
iBarObj,
|
||||
cTime //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
Print("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
XCOrderBlock *bearishOrderBlocks[];
|
||||
int bearishOrderBlocksCount = biggerState.CountBearishOrderBlocks();
|
||||
count = bearishOrderBlocksCount;
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = count - 1; i >= 0; i--)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOb = biggerState.bearishOrderBlocks[i];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValidSize(bullishOrderBlocksCount) ||
|
||||
IsValidSize(bearishOrderBlocksCount)
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -48,23 +48,6 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
datetime setupTime;
|
||||
datetime triggerTime;
|
||||
|
||||
//
|
||||
XMarketStructure consolidationMarketStructure;
|
||||
XMarketStructure analyseMarketStructure;
|
||||
|
||||
//
|
||||
datetime newPeakAboveAtrUpperAt;
|
||||
datetime newValeBelowAtrLowerAt;
|
||||
datetime sarSiwtchedToBullishAt;
|
||||
datetime sarSiwtchedToBearishAt;
|
||||
datetime rsiCrossedOverOverSoldAt;
|
||||
datetime rsiCrossedUnderOverBoughtAt;
|
||||
|
||||
//
|
||||
XPriceZones decisionZone;
|
||||
XPriceZones peakPriceZone;
|
||||
XPriceZones valePriceZone;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
X121SMCStrategyXTWPVSignalConditions()
|
||||
@@ -180,127 +163,6 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
void ExtensionClean()
|
||||
{
|
||||
//
|
||||
decisionZone.Clean();
|
||||
peakPriceZone.Clean();
|
||||
valePriceZone.Clean();
|
||||
|
||||
//
|
||||
analyseMarketStructure.Clean();
|
||||
consolidationMarketStructure.Clean();
|
||||
|
||||
//
|
||||
newPeakAboveAtrUpperAt = NULL;
|
||||
newValeBelowAtrLowerAt = NULL;
|
||||
sarSiwtchedToBullishAt = NULL;
|
||||
sarSiwtchedToBearishAt = NULL;
|
||||
rsiCrossedOverOverSoldAt = NULL;
|
||||
rsiCrossedUnderOverBoughtAt = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Required Market Strucutre Exists or not ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasMarketStrucutre()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
analyseMarketStructure.IsValid() &&
|
||||
consolidationMarketStructure.IsValid()
|
||||
//
|
||||
&&
|
||||
//
|
||||
analyseMarketStructure.HasTrend() &&
|
||||
consolidationMarketStructure.HasTrend()
|
||||
//
|
||||
&&
|
||||
//
|
||||
analyseMarketStructure.bias == consolidationMarketStructure.bias
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Conditions Filled ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsFilled()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = HasMarketStrucutre();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = IsBullish(analyseMarketStructure.bias);
|
||||
|
||||
//
|
||||
result =
|
||||
isBullish
|
||||
? IsValid(newValeBelowAtrLowerAt) &&
|
||||
IsValid(sarSiwtchedToBullishAt) &&
|
||||
IsValid(rsiCrossedOverOverSoldAt)
|
||||
: IsValid(newPeakAboveAtrUpperAt) &&
|
||||
IsValid(sarSiwtchedToBearishAt) &&
|
||||
IsValid(rsiCrossedUnderOverBoughtAt);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Has Price Zones ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasPriceZone()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = HasMarketStrucutre();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = IsBullish(analyseMarketStructure.bias);
|
||||
|
||||
//
|
||||
result =
|
||||
isBullish
|
||||
? valePriceZone.IsValid()
|
||||
: peakPriceZone.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Has Decision Zones ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasDecisionZone()
|
||||
{
|
||||
return HasPriceZone() &&
|
||||
decisionZone.IsValid();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -322,7 +184,9 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
XC121SMCCycleHelper *analyseCycleHelper,
|
||||
XC121SMCCycleHelper *verificationCycleHelper,
|
||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||
XC121SMCCycleHelper *visionCycleHelper
|
||||
XC121SMCCycleHelper *visionCycleHelper,
|
||||
//
|
||||
XCPOIDrawer *drawer //
|
||||
//
|
||||
)
|
||||
{
|
||||
@@ -517,348 +381,13 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
// Setup Conditions ...
|
||||
|
||||
//
|
||||
bool hasMarketStructure = conditions.HasMarketStrucutre();
|
||||
if (!hasMarketStructure)
|
||||
{
|
||||
//
|
||||
bool hasConsolidationMarketStructure =
|
||||
consolidationCycleHelper
|
||||
.DetectMarketStructure(conditions.consolidationMarketStructure);
|
||||
|
||||
//
|
||||
bool hasAnalyseMarketStructure =
|
||||
analyseCycleHelper
|
||||
.DetectMarketStructure(conditions.analyseMarketStructure);
|
||||
|
||||
//
|
||||
hasMarketStructure = conditions.HasMarketStrucutre();
|
||||
result = hasMarketStructure;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// We Are Sure we Have Direct Structure Bias ...
|
||||
isBullish = IsBullish(conditions.analyseMarketStructure.bias);
|
||||
isBearish = IsBearish(conditions.analyseMarketStructure.bias);
|
||||
|
||||
//
|
||||
// RSI ...
|
||||
double rsi = triggerConditions.x121Conditions.rsiBuffer[1];
|
||||
|
||||
//
|
||||
bool isRSICrossedOverOverBought = triggerConditions.x121Conditions.isRSICrossedOverOverBought;
|
||||
bool isRSICrossedUnderOverBought = triggerConditions.x121Conditions.isRSICrossedUnderOverBought;
|
||||
|
||||
//
|
||||
bool isRSICrossedOverOverSold = triggerConditions.x121Conditions.isRSICrossedOverOverSold;
|
||||
bool isRSICrossedUnderOverSold = triggerConditions.x121Conditions.isRSICrossedUnderOverSold;
|
||||
|
||||
//
|
||||
// PV ...
|
||||
double peak = triggerConditions.x121Conditions.peaksBuffer[1];
|
||||
double vale = triggerConditions.x121Conditions.valesBuffer[1];
|
||||
|
||||
//
|
||||
bool isNewPeak = triggerConditions.x121Conditions.isNewPeak;
|
||||
bool isNewVale = triggerConditions.x121Conditions.isNewVale;
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
double atr = triggerConditions.x121Conditions.atrBuffer[1];
|
||||
double atrUpper = triggerConditions.x121Conditions.atrUpperBuffer[1];
|
||||
double atrLower = triggerConditions.x121Conditions.atrLowerBuffer[1];
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
double sar = triggerConditions.x121Conditions.sarBuffer[1];
|
||||
|
||||
//
|
||||
bool isSarSwitchedToBullish = triggerConditions.x121Conditions.isSarSwitchedToBullish;
|
||||
bool isSarSwitchedToBearish = triggerConditions.x121Conditions.isSarSwitchedToBearish;
|
||||
|
||||
//
|
||||
// Complex Conditions ...
|
||||
|
||||
//
|
||||
bool isNewPeakAboveAtrUpper =
|
||||
isNewPeak &&
|
||||
peak > atrUpper;
|
||||
|
||||
//
|
||||
bool isNewValeBelowAtrLower =
|
||||
isNewVale &&
|
||||
vale < atrLower;
|
||||
|
||||
//
|
||||
// Fill Conditions ...
|
||||
bool isConditionsFilled = conditions.IsFilled();
|
||||
if (!isConditionsFilled)
|
||||
{
|
||||
//
|
||||
// Cleanup ...
|
||||
|
||||
//
|
||||
// Sar ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isSarSwitchedToBearish &&
|
||||
IsValid(conditions.sarSiwtchedToBullishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBullishAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isSarSwitchedToBullish &&
|
||||
IsValid(conditions.sarSiwtchedToBearishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBearishAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Rsi ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isRSICrossedUnderOverSold &&
|
||||
IsValid(conditions.rsiCrossedOverOverSoldAt))
|
||||
{
|
||||
conditions.rsiCrossedOverOverSoldAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isRSICrossedOverOverBought &&
|
||||
IsValid(conditions.rsiCrossedUnderOverBoughtAt))
|
||||
{
|
||||
conditions.rsiCrossedUnderOverBoughtAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Atr Change ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isNewPeak &&
|
||||
IsValid(conditions.newValeBelowAtrLowerAt))
|
||||
{
|
||||
conditions.newValeBelowAtrLowerAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isNewVale &&
|
||||
IsValid(conditions.newPeakAboveAtrUpperAt))
|
||||
{
|
||||
conditions.newPeakAboveAtrUpperAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Filling Up ...
|
||||
|
||||
//
|
||||
// Sar Change ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isSarSwitchedToBullish &&
|
||||
!IsValid(conditions.sarSiwtchedToBullishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBullishAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isSarSwitchedToBearish &&
|
||||
!IsValid(conditions.sarSiwtchedToBearishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBearishAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Rsi Change ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isRSICrossedOverOverSold &&
|
||||
!IsValid(conditions.rsiCrossedOverOverSoldAt))
|
||||
{
|
||||
conditions.rsiCrossedOverOverSoldAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isRSICrossedUnderOverBought &&
|
||||
!IsValid(conditions.rsiCrossedUnderOverBoughtAt))
|
||||
{
|
||||
conditions.rsiCrossedUnderOverBoughtAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Atr Change ...
|
||||
// New Peaks and Vale ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isNewValeBelowAtrLower &&
|
||||
!IsValid(conditions.newValeBelowAtrLowerAt))
|
||||
{
|
||||
conditions.newValeBelowAtrLowerAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isNewPeakAboveAtrUpper &&
|
||||
!IsValid(conditions.newPeakAboveAtrUpperAt))
|
||||
{
|
||||
conditions.newPeakAboveAtrUpperAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
isConditionsFilled = conditions.IsFilled();
|
||||
result = isConditionsFilled;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fill Price Zones ...
|
||||
bool hasPriceZone = conditions.HasPriceZone();
|
||||
if (!hasPriceZone)
|
||||
{
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XPriceZones vPZone;
|
||||
bool hasValeInsideZone = CalculatePriceInsideZones(
|
||||
vPZone,
|
||||
analyseState,
|
||||
vale //
|
||||
);
|
||||
|
||||
//
|
||||
XPriceZones cbPZone;
|
||||
bool hasPriceInsideZone = CalculatePriceInsideZones(
|
||||
cbPZone,
|
||||
analyseState,
|
||||
cBar //
|
||||
);
|
||||
|
||||
//
|
||||
if (hasValeInsideZone &&
|
||||
hasPriceInsideZone &&
|
||||
vPZone.IsBullish() &&
|
||||
cbPZone.IsBullish())
|
||||
{
|
||||
conditions.valePriceZone = cbPZone;
|
||||
}
|
||||
}
|
||||
else if (isBearish)
|
||||
{
|
||||
//
|
||||
XPriceZones pPZone;
|
||||
bool hasPeakInsideZone = CalculatePriceInsideZones(
|
||||
pPZone,
|
||||
analyseState,
|
||||
peak //
|
||||
);
|
||||
|
||||
//
|
||||
XPriceZones cbPZone;
|
||||
bool hasPriceInsideZone = CalculatePriceInsideZones(
|
||||
cbPZone,
|
||||
analyseState,
|
||||
cBar //
|
||||
);
|
||||
|
||||
//
|
||||
if (
|
||||
hasPeakInsideZone &&
|
||||
hasPriceInsideZone &&
|
||||
pPZone.IsBearish() &&
|
||||
cbPZone.IsBearish())
|
||||
{
|
||||
conditions.peakPriceZone = cbPZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
hasPriceZone = conditions.HasPriceZone();
|
||||
result = hasPriceZone;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check for Decision ...
|
||||
bool hasDecision = conditions.HasDecisionZone();
|
||||
if (!hasDecision)
|
||||
{
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XPriceZones pZone;
|
||||
bool hasPZone = CalculatePriceInsideZones(
|
||||
pZone,
|
||||
decisionState,
|
||||
vale //
|
||||
);
|
||||
|
||||
//
|
||||
if (hasPZone &&
|
||||
pZone.IsBullish())
|
||||
{
|
||||
conditions.decisionZone = pZone;
|
||||
}
|
||||
}
|
||||
else if (isBearish)
|
||||
{
|
||||
//
|
||||
XPriceZones pZone;
|
||||
bool hasPZone = CalculatePriceInsideZones(
|
||||
pZone,
|
||||
decisionState,
|
||||
peak //
|
||||
);
|
||||
|
||||
//
|
||||
if (hasPZone &&
|
||||
pZone.IsBearish())
|
||||
{
|
||||
conditions.decisionZone = pZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
hasDecision = conditions.HasDecisionZone();
|
||||
result = hasDecision;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
bool isBullishTested = TestPOIState(
|
||||
drawer,
|
||||
X_DIRECTION_BULLISH,
|
||||
consolidationState,
|
||||
analyseState,
|
||||
decisionState //
|
||||
);
|
||||
|
||||
//
|
||||
result = isBullish ||
|
||||
@@ -1284,79 +813,6 @@ int DrawX121SMCXTWPVSiganl(
|
||||
//
|
||||
bool isBullish = IsBullish(conditions.dir);
|
||||
|
||||
//
|
||||
XCBaseObject *priceZoneObjs[];
|
||||
XCBaseObject *decisionZoneObjs[];
|
||||
XCBaseObject *marketStructureObjs[];
|
||||
|
||||
//
|
||||
bool hasMarketStructure = conditions.HasMarketStrucutre();
|
||||
if (hasMarketStructure)
|
||||
{
|
||||
// //
|
||||
// drawer.DrawMarketStructure(
|
||||
// conditions.analyseMarketStructure,
|
||||
// marketStructureObjs //
|
||||
// );
|
||||
}
|
||||
|
||||
//
|
||||
bool hasPriceZone = conditions.HasPriceZone();
|
||||
if (hasPriceZone)
|
||||
{
|
||||
//
|
||||
XPriceZones pZone;
|
||||
if (isBullish)
|
||||
{
|
||||
pZone = conditions.valePriceZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
pZone = conditions.peakPriceZone;
|
||||
}
|
||||
|
||||
//
|
||||
drawer.DrawPriceZone(
|
||||
pZone,
|
||||
priceZoneObjs,
|
||||
conditions.dir //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
bool hasDecisionZone = conditions.HasDecisionZone();
|
||||
if (hasDecisionZone)
|
||||
{
|
||||
//
|
||||
drawer.DrawPriceZone(
|
||||
conditions.decisionZone,
|
||||
decisionZoneObjs
|
||||
// ,
|
||||
// conditions.dir //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
Copy(
|
||||
priceZoneObjs,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
decisionZoneObjs,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
marketStructureObjs,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
result = ArraySize(drawnObjects);
|
||||
|
||||
|
||||
@@ -61,6 +61,36 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Get Max Allowed Required POI(s) to Find ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int MaxAllowedRequiredPOIs()
|
||||
{
|
||||
return mMaxAllowedRequiredPOIs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Max Allowed Required POI(s) to Find ...
|
||||
*
|
||||
* @param value: number of Required POIs
|
||||
*/
|
||||
void MaxAllowedRequiredPOIs(int value)
|
||||
{
|
||||
//
|
||||
if (value < 10)
|
||||
{
|
||||
value = 10;
|
||||
}
|
||||
|
||||
//
|
||||
mMaxAllowedRequiredPOIs = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Overrides Actions ...
|
||||
|
||||
@@ -488,13 +518,30 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
mVisionCycleHelper,
|
||||
mPOIDrawer //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXTWPVConditions.dir;
|
||||
setupTime = mXTWPVConditions.setupTime;
|
||||
}
|
||||
|
||||
//
|
||||
// if (mXTWPVConditions.HasPriceZone())
|
||||
// {
|
||||
// //
|
||||
// XCBaseObject *objects[];
|
||||
// mPOIDrawer.DrawPriceZone(
|
||||
// mXTWPVConditions.priceZone,
|
||||
// objects //
|
||||
// );
|
||||
|
||||
// //
|
||||
// Print("");
|
||||
// }
|
||||
|
||||
//
|
||||
result = isSetuped;
|
||||
if (!result)
|
||||
{
|
||||
@@ -553,16 +600,17 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
conditions.target = mXTWPVConditions.target;
|
||||
|
||||
//
|
||||
conditions.decisionZones = mXTWPVConditions.decisionZone;
|
||||
conditions.marketStructure = mXTWPVConditions.analyseMarketStructure;
|
||||
if (isBullish)
|
||||
{
|
||||
conditions.priceZones = mXTWPVConditions.valePriceZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
conditions.priceZones = mXTWPVConditions.peakPriceZone;
|
||||
}
|
||||
// TODO: Remove ...
|
||||
// conditions.decisionZones = mXTWPVConditions.decisionZone;
|
||||
// conditions.marketStructure = mXTWPVConditions.analyseMarketStructure;
|
||||
// if (isBullish)
|
||||
// {
|
||||
// conditions.priceZones = mXTWPVConditions.valePriceZone;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// conditions.priceZones = mXTWPVConditions.peakPriceZone;
|
||||
// }
|
||||
|
||||
//
|
||||
mXTWPVConditions.Clean();
|
||||
@@ -577,6 +625,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
int mMaxAllowedRequiredPOIs; // Max Allowed Required POI(s) to Find ...
|
||||
|
||||
/**
|
||||
* Initial Required Indicators Helper ...
|
||||
*/
|
||||
@@ -586,6 +637,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
if (mMaxAllowedRequiredPOIs <= 0)
|
||||
{
|
||||
mMaxAllowedRequiredPOIs = 50;
|
||||
}
|
||||
|
||||
//
|
||||
// Short ...
|
||||
ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period
|
||||
@@ -613,6 +670,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
x121Inputs.Default();
|
||||
|
||||
//
|
||||
x121Inputs.showRSI = false;
|
||||
|
||||
//
|
||||
bool isInited = false;
|
||||
|
||||
@@ -629,6 +689,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
x121Inputs.xpvInputs.hcMethod = hcMethod;
|
||||
x121Inputs.xpvInputs.hcPeriod = hcPeriod;
|
||||
|
||||
//
|
||||
x121Inputs.xpvInputs.showSar = false;
|
||||
x121Inputs.xpvInputs.showPeaks = false;
|
||||
x121Inputs.xpvInputs.showVales = false;
|
||||
|
||||
//
|
||||
// XATR ...
|
||||
x121Inputs.xatrInputs.showATRUpper = false;
|
||||
@@ -636,29 +701,36 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// XSTR ...
|
||||
x121Inputs.xstrInputs.showStr = false;
|
||||
x121Inputs.xstrInputs.showStrUpper = false;
|
||||
x121Inputs.xstrInputs.showStrLower = false;
|
||||
|
||||
//
|
||||
// XDON ...
|
||||
x121Inputs.xdonInputs.showOpen = false;
|
||||
x121Inputs.xdonInputs.showClose = true;
|
||||
x121Inputs.xdonInputs.showClose = false;
|
||||
x121Inputs.xdonInputs.showLow = false;
|
||||
x121Inputs.xdonInputs.showHigh = false;
|
||||
|
||||
//
|
||||
// XVWAP ...
|
||||
x121Inputs.xvwapInputs.showVWapFast = true;
|
||||
x121Inputs.xvwapInputs.showVWapFast = true;
|
||||
x121Inputs.xvwapInputs.showVWapFast = false;
|
||||
x121Inputs.xvwapInputs.showVWapFast = false;
|
||||
x121Inputs.xvwapInputs.showVWapSlow = false;
|
||||
|
||||
//
|
||||
// Initialize Cycle Helpers ...
|
||||
|
||||
//
|
||||
int requiredPOIS = MaxAllowedRequiredPOIs();
|
||||
|
||||
//
|
||||
mTriggerCycleHelper = new XC121SMCCycleHelper();
|
||||
isInited = mTriggerCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M1,
|
||||
x121Inputs //
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -666,7 +738,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
isInited = mDecisionCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M5,
|
||||
x121Inputs //
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -674,7 +747,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
isInited = mAnalyseCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M15,
|
||||
x121Inputs //
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -682,7 +756,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
isInited = mVerificationCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M30,
|
||||
x121Inputs //
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -690,7 +765,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
isInited = mConsolidationCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_H1,
|
||||
x121Inputs //
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -698,7 +774,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
isInited = mVisionCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_H4,
|
||||
x121Inputs //
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user