last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -926,7 +926,13 @@ bool DetectPriceInsideBox(
|
||||
//
|
||||
if (hasPriceInsideOB)
|
||||
{
|
||||
//
|
||||
orderBlock = priceInsideOB;
|
||||
boxDir = priceInsideOB.IsBullish()
|
||||
? X_DIRECTION_BULLISH
|
||||
: priceInsideOB.IsBearish()
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -972,6 +978,7 @@ bool DetectPriceInsideBox(
|
||||
{
|
||||
//
|
||||
// Use Price Inside OB as Box ...
|
||||
box.dir = boxDir;
|
||||
box.to = priceInsideOB.To();
|
||||
box.from = priceInsideOB.From();
|
||||
box.upper = priceInsideOB.Upper();
|
||||
@@ -994,7 +1001,7 @@ bool DetectPriceInsideBox(
|
||||
{
|
||||
//
|
||||
double price = xConditions.valesBuffer[1];
|
||||
ENUM_X_DIRECTION dir = X_DIRECTION_BULLISH;
|
||||
dir = X_DIRECTION_BULLISH;
|
||||
|
||||
//
|
||||
// Bullish FVG ...
|
||||
@@ -1144,7 +1151,7 @@ bool DetectPriceInsideBox(
|
||||
{
|
||||
//
|
||||
double price = xConditions.peaksBuffer[1];
|
||||
ENUM_X_DIRECTION dir = X_DIRECTION_BEARISH;
|
||||
dir = X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
// Bearish FVG ...
|
||||
@@ -1303,6 +1310,13 @@ bool DetectPriceInsideBox(
|
||||
//
|
||||
XBoxZone iBox = boxes[i];
|
||||
|
||||
//
|
||||
// Direction ...
|
||||
if (!HasDirection(box.dir) || box.dir != iBox.dir)
|
||||
{
|
||||
box.dir = iBox.dir;
|
||||
}
|
||||
|
||||
//
|
||||
// Upper ...
|
||||
if (box.upper == 0 || box.upper < iBox.upper)
|
||||
@@ -1336,6 +1350,7 @@ bool DetectPriceInsideBox(
|
||||
{
|
||||
//
|
||||
// Use Price Inside OB as Box ...
|
||||
box.dir = boxDir;
|
||||
box.to = priceInsideOB.To();
|
||||
box.from = priceInsideOB.From();
|
||||
box.upper = priceInsideOB.Upper();
|
||||
|
||||
@@ -56,6 +56,8 @@ struct X121SMCStrategyXHKPVSignalConditions
|
||||
|
||||
//
|
||||
XBoxZone priceBox;
|
||||
bool isPriceOBActed;
|
||||
bool isPriceOBBreaked;
|
||||
XCOrderBlock *priceOB;
|
||||
X121SMCCycleState state;
|
||||
|
||||
@@ -181,6 +183,8 @@ struct X121SMCStrategyXHKPVSignalConditions
|
||||
state.Clean();
|
||||
priceOB = NULL;
|
||||
priceBox.Clean();
|
||||
isPriceOBActed = false;
|
||||
isPriceOBBreaked = false;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -235,9 +239,12 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
conditions.symbol = symbol;
|
||||
conditions.period = period;
|
||||
|
||||
//
|
||||
XC121SMCCycleHelper *barCycle = triggerCycleHelper;
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = decisionCycleHelper.GetBar(
|
||||
result = barCycle.GetBar(
|
||||
zBar,
|
||||
zIndex //
|
||||
);
|
||||
@@ -248,7 +255,7 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = decisionCycleHelper.GetBar(
|
||||
result = barCycle.GetBar(
|
||||
cBar,
|
||||
cIndex //
|
||||
);
|
||||
@@ -259,7 +266,7 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = decisionCycleHelper.GetBar(
|
||||
result = barCycle.GetBar(
|
||||
pBar,
|
||||
pIndex //
|
||||
);
|
||||
@@ -691,6 +698,9 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
// Detect Cycle State ...
|
||||
|
||||
//
|
||||
bool isPriceOBValid = false;
|
||||
bool isBullishHappens = false;
|
||||
bool isBearishHappens = false;
|
||||
bool hasPriceBox = conditions.priceBox.IsValid();
|
||||
bool hasState = visionCycleHelper.GetCycleState(conditions.state);
|
||||
|
||||
@@ -743,7 +753,7 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
|
||||
//
|
||||
// Check Validation Conditions ...
|
||||
bool isPriceOBValid =
|
||||
isPriceOBValid =
|
||||
//
|
||||
hasPriceBox &&
|
||||
(isBullish
|
||||
@@ -751,12 +761,118 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
: isSameCyclePeaks)
|
||||
//
|
||||
;
|
||||
if (isPriceOBValid)
|
||||
|
||||
//
|
||||
// Check Conditions ...
|
||||
|
||||
//
|
||||
X121Conditions xConditions = triggerXConditions;
|
||||
|
||||
//
|
||||
isBullishHappens =
|
||||
//
|
||||
isPriceOBValid &&
|
||||
isCBarBullishFormed &&
|
||||
conditions.priceOB.IsBullish() &&
|
||||
IsBullish(conditions.priceBox.dir) &&
|
||||
//
|
||||
(xConditions.isBreakedUpPrevSar ||
|
||||
xConditions.isBreakedUpPrevStr ||
|
||||
xConditions.isVWapMaxBreakedUp ||
|
||||
xConditions.isBreakedUpPrevCheMax ||
|
||||
xConditions.isBreakedUpPrevAtrLower) &&
|
||||
//
|
||||
(xConditions.isSarSwitchedToBullish ||
|
||||
xConditions.isStrSwitchedToBullish ||
|
||||
xConditions.isCheSwitchedToBullish ||
|
||||
xConditions.isVWapSwitchedToBullishState ||
|
||||
xConditions.isVWapSwitchedToBullishOrdered)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
isBearishHappens =
|
||||
//
|
||||
isPriceOBValid &&
|
||||
isCBarBearishFormed &&
|
||||
conditions.priceOB.IsBearish() &&
|
||||
IsBearish(conditions.priceBox.dir) &&
|
||||
//
|
||||
(xConditions.isBreakedDownPrevSar ||
|
||||
xConditions.isBreakedDownPrevStr ||
|
||||
xConditions.isVWapMinBreakedDown ||
|
||||
xConditions.isBreakedDownPrevCheMin ||
|
||||
xConditions.isBreakedDownPrevAtrUpper) &&
|
||||
//
|
||||
(xConditions.isSarSwitchedToBearish ||
|
||||
xConditions.isStrSwitchedToBearish ||
|
||||
xConditions.isCheSwitchedToBearish ||
|
||||
xConditions.isVWapSwitchedToBearishState ||
|
||||
xConditions.isVWapSwitchedToBearishOrdered)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (!conditions.isPriceOBActed)
|
||||
{
|
||||
Print("Valid Conditions ...");
|
||||
conditions.isPriceOBActed = isBullishHappens ||
|
||||
isBearishHappens;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Accumulation ...
|
||||
if (conditions.isPriceOBActed)
|
||||
{
|
||||
//
|
||||
// Checking OB Breake on Side ...
|
||||
if (!conditions.isPriceOBBreaked)
|
||||
{
|
||||
//
|
||||
conditions.isPriceOBBreaked =
|
||||
conditions.priceOB.IsBullish()
|
||||
? (cBar.low < conditions.priceOB.Upper() &&
|
||||
cBar.high > conditions.priceOB.Upper() &&
|
||||
cBar.close > conditions.priceOB.Upper())
|
||||
//
|
||||
||
|
||||
//
|
||||
(pBar.high < conditions.priceOB.Upper() &&
|
||||
cBar.low > conditions.priceOB.Upper() &&
|
||||
cBar.open > conditions.priceOB.Upper())
|
||||
: (cBar.high > conditions.priceOB.Lower() &&
|
||||
cBar.low < conditions.priceOB.Lower() &&
|
||||
cBar.close < conditions.priceOB.Lower())
|
||||
//
|
||||
||
|
||||
//
|
||||
(pBar.low > conditions.priceOB.Lower() &&
|
||||
cBar.high < conditions.priceOB.Lower() &&
|
||||
cBar.open < conditions.priceOB.Lower());
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Distribution ...
|
||||
bool isPriceOBUpperBrekedUp = false;
|
||||
bool isPriceOBLowerBrekedDown = false;
|
||||
if (conditions.isPriceOBBreaked)
|
||||
{
|
||||
//
|
||||
isPriceOBUpperBrekedUp = IsBarBreak(
|
||||
conditions.priceOB.Upper(),
|
||||
X_DIRECTION_BULLISH,
|
||||
cBar //
|
||||
);
|
||||
|
||||
//
|
||||
isPriceOBLowerBrekedDown = IsBarBreak(
|
||||
conditions.priceOB.Lower(),
|
||||
X_DIRECTION_BEARISH,
|
||||
cBar //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw ...
|
||||
XCBaseObject *drawnObjects[];
|
||||
@@ -853,12 +969,6 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (IsValidSize(drawnObjectsCount))
|
||||
{
|
||||
Print("Drawn Objects ...");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -866,21 +976,24 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
//
|
||||
// Summarize Conditions ...
|
||||
|
||||
//
|
||||
X121Conditions xConditions = triggerXConditions;
|
||||
|
||||
//
|
||||
bool isCondition1Bullish =
|
||||
//
|
||||
isCBarBullishFormed &&
|
||||
//
|
||||
false
|
||||
isPriceOBUpperBrekedUp &&
|
||||
conditions.isPriceOBBreaked &&
|
||||
conditions.priceOB.IsBearish()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isCondition1Bearish =
|
||||
//
|
||||
isCBarBearishFormed &&
|
||||
//
|
||||
false
|
||||
isPriceOBLowerBrekedDown &&
|
||||
conditions.isPriceOBBreaked &&
|
||||
conditions.priceOB.IsBullish()
|
||||
//
|
||||
;
|
||||
|
||||
@@ -901,11 +1014,18 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
pzDir //
|
||||
);
|
||||
|
||||
//
|
||||
double longPivot = conditions.priceOB.Lower(); // triggerXConditions.valesBuffer[1];
|
||||
double shortPivot = conditions.priceOB.Upper(); // triggerXConditions.peaksBuffer[1];
|
||||
|
||||
//
|
||||
// Manipulate Conditions Point ...
|
||||
|
||||
//
|
||||
conditions.point = point;
|
||||
conditions.point =
|
||||
isCondition1Bullish
|
||||
? shortPivot
|
||||
: longPivot;
|
||||
|
||||
//
|
||||
// Manipulate Conditions Pivot ...
|
||||
@@ -913,8 +1033,8 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
//
|
||||
conditions.pivot =
|
||||
isCondition1Bullish
|
||||
? triggerXConditions.valesBuffer[1]
|
||||
: triggerXConditions.peaksBuffer[1];
|
||||
? longPivot
|
||||
: shortPivot;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1108,7 +1228,7 @@ bool DetectX121SMCXHKPVSignalTrigger(
|
||||
|
||||
//
|
||||
// Cycle X121Conditions ...
|
||||
X121Conditions decisionXHKPVConditions = decisionConditions.x121Conditions;
|
||||
X121Conditions decisionXConditions = decisionConditions.x121Conditions;
|
||||
|
||||
//
|
||||
// Trigger Conditions ...
|
||||
@@ -1117,22 +1237,22 @@ bool DetectX121SMCXHKPVSignalTrigger(
|
||||
// Slopes ...
|
||||
|
||||
//
|
||||
bool isRsiSlopeBullish = decisionXHKPVConditions.isRsiSlopeBullish;
|
||||
bool isStrSlopeBullish = decisionXHKPVConditions.isStrSlopeBullish;
|
||||
bool isAtrUpperSlopeBullish = decisionXHKPVConditions.isAtrUpperSlopeBullish;
|
||||
bool isAtrLowerSlopeBullish = decisionXHKPVConditions.isAtrLowerSlopeBullish;
|
||||
bool isVwapFastSlopeBullish = decisionXHKPVConditions.isVwapFastSlopeBullish;
|
||||
bool isVwapMidSlopeBullish = decisionXHKPVConditions.isVwapMidSlopeBullish;
|
||||
bool isVwapSlowSlopeBullish = decisionXHKPVConditions.isVwapSlowSlopeBullish;
|
||||
bool isRsiSlopeBullish = decisionXConditions.isRsiSlopeBullish;
|
||||
bool isStrSlopeBullish = decisionXConditions.isStrSlopeBullish;
|
||||
bool isAtrUpperSlopeBullish = decisionXConditions.isAtrUpperSlopeBullish;
|
||||
bool isAtrLowerSlopeBullish = decisionXConditions.isAtrLowerSlopeBullish;
|
||||
bool isVwapFastSlopeBullish = decisionXConditions.isVwapFastSlopeBullish;
|
||||
bool isVwapMidSlopeBullish = decisionXConditions.isVwapMidSlopeBullish;
|
||||
bool isVwapSlowSlopeBullish = decisionXConditions.isVwapSlowSlopeBullish;
|
||||
|
||||
//
|
||||
bool isRsiSlopeBearish = decisionXHKPVConditions.isRsiSlopeBearish;
|
||||
bool isStrSlopeBearish = decisionXHKPVConditions.isStrSlopeBearish;
|
||||
bool isAtrUpperSlopeBearish = decisionXHKPVConditions.isAtrUpperSlopeBearish;
|
||||
bool isAtrLowerSlopeBearish = decisionXHKPVConditions.isAtrLowerSlopeBearish;
|
||||
bool isVwapFastSlopeBearish = decisionXHKPVConditions.isVwapFastSlopeBearish;
|
||||
bool isVwapMidSlopeBearish = decisionXHKPVConditions.isVwapMidSlopeBearish;
|
||||
bool isVwapSlowSlopeBearish = decisionXHKPVConditions.isVwapSlowSlopeBearish;
|
||||
bool isRsiSlopeBearish = decisionXConditions.isRsiSlopeBearish;
|
||||
bool isStrSlopeBearish = decisionXConditions.isStrSlopeBearish;
|
||||
bool isAtrUpperSlopeBearish = decisionXConditions.isAtrUpperSlopeBearish;
|
||||
bool isAtrLowerSlopeBearish = decisionXConditions.isAtrLowerSlopeBearish;
|
||||
bool isVwapFastSlopeBearish = decisionXConditions.isVwapFastSlopeBearish;
|
||||
bool isVwapMidSlopeBearish = decisionXConditions.isVwapMidSlopeBearish;
|
||||
bool isVwapSlowSlopeBearish = decisionXConditions.isVwapSlowSlopeBearish;
|
||||
|
||||
//
|
||||
bool isSlopesBullish =
|
||||
@@ -1168,18 +1288,18 @@ bool DetectX121SMCXHKPVSignalTrigger(
|
||||
//
|
||||
isBullish =
|
||||
//
|
||||
isBullish // &&
|
||||
// isPointBreaked &&
|
||||
// isSlopesBullish
|
||||
isBullish &&
|
||||
isPointBreaked &&
|
||||
isSlopesBullish
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
isBearish =
|
||||
//
|
||||
isBearish // &&
|
||||
// isPointBreaked &&
|
||||
// isSlopesBearish
|
||||
isBearish &&
|
||||
isPointBreaked &&
|
||||
isSlopesBearish
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1224,7 +1344,7 @@ bool DetectX121SMCXHKPVSignalTrigger(
|
||||
);
|
||||
|
||||
//
|
||||
double iAtr = 0; // decisionConditions.x121Conditions.atrBuffer[1];
|
||||
double iAtr = decisionConditions.x121Conditions.atrBuffer[1];
|
||||
iAtr *= 1.5;
|
||||
|
||||
//
|
||||
|
||||
@@ -55,8 +55,9 @@ struct X121SMCStrategyXOBPVSignalConditions
|
||||
double point;
|
||||
|
||||
//
|
||||
XCOrderBlock *bullishOBs[];
|
||||
XCOrderBlock *bearishOBs[];
|
||||
XBoxZone priceBox;
|
||||
XCOrderBlock *priceOB;
|
||||
X121SMCCycleState state;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -177,34 +178,9 @@ struct X121SMCStrategyXOBPVSignalConditions
|
||||
point = 0;
|
||||
|
||||
//
|
||||
Clean(bullishOBs);
|
||||
Clean(bearishOBs);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
int CountBullishOBs()
|
||||
{
|
||||
return ArraySize(bullishOBs);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBullishOBs()
|
||||
{
|
||||
return IsValidSize(CountBullishOBs());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBearishOBs()
|
||||
{
|
||||
return ArraySize(bearishOBs);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBearishOBs()
|
||||
{
|
||||
return IsValidSize(CountBearishOBs());
|
||||
state.Clean();
|
||||
priceOB = NULL;
|
||||
priceBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -259,9 +235,12 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
conditions.symbol = symbol;
|
||||
conditions.period = period;
|
||||
|
||||
//
|
||||
XC121SMCCycleHelper *barCycle = triggerCycleHelper;
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = decisionCycleHelper.GetBar(
|
||||
result = barCycle.GetBar(
|
||||
zBar,
|
||||
zIndex //
|
||||
);
|
||||
@@ -272,7 +251,7 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = decisionCycleHelper.GetBar(
|
||||
result = barCycle.GetBar(
|
||||
cBar,
|
||||
cIndex //
|
||||
);
|
||||
@@ -283,7 +262,7 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = decisionCycleHelper.GetBar(
|
||||
result = barCycle.GetBar(
|
||||
pBar,
|
||||
pIndex //
|
||||
);
|
||||
@@ -421,12 +400,12 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
|
||||
//
|
||||
// Cycle X121Conditions ...
|
||||
X121Conditions triggerXOBPVConditions = triggerConditions.x121Conditions;
|
||||
X121Conditions decisionXOBPVConditions = decisionConditions.x121Conditions;
|
||||
X121Conditions analyseXOBPVConditions = analyseConditions.x121Conditions;
|
||||
X121Conditions verificationXOBPVConditions = verificationConditions.x121Conditions;
|
||||
X121Conditions consolidationXOBPVConditions = consolidationConditions.x121Conditions;
|
||||
X121Conditions visionXOBPVConditions = visionConditions.x121Conditions;
|
||||
X121Conditions triggerXConditions = triggerConditions.x121Conditions;
|
||||
X121Conditions decisionXConditions = decisionConditions.x121Conditions;
|
||||
X121Conditions analyseXConditions = analyseConditions.x121Conditions;
|
||||
X121Conditions verificationXConditions = verificationConditions.x121Conditions;
|
||||
X121Conditions consolidationXConditions = consolidationConditions.x121Conditions;
|
||||
X121Conditions visionXConditions = visionConditions.x121Conditions;
|
||||
|
||||
//
|
||||
// Setup Conditions ...
|
||||
@@ -712,287 +691,110 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
;
|
||||
|
||||
//
|
||||
// Detect Order Block ...
|
||||
// Detect Cycle State ...
|
||||
|
||||
//
|
||||
bool hasBullishOrderBlocks = conditions.HasBullishOBs();
|
||||
int bullishOrderBlocksCount = conditions.CountBullishOBs();
|
||||
bool isPriceOBValid = false;
|
||||
bool hasPriceBox = conditions.priceBox.IsValid();
|
||||
bool hasState = visionCycleHelper.GetCycleState(conditions.state);
|
||||
|
||||
//
|
||||
bool hasBearishOrderBlocks = conditions.HasBearishOBs();
|
||||
int bearishOrderBlocksCount = conditions.CountBearishOBs();
|
||||
|
||||
//
|
||||
bool hasOrderBlocks = hasBullishOrderBlocks &&
|
||||
hasBearishOrderBlocks;
|
||||
if (!hasOrderBlocks)
|
||||
// Detect Price Box if not Provided ...
|
||||
if (hasState &&
|
||||
!hasPriceBox)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *bullishOBs[];
|
||||
XCOrderBlock *bearishOBs[];
|
||||
bool hasOrderBlocks = visionCycleHelper.DetectOrderBlocks(
|
||||
bullishOBs,
|
||||
bearishOBs //
|
||||
hasPriceBox = DetectPriceInsideBox(
|
||||
conditions.priceBox,
|
||||
conditions.priceOB,
|
||||
decisionXConditions,
|
||||
conditions.state //
|
||||
);
|
||||
|
||||
//
|
||||
if (!hasBullishOrderBlocks)
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
bullishOBs,
|
||||
conditions.bullishOBs //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
if (!hasBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
bearishOBs,
|
||||
conditions.bearishOBs //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
hasBullishOrderBlocks = conditions.HasBullishOBs();
|
||||
bullishOrderBlocksCount = conditions.CountBullishOBs();
|
||||
|
||||
//
|
||||
hasBearishOrderBlocks = conditions.HasBearishOBs();
|
||||
bearishOrderBlocksCount = conditions.CountBearishOBs();
|
||||
}
|
||||
|
||||
//
|
||||
bool hasOldestBullishOB = false;
|
||||
bool hasYoungestBullishOB = false;
|
||||
XCOrderBlock *oldestBullishOB = NULL;
|
||||
XCOrderBlock *youngestBullishOB = NULL;
|
||||
if (hasBullishOrderBlocks)
|
||||
if (hasPriceBox)
|
||||
{
|
||||
//
|
||||
XCZone *zones[];
|
||||
bool isConverted = ToZone(
|
||||
conditions.bullishOBs,
|
||||
zones //
|
||||
);
|
||||
// Update Price Box Date ...
|
||||
conditions.priceOB.To(cTime);
|
||||
conditions.priceBox.to = cTime;
|
||||
|
||||
//
|
||||
int oldestIDX = GetOldest(zones);
|
||||
hasOldestBullishOB = IsValidIndex(oldestIDX);
|
||||
if (hasOldestBullishOB)
|
||||
{
|
||||
oldestBullishOB = conditions.bullishOBs[oldestIDX];
|
||||
}
|
||||
// Here We Can Validate Box by Same Cycles Peaks and Vales ...
|
||||
bool isBullish = IsBullish(conditions.priceBox.dir);
|
||||
|
||||
//
|
||||
int youngestIDX = GetYoungest(zones);
|
||||
hasYoungestBullishOB = IsValidIndex(youngestIDX);
|
||||
if (hasYoungestBullishOB)
|
||||
{
|
||||
youngestBullishOB = conditions.bullishOBs[youngestIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasOldestBearishOB = false;
|
||||
bool hasYoungestBearishOB = false;
|
||||
XCOrderBlock *oldestBearishOB = NULL;
|
||||
XCOrderBlock *youngestBearishOB = NULL;
|
||||
if (hasBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
XCZone *zones[];
|
||||
bool isConverted = ToZone(
|
||||
conditions.bearishOBs,
|
||||
zones //
|
||||
);
|
||||
int cIDX = 1;
|
||||
|
||||
//
|
||||
int oldestIDX = GetOldest(zones);
|
||||
hasOldestBearishOB = IsValidIndex(oldestIDX);
|
||||
if (hasOldestBearishOB)
|
||||
{
|
||||
oldestBearishOB = conditions.bearishOBs[oldestIDX];
|
||||
}
|
||||
|
||||
//
|
||||
int youngestIDX = GetYoungest(zones);
|
||||
hasYoungestBearishOB = IsValidIndex(youngestIDX);
|
||||
if (hasYoungestBearishOB)
|
||||
{
|
||||
youngestBearishOB = conditions.bearishOBs[youngestIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasPriceInsideOB = false;
|
||||
XCOrderBlock *priceInsideOB = NULL;
|
||||
|
||||
//
|
||||
if (!hasPriceInsideOB &&
|
||||
hasBullishOrderBlocks)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < bullishOrderBlocksCount; i++)
|
||||
{
|
||||
bool isSameCyclePeaks =
|
||||
//
|
||||
XCOrderBlock *iOb = conditions.bullishOBs[i];
|
||||
|
||||
triggerXConditions.peaksBuffer[cIDX] == decisionXConditions.peaksBuffer[cIDX] &&
|
||||
decisionXConditions.peaksBuffer[cIDX] == analyseXConditions.peaksBuffer[cIDX] &&
|
||||
analyseXConditions.peaksBuffer[cIDX] == verificationXConditions.peaksBuffer[cIDX]
|
||||
//
|
||||
bool isInside = IsPriceInsideZone(
|
||||
decisionXOBPVConditions.valesBuffer[1],
|
||||
(XCZone *)iOb //
|
||||
);
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
hasPriceInsideOB = true;
|
||||
priceInsideOB = iOb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (!hasPriceInsideOB &&
|
||||
hasBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < bearishOrderBlocksCount; i++)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOb = conditions.bearishOBs[i];
|
||||
|
||||
//
|
||||
bool isInside = IsPriceInsideZone(
|
||||
decisionXOBPVConditions.peaksBuffer[1],
|
||||
(XCZone *)iOb //
|
||||
);
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
hasPriceInsideOB = true;
|
||||
priceInsideOB = iOb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
XStateZones obState;
|
||||
bool hasOBState = false;
|
||||
XOHCL priceInsideOBBreakerBar;
|
||||
if (hasPriceInsideOB)
|
||||
{
|
||||
//
|
||||
XOHCL toBar;
|
||||
XOHCL fromBar;
|
||||
ENUM_X_DIRECTION forDir =
|
||||
priceInsideOB.IsBullish()
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
bool hasBreakerBar = HasBreakerBar(
|
||||
toBar,
|
||||
fromBar,
|
||||
priceInsideOBBreakerBar,
|
||||
forDir,
|
||||
priceInsideOB.GetSymbol(),
|
||||
priceInsideOB.GetPeriod(),
|
||||
priceInsideOB.Upper(),
|
||||
priceInsideOB.Lower(),
|
||||
priceInsideOB.From(),
|
||||
priceInsideOB.To() //
|
||||
);
|
||||
if (hasBreakerBar)
|
||||
{
|
||||
//
|
||||
CalculateStateZones(
|
||||
obState,
|
||||
consolidationState,
|
||||
priceInsideOB.Upper(),
|
||||
priceInsideOB.Lower(),
|
||||
priceInsideOBBreakerBar.time //
|
||||
);
|
||||
}
|
||||
;
|
||||
|
||||
//
|
||||
hasOBState = obState.IsValid();
|
||||
}
|
||||
bool isSameCycleVales =
|
||||
//
|
||||
triggerXConditions.valesBuffer[cIDX] == decisionXConditions.valesBuffer[cIDX] &&
|
||||
decisionXConditions.valesBuffer[cIDX] == analyseXConditions.valesBuffer[cIDX] &&
|
||||
analyseXConditions.valesBuffer[cIDX] == verificationXConditions.valesBuffer[cIDX]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// DRAW ...
|
||||
//
|
||||
//
|
||||
// Check Validation Conditions ...
|
||||
isPriceOBValid =
|
||||
//
|
||||
hasPriceBox &&
|
||||
(isBullish
|
||||
? isSameCycleVales
|
||||
: isSameCyclePeaks)
|
||||
//
|
||||
;
|
||||
}
|
||||
|
||||
// //
|
||||
// // Draw ...
|
||||
// XCBaseObject *drawnObjects[];
|
||||
// int drawnObjectsCount = visionCycleHelper.DrawCycleState(
|
||||
// conditions.state,
|
||||
// drawnObjects //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (hasBullishOrderBlocks)
|
||||
// if (hasPriceBox)
|
||||
// {
|
||||
// //
|
||||
// for (int i = 0; i < bullishOrderBlocksCount; i++)
|
||||
// bool isBullish = IsBullish(conditions.priceBox.dir);
|
||||
// color boxColor = isBullish ? clrYellow : clrOrange;
|
||||
|
||||
// //
|
||||
// XCBoxObject *iObj;
|
||||
// bool isCreated = visionCycleHelper.mPOIDrawer.CreateBox(
|
||||
// conditions.priceBox,
|
||||
// iObj,
|
||||
// boxColor,
|
||||
// 1,
|
||||
// false,
|
||||
// STYLE_DASHDOTDOT //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// XCOrderBlock *iOb = conditions.bullishOBs[i];
|
||||
|
||||
// //
|
||||
// XCBullishOrderBlockObject *iObObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBullishOrderBlock(
|
||||
// iOb,
|
||||
// iObObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// Add(
|
||||
// (XCBaseObject *)iObObj,
|
||||
// drawnObjects //
|
||||
// );
|
||||
// }
|
||||
// Add(
|
||||
// (XCBaseObject *)iObj,
|
||||
// drawnObjects //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasBearishOrderBlocks)
|
||||
// {
|
||||
// //
|
||||
// for (int i = 0; i < bearishOrderBlocksCount; i++)
|
||||
// {
|
||||
// //
|
||||
// XCOrderBlock *iOb = conditions.bearishOBs[i];
|
||||
|
||||
// //
|
||||
// XCBearishOrderBlockObject *iObObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBearishOrderBlock(
|
||||
// iOb,
|
||||
// iObObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// Add(
|
||||
// (XCBaseObject *)iObObj,
|
||||
// drawnObjects //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasPriceInsideOB)
|
||||
// {
|
||||
// //
|
||||
// bool isBullish = priceInsideOB.IsBullish();
|
||||
|
||||
// //
|
||||
// bool isCreated = false;
|
||||
// XCBaseObject *priceInsideOBObj = NULL;
|
||||
// XCBaseObject *priceOBObj = NULL;
|
||||
// if (isBullish)
|
||||
// {
|
||||
// //
|
||||
@@ -1000,16 +802,20 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
// isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBullishOrderBlock(
|
||||
// priceInsideOB,
|
||||
// conditions.priceOB,
|
||||
// iObj //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// iObj.ZoneColor(clrYellow);
|
||||
// iObj.ZoneWidth(2);
|
||||
// iObj.ZoneColor(boxColor);
|
||||
// iObj.ZoneStyle(STYLE_SOLID);
|
||||
|
||||
// //
|
||||
// priceInsideOBObj = (XCBaseObject *)iObj;
|
||||
// priceOBObj = (XCBaseObject *)iObj;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
@@ -1019,16 +825,20 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
// isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBearishOrderBlock(
|
||||
// priceInsideOB,
|
||||
// conditions.priceOB,
|
||||
// iObj //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// iObj.ZoneColor(clrOrange);
|
||||
// iObj.ZoneWidth(2);
|
||||
// iObj.ZoneColor(boxColor);
|
||||
// iObj.ZoneStyle(STYLE_SOLID);
|
||||
|
||||
// //
|
||||
// priceInsideOBObj = (XCBaseObject *)iObj;
|
||||
// priceOBObj = (XCBaseObject *)iObj;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1037,109 +847,17 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
// {
|
||||
// //
|
||||
// Add(
|
||||
// priceInsideOBObj,
|
||||
// priceOBObj,
|
||||
// drawnObjects //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// if (hasOldestBullishOB)
|
||||
// {
|
||||
// //
|
||||
// XCBullishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBullishOrderBlock(
|
||||
// oldestBullishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasYoungestBullishOB)
|
||||
// if (IsValidSize(drawnObjectsCount))
|
||||
// {
|
||||
// //
|
||||
// XCBullishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBullishOrderBlock(
|
||||
// youngestBullishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasOldestBearishOB)
|
||||
// {
|
||||
// //
|
||||
// XCBearishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBearishOrderBlock(
|
||||
// oldestBearishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasYoungestBearishOB)
|
||||
// {
|
||||
// //
|
||||
// XCBearishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBearishOrderBlock(
|
||||
// youngestBearishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
bool isSameCyclesPeak =
|
||||
//
|
||||
triggerXOBPVConditions.peaksBuffer[1] == decisionXOBPVConditions.peaksBuffer[1] &&
|
||||
decisionXOBPVConditions.peaksBuffer[1] == analyseXOBPVConditions.peaksBuffer[1] &&
|
||||
analyseXOBPVConditions.peaksBuffer[1] == verificationXOBPVConditions.peaksBuffer[1]
|
||||
// &&
|
||||
// verificationXOBPVConditions.peaksBuffer[1] == consolidationXOBPVConditions.peaksBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isSameCyclesVale =
|
||||
//
|
||||
triggerXOBPVConditions.valesBuffer[1] == decisionXOBPVConditions.valesBuffer[1] &&
|
||||
decisionXOBPVConditions.valesBuffer[1] == analyseXOBPVConditions.valesBuffer[1] &&
|
||||
analyseXOBPVConditions.valesBuffer[1] == verificationXOBPVConditions.valesBuffer[1]
|
||||
// &&
|
||||
// verificationXOBPVConditions.valesBuffer[1] == consolidationXOBPVConditions.valesBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool hasSameCyclesPV =
|
||||
// hasOBState &&
|
||||
hasPriceInsideOB &&
|
||||
(isSameCyclesPeak ||
|
||||
isSameCyclesVale);
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -1147,45 +865,50 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
//
|
||||
// Summarize Conditions ...
|
||||
|
||||
//
|
||||
X121Conditions xConditions = triggerXConditions;
|
||||
|
||||
//
|
||||
bool isCondition1Bullish =
|
||||
//
|
||||
hasSameCyclesPV &&
|
||||
isPriceOBValid &&
|
||||
isCBarBullishFormed &&
|
||||
priceInsideOB.IsBullish() &&
|
||||
conditions.priceOB.IsBullish() &&
|
||||
IsBullish(conditions.priceBox.dir) &&
|
||||
//
|
||||
(decisionXOBPVConditions.isBreakedUpPrevSar ||
|
||||
decisionXOBPVConditions.isBreakedUpPrevStr ||
|
||||
decisionXOBPVConditions.isVWapMaxBreakedUp ||
|
||||
decisionXOBPVConditions.isBreakedUpPrevCheMax ||
|
||||
decisionXOBPVConditions.isBreakedUpPrevAtrLower) &&
|
||||
(xConditions.isBreakedUpPrevSar ||
|
||||
xConditions.isBreakedUpPrevStr ||
|
||||
xConditions.isVWapMaxBreakedUp ||
|
||||
xConditions.isBreakedUpPrevCheMax ||
|
||||
xConditions.isBreakedUpPrevAtrLower) &&
|
||||
//
|
||||
(decisionXOBPVConditions.isSarSwitchedToBullish ||
|
||||
decisionXOBPVConditions.isStrSwitchedToBullish ||
|
||||
decisionXOBPVConditions.isCheSwitchedToBullish ||
|
||||
decisionXOBPVConditions.isVWapSwitchedToBullishState ||
|
||||
decisionXOBPVConditions.isVWapSwitchedToBullishOrdered)
|
||||
(xConditions.isSarSwitchedToBullish ||
|
||||
xConditions.isStrSwitchedToBullish ||
|
||||
xConditions.isCheSwitchedToBullish ||
|
||||
xConditions.isVWapSwitchedToBullishState ||
|
||||
xConditions.isVWapSwitchedToBullishOrdered)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isCondition1Bearish =
|
||||
//
|
||||
hasSameCyclesPV &&
|
||||
isPriceOBValid &&
|
||||
isCBarBearishFormed &&
|
||||
priceInsideOB.IsBearish() &&
|
||||
conditions.priceOB.IsBearish() &&
|
||||
IsBearish(conditions.priceBox.dir) &&
|
||||
//
|
||||
(decisionXOBPVConditions.isBreakedDownPrevSar ||
|
||||
decisionXOBPVConditions.isBreakedDownPrevStr ||
|
||||
decisionXOBPVConditions.isVWapMinBreakedDown ||
|
||||
decisionXOBPVConditions.isBreakedDownPrevCheMin ||
|
||||
decisionXOBPVConditions.isBreakedDownPrevAtrUpper) &&
|
||||
(xConditions.isBreakedDownPrevSar ||
|
||||
xConditions.isBreakedDownPrevStr ||
|
||||
xConditions.isVWapMinBreakedDown ||
|
||||
xConditions.isBreakedDownPrevCheMin ||
|
||||
xConditions.isBreakedDownPrevAtrUpper) &&
|
||||
//
|
||||
(decisionXOBPVConditions.isSarSwitchedToBearish ||
|
||||
decisionXOBPVConditions.isStrSwitchedToBearish ||
|
||||
decisionXOBPVConditions.isCheSwitchedToBearish ||
|
||||
decisionXOBPVConditions.isVWapSwitchedToBearishState ||
|
||||
decisionXOBPVConditions.isVWapSwitchedToBearishOrdered)
|
||||
(xConditions.isSarSwitchedToBearish ||
|
||||
xConditions.isStrSwitchedToBearish ||
|
||||
xConditions.isCheSwitchedToBearish ||
|
||||
xConditions.isVWapSwitchedToBearishState ||
|
||||
xConditions.isVWapSwitchedToBearishOrdered)
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1214,12 +937,14 @@ bool DetectX121SMCXOBPVSignalSetup(
|
||||
|
||||
//
|
||||
// Manipulate Conditions Pivot ...
|
||||
double longPivot = triggerXConditions.valesBuffer[1]; // conditions.priceOB.Lower();
|
||||
double shortPivot = triggerXConditions.peaksBuffer[1]; // conditions.priceOB.Upper();
|
||||
|
||||
//
|
||||
conditions.pivot =
|
||||
isCondition1Bullish
|
||||
? priceInsideOB.Upper()
|
||||
: priceInsideOB.Lower();
|
||||
? longPivot
|
||||
: shortPivot;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1413,7 +1138,7 @@ bool DetectX121SMCXOBPVSignalTrigger(
|
||||
|
||||
//
|
||||
// Cycle X121Conditions ...
|
||||
X121Conditions decisionXOBPVConditions = decisionConditions.x121Conditions;
|
||||
X121Conditions decisionXConditions = decisionConditions.x121Conditions;
|
||||
|
||||
//
|
||||
// Trigger Conditions ...
|
||||
@@ -1422,22 +1147,22 @@ bool DetectX121SMCXOBPVSignalTrigger(
|
||||
// Slopes ...
|
||||
|
||||
//
|
||||
bool isRsiSlopeBullish = decisionXOBPVConditions.isRsiSlopeBullish;
|
||||
bool isStrSlopeBullish = decisionXOBPVConditions.isStrSlopeBullish;
|
||||
bool isAtrUpperSlopeBullish = decisionXOBPVConditions.isAtrUpperSlopeBullish;
|
||||
bool isAtrLowerSlopeBullish = decisionXOBPVConditions.isAtrLowerSlopeBullish;
|
||||
bool isVwapFastSlopeBullish = decisionXOBPVConditions.isVwapFastSlopeBullish;
|
||||
bool isVwapMidSlopeBullish = decisionXOBPVConditions.isVwapMidSlopeBullish;
|
||||
bool isVwapSlowSlopeBullish = decisionXOBPVConditions.isVwapSlowSlopeBullish;
|
||||
bool isRsiSlopeBullish = decisionXConditions.isRsiSlopeBullish;
|
||||
bool isStrSlopeBullish = decisionXConditions.isStrSlopeBullish;
|
||||
bool isAtrUpperSlopeBullish = decisionXConditions.isAtrUpperSlopeBullish;
|
||||
bool isAtrLowerSlopeBullish = decisionXConditions.isAtrLowerSlopeBullish;
|
||||
bool isVwapFastSlopeBullish = decisionXConditions.isVwapFastSlopeBullish;
|
||||
bool isVwapMidSlopeBullish = decisionXConditions.isVwapMidSlopeBullish;
|
||||
bool isVwapSlowSlopeBullish = decisionXConditions.isVwapSlowSlopeBullish;
|
||||
|
||||
//
|
||||
bool isRsiSlopeBearish = decisionXOBPVConditions.isRsiSlopeBearish;
|
||||
bool isStrSlopeBearish = decisionXOBPVConditions.isStrSlopeBearish;
|
||||
bool isAtrUpperSlopeBearish = decisionXOBPVConditions.isAtrUpperSlopeBearish;
|
||||
bool isAtrLowerSlopeBearish = decisionXOBPVConditions.isAtrLowerSlopeBearish;
|
||||
bool isVwapFastSlopeBearish = decisionXOBPVConditions.isVwapFastSlopeBearish;
|
||||
bool isVwapMidSlopeBearish = decisionXOBPVConditions.isVwapMidSlopeBearish;
|
||||
bool isVwapSlowSlopeBearish = decisionXOBPVConditions.isVwapSlowSlopeBearish;
|
||||
bool isRsiSlopeBearish = decisionXConditions.isRsiSlopeBearish;
|
||||
bool isStrSlopeBearish = decisionXConditions.isStrSlopeBearish;
|
||||
bool isAtrUpperSlopeBearish = decisionXConditions.isAtrUpperSlopeBearish;
|
||||
bool isAtrLowerSlopeBearish = decisionXConditions.isAtrLowerSlopeBearish;
|
||||
bool isVwapFastSlopeBearish = decisionXConditions.isVwapFastSlopeBearish;
|
||||
bool isVwapMidSlopeBearish = decisionXConditions.isVwapMidSlopeBearish;
|
||||
bool isVwapSlowSlopeBearish = decisionXConditions.isVwapSlowSlopeBearish;
|
||||
|
||||
//
|
||||
bool isSlopesBullish =
|
||||
|
||||
Reference in New Issue
Block a user