prepare for test ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,111 @@
|
|||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| BOS_CHOCH.mq5|
|
||||||
|
//| Copyright 2023, MetaQuotes Software Corp. |
|
||||||
|
//| https://www.mql5.com |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
#property copyright "Copyright 2023, MetaQuotes Software Corp."
|
||||||
|
#property link "https://www.mql5.com"
|
||||||
|
#property version "1.00"
|
||||||
|
#property indicator_chart_window
|
||||||
|
#property indicator_buffers 2
|
||||||
|
#property indicator_plots 2
|
||||||
|
#property indicator_color1 clrGreen
|
||||||
|
#property indicator_color2 clrRed
|
||||||
|
#property indicator_width1 2
|
||||||
|
#property indicator_width2 2
|
||||||
|
|
||||||
|
// Indicator Buffers
|
||||||
|
double BOSBuffer[];
|
||||||
|
double CHOCHBuffer[];
|
||||||
|
|
||||||
|
// Input parameters
|
||||||
|
input int lookbackPeriod = 50; // Number of candles to look back for structure analysis
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Custom indicator initialization function |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
int OnInit()
|
||||||
|
{
|
||||||
|
// Set up indicator buffers
|
||||||
|
SetIndexBuffer(0, BOSBuffer, INDICATOR_DATA);
|
||||||
|
SetIndexBuffer(1, CHOCHBuffer, INDICATOR_DATA);
|
||||||
|
|
||||||
|
// Set up indicator labels
|
||||||
|
IndicatorSetString(INDICATOR_SHORTNAME, "BOS & CHOCH Detector");
|
||||||
|
IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
|
||||||
|
|
||||||
|
return(INIT_SUCCEEDED);
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Custom indicator iteration function |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
int OnCalculate(const int rates_total,
|
||||||
|
const int prev_calculated,
|
||||||
|
const datetime &time[],
|
||||||
|
const double &open[],
|
||||||
|
const double &high[],
|
||||||
|
const double &low[],
|
||||||
|
const double &close[],
|
||||||
|
const long &tick_volume[],
|
||||||
|
const long &volume[],
|
||||||
|
const int &spread[])
|
||||||
|
{
|
||||||
|
// Loop through all candles
|
||||||
|
for (int i = prev_calculated; i < rates_total; i++)
|
||||||
|
{
|
||||||
|
// Detect BOS (Break of Structure)
|
||||||
|
if (IsBOS(i, high, low, lookbackPeriod))
|
||||||
|
{
|
||||||
|
BOSBuffer[i] = high[i]; // Mark BOS on the chart
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOSBuffer[i] = EMPTY_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect CHOCH (Change of Character)
|
||||||
|
if (IsCHOCH(i, high, low, lookbackPeriod))
|
||||||
|
{
|
||||||
|
CHOCHBuffer[i] = low[i]; // Mark CHOCH on the chart
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CHOCHBuffer[i] = EMPTY_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(rates_total);
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Function to detect Break of Structure (BOS) |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
bool IsBOS(int index, const double &high[], const double &low[], int lookback)
|
||||||
|
{
|
||||||
|
// Check if the current high is higher than the previous highs
|
||||||
|
for (int i = 1; i <= lookback; i++)
|
||||||
|
{
|
||||||
|
if (index - i >= 0 && high[index] <= high[index - i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Function to detect Change of Character (CHOCH) |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
bool IsCHOCH(int index, const double &high[], const double &low[], int lookback)
|
||||||
|
{
|
||||||
|
// Check if the current low is lower than the previous lows
|
||||||
|
for (int i = 1; i <= lookback; i++)
|
||||||
|
{
|
||||||
|
if (index - i >= 0 && low[index] >= low[index - i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -855,6 +855,90 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count Prev Peak Repetition ...
|
||||||
|
*
|
||||||
|
* @param barIndex: Integer ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int CountPrevPeakRepetition(
|
||||||
|
int barIndex = 0//
|
||||||
|
) {
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0) {
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int index = barIndex + 1;
|
||||||
|
double value = mX121Helper.xpvHelper.GetPeak(index);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canContinue = true;
|
||||||
|
while(canContinue) {
|
||||||
|
//
|
||||||
|
double iValue = mX121Helper.xpvHelper.GetPeak(index);
|
||||||
|
|
||||||
|
//
|
||||||
|
canContinue = iValue == value;
|
||||||
|
if (canContinue) {
|
||||||
|
//
|
||||||
|
index++;
|
||||||
|
result++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count Prev Vale Repetition ...
|
||||||
|
*
|
||||||
|
* @param barIndex: Integer ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int CountPrevValeRepetition(
|
||||||
|
int barIndex = 0//
|
||||||
|
) {
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0) {
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int index = barIndex + 1;
|
||||||
|
double value = mX121Helper.xpvHelper.GetVale(index);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canContinue = true;
|
||||||
|
while(canContinue) {
|
||||||
|
//
|
||||||
|
double iValue = mX121Helper.xpvHelper.GetVale(index);
|
||||||
|
|
||||||
|
//
|
||||||
|
canContinue = iValue == value;
|
||||||
|
if (canContinue) {
|
||||||
|
//
|
||||||
|
index++;
|
||||||
|
result++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Cycle State and Update it ...
|
* Get Cycle State and Update it ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -704,631 +704,19 @@ bool DetectX121SMCXHKPVSignalSetup(
|
|||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Cycle State ...
|
// Detect ...
|
||||||
|
|
||||||
//
|
|
||||||
double upper = 0;
|
|
||||||
double lower = 0;
|
|
||||||
bool hasYoungestOB = false;
|
|
||||||
bool isPriceOBValid = false;
|
|
||||||
bool isBullishHappens = false;
|
|
||||||
bool isBearishHappens = false;
|
|
||||||
XCOrderBlock *youngestOB = NULL;
|
|
||||||
bool hasPriceBox = conditions.priceBox.IsValid();
|
|
||||||
bool hasState = visionCycleHelper.GetCycleState(conditions.state);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Price Box if not Provided ...
|
|
||||||
if (hasState &&
|
|
||||||
!hasPriceBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
hasPriceBox = DetectPriceInsideBox(
|
|
||||||
conditions.priceBox,
|
|
||||||
conditions.priceOB,
|
|
||||||
decisionXConditions,
|
|
||||||
conditions.state //
|
|
||||||
);
|
|
||||||
if (hasPriceBox)
|
|
||||||
{
|
|
||||||
conditions.priceOBAt = cTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasPriceBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Update Price Box Date ...
|
|
||||||
conditions.priceOB.To(cTime);
|
|
||||||
conditions.priceBox.to = cTime;
|
|
||||||
upper = conditions.priceOB.Upper();
|
|
||||||
lower = conditions.priceOB.Lower();
|
|
||||||
|
|
||||||
//
|
|
||||||
hasYoungestOB = conditions.state.GetYoungestOB(youngestOB);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Here We Can Validate Box by Same Cycles Peaks and Vales ...
|
|
||||||
bool isBullish = IsBullish(conditions.priceBox.dir);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isPriceBoxSameAsOB =
|
|
||||||
//
|
|
||||||
conditions.priceBox.upper <= conditions.priceOB.Upper() &&
|
|
||||||
conditions.priceBox.lower >= conditions.priceOB.Lower()
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
int cIDX = 1;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSameCyclePeaks =
|
|
||||||
//
|
|
||||||
triggerXConditions.peaksBuffer[cIDX] == decisionXConditions.peaksBuffer[cIDX] &&
|
|
||||||
decisionXConditions.peaksBuffer[cIDX] == analyseXConditions.peaksBuffer[cIDX] &&
|
|
||||||
analyseXConditions.peaksBuffer[cIDX] == verificationXConditions.peaksBuffer[cIDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSameCycleVales =
|
|
||||||
//
|
|
||||||
triggerXConditions.valesBuffer[cIDX] == decisionXConditions.valesBuffer[cIDX] &&
|
|
||||||
decisionXConditions.valesBuffer[cIDX] == analyseXConditions.valesBuffer[cIDX] &&
|
|
||||||
analyseXConditions.valesBuffer[cIDX] == verificationXConditions.valesBuffer[cIDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Validation Conditions ...
|
|
||||||
isPriceOBValid =
|
|
||||||
//
|
|
||||||
hasPriceBox &&
|
|
||||||
isPriceBoxSameAsOB &&
|
|
||||||
(isBullish
|
|
||||||
? isSameCycleVales
|
|
||||||
: isSameCyclePeaks)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
conditions.isPriceOBActed = isBullishHappens ||
|
|
||||||
isBearishHappens;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Accumulation ...
|
|
||||||
if (conditions.isPriceOBActed)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Checking OB Breake on Side ...
|
|
||||||
if (!conditions.isPriceOBBreaked)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.isPriceOBBreaked =
|
|
||||||
(conditions.priceOB.IsBullish() &&
|
|
||||||
IsBullish(conditions.priceBox.dir))
|
|
||||||
? (cBar.low < upper &&
|
|
||||||
cBar.high > upper &&
|
|
||||||
cBar.close > upper)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(pBar.high < upper &&
|
|
||||||
cBar.low > upper &&
|
|
||||||
cBar.open > upper)
|
|
||||||
: (cBar.high > lower &&
|
|
||||||
cBar.low < lower &&
|
|
||||||
cBar.close < lower)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(pBar.low > lower &&
|
|
||||||
cBar.high < lower &&
|
|
||||||
cBar.open < lower);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Distribution ...
|
|
||||||
bool isPriceOBUpperBrekedUp = false;
|
|
||||||
bool isPriceOBLowerBrekedDown = false;
|
|
||||||
if (conditions.isPriceOBBreaked)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isPriceOBUpperBrekedUp = IsBarBreak(
|
|
||||||
upper,
|
|
||||||
X_DIRECTION_BULLISH,
|
|
||||||
cBar //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
isPriceOBLowerBrekedDown = IsBarBreak(
|
|
||||||
lower,
|
|
||||||
X_DIRECTION_BEARISH,
|
|
||||||
cBar //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Draw ...
|
|
||||||
// XCBaseObject *drawnObjects[];
|
|
||||||
// int drawnObjectsCount = visionCycleHelper.DrawCycleState(
|
|
||||||
// conditions.state,
|
|
||||||
// drawnObjects //
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// if (hasPriceBox)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// 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)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// Add(
|
|
||||||
// (XCBaseObject *)iObj,
|
|
||||||
// drawnObjects //
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
|
||||||
// XCBaseObject *priceOBObj = NULL;
|
|
||||||
// if (isBullish)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// XCBullishOrderBlockObject *iObj;
|
|
||||||
// isCreated = visionCycleHelper
|
|
||||||
// .mPOIDrawer
|
|
||||||
// .CreateBullishOrderBlock(
|
|
||||||
// conditions.priceOB,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// iObj.ZoneWidth(2);
|
|
||||||
// iObj.ZoneColor(boxColor);
|
|
||||||
// iObj.ZoneStyle(STYLE_SOLID);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// priceOBObj = (XCBaseObject *)iObj;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// XCBearishOrderBlockObject *iObj;
|
|
||||||
// isCreated = visionCycleHelper
|
|
||||||
// .mPOIDrawer
|
|
||||||
// .CreateBearishOrderBlock(
|
|
||||||
// conditions.priceOB,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// iObj.ZoneWidth(2);
|
|
||||||
// iObj.ZoneColor(boxColor);
|
|
||||||
// iObj.ZoneStyle(STYLE_SOLID);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// priceOBObj = (XCBaseObject *)iObj;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// Add(
|
|
||||||
// priceOBObj,
|
|
||||||
// drawnObjects //
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Verifications Conditions ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// XHK ...
|
|
||||||
bool isXHKBullish = false;
|
|
||||||
bool isXHKBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XSAR ...
|
|
||||||
bool isXSarBullish = false;
|
|
||||||
bool isXSarBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XATR ...
|
|
||||||
bool isXAtrBullish = false;
|
|
||||||
bool isXAtrBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XSTR ...
|
|
||||||
bool isXStrBullish = false;
|
|
||||||
bool isXStrBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XVWAP ...
|
|
||||||
bool isXVWapBullish = false;
|
|
||||||
bool isXVWapBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XCHE ...
|
|
||||||
bool isXCheBullish = false;
|
|
||||||
bool isXCheBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasPriceBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// XHK ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isXHKBullish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isSMHKBullish &&
|
|
||||||
triggerXConditions.isRawHKBullish &&
|
|
||||||
triggerXConditions.isClosedOverSMHK &&
|
|
||||||
triggerXConditions.isClosedOverRawHK &&
|
|
||||||
(triggerXConditions.isBreakedUpSMHK ||
|
|
||||||
triggerXConditions.isBreakedUpRawHK) &&
|
|
||||||
triggerXConditions.isRawHKClosedOverSMHK &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isSMHKBullish &&
|
|
||||||
decisionXConditions.isRawHKBullish &&
|
|
||||||
decisionXConditions.isClosedOverSMHK &&
|
|
||||||
decisionXConditions.isClosedOverRawHK &&
|
|
||||||
(decisionXConditions.isBreakedUpSMHK ||
|
|
||||||
decisionXConditions.isBreakedUpRawHK) &&
|
|
||||||
decisionXConditions.isRawHKClosedOverSMHK &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isSMHKBullish &&
|
|
||||||
analyseXConditions.isRawHKBullish &&
|
|
||||||
analyseXConditions.isClosedOverSMHK &&
|
|
||||||
analyseXConditions.isClosedOverRawHK &&
|
|
||||||
(analyseXConditions.isBreakedUpSMHK ||
|
|
||||||
analyseXConditions.isBreakedUpRawHK) &&
|
|
||||||
decisionXConditions.isRawHKClosedOverSMHK
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isXHKBearish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isSMHKBearish &&
|
|
||||||
triggerXConditions.isRawHKBearish &&
|
|
||||||
triggerXConditions.isClosedUnderSMHK &&
|
|
||||||
triggerXConditions.isClosedUnderRawHK &&
|
|
||||||
(triggerXConditions.isBreakedDownSMHK ||
|
|
||||||
triggerXConditions.isBreakedDownRawHK) &&
|
|
||||||
triggerXConditions.isRawHKClosedUnderSMHK &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isSMHKBearish &&
|
|
||||||
decisionXConditions.isRawHKBearish &&
|
|
||||||
decisionXConditions.isClosedUnderSMHK &&
|
|
||||||
decisionXConditions.isClosedUnderRawHK &&
|
|
||||||
(decisionXConditions.isBreakedDownSMHK ||
|
|
||||||
decisionXConditions.isBreakedDownRawHK) &&
|
|
||||||
decisionXConditions.isRawHKClosedUnderSMHK &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isSMHKBearish &&
|
|
||||||
analyseXConditions.isRawHKBearish &&
|
|
||||||
analyseXConditions.isClosedUnderSMHK &&
|
|
||||||
analyseXConditions.isClosedUnderRawHK &&
|
|
||||||
(analyseXConditions.isBreakedDownSMHK ||
|
|
||||||
analyseXConditions.isBreakedDownRawHK) &&
|
|
||||||
analyseXConditions.isRawHKClosedUnderSMHK
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XSAR ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isXSarBullish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isSarBullish &&
|
|
||||||
triggerXConditions.isSarIncreased &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isSarBullish &&
|
|
||||||
decisionXConditions.isSarIncreased &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isSarBullish &&
|
|
||||||
analyseXConditions.isSarIncreased
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isXSarBearish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isSarBearish &&
|
|
||||||
triggerXConditions.isSarDecreased &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isSarBearish &&
|
|
||||||
decisionXConditions.isSarDecreased &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isSarBearish // &&
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XATR ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isXAtrBullish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isClosedOverAtrUpper &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isClosedOverAtrUpper
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isXAtrBearish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isClosedUnderAtrLower &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isClosedUnderAtrLower
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XSTR ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isXStrBullish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isStrBullish &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isStrBullish
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isXStrBearish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isStrBearish &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isStrBearish
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XVWAP ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isXVWapBullish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isVWapBullishState &&
|
|
||||||
triggerXConditions.isVWapBullishOrdered &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isVWapBullishState &&
|
|
||||||
decisionXConditions.isVWapBullishOrdered &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isVWapBullishState &&
|
|
||||||
analyseXConditions.isVWapBullishOrdered
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isXVWapBearish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isVWapBearishState &&
|
|
||||||
triggerXConditions.isVWapBearishOrdered &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isVWapBearishState &&
|
|
||||||
decisionXConditions.isVWapBearishOrdered &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isVWapBearishState &&
|
|
||||||
analyseXConditions.isVWapBearishOrdered
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// XCHE ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isXCheBullish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isCheBullish &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isCheBullish &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isCheBullish
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isXCheBearish =
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
triggerXConditions.isCheBearish &&
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
decisionXConditions.isCheBearish &&
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
analyseXConditions.isCheBearish
|
|
||||||
//
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Summarize Conditions ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCondition1Bullish =
|
bool isCondition1Bullish =
|
||||||
//
|
//
|
||||||
isPriceOBUpperBrekedUp &&
|
false
|
||||||
conditions.isPriceOBBreaked &&
|
|
||||||
conditions.priceOB.IsBearish() &&
|
|
||||||
//
|
|
||||||
// XHK ...
|
|
||||||
isXHKBullish &&
|
|
||||||
//
|
|
||||||
// XSAR ...
|
|
||||||
isXSarBullish &&
|
|
||||||
//
|
|
||||||
// XATR ...
|
|
||||||
isXAtrBullish &&
|
|
||||||
//
|
|
||||||
// XSTR ...
|
|
||||||
isXStrBullish &&
|
|
||||||
//
|
|
||||||
// XVWAP ...
|
|
||||||
isXVWapBullish &&
|
|
||||||
//
|
|
||||||
// XCHE ...
|
|
||||||
isXCheBullish &&
|
|
||||||
//
|
|
||||||
true
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCondition1Bearish =
|
bool isCondition1Bearish =
|
||||||
//
|
//
|
||||||
isPriceOBLowerBrekedDown &&
|
false
|
||||||
conditions.isPriceOBBreaked &&
|
|
||||||
conditions.priceOB.IsBullish() &&
|
|
||||||
//
|
|
||||||
// XHK ...
|
|
||||||
isXHKBearish &&
|
|
||||||
//
|
|
||||||
// XSAR ...
|
|
||||||
isXSarBearish &&
|
|
||||||
//
|
|
||||||
// XATR ...
|
|
||||||
isXAtrBearish &&
|
|
||||||
//
|
|
||||||
// XSTR ...
|
|
||||||
isXStrBearish &&
|
|
||||||
//
|
|
||||||
// XVWAP ...
|
|
||||||
isXVWapBearish &&
|
|
||||||
//
|
|
||||||
// XCHE ...
|
|
||||||
isXCheBearish &&
|
|
||||||
//
|
|
||||||
true
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1350,8 +738,8 @@ bool DetectX121SMCXHKPVSignalSetup(
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
double longPivot = lower; // triggerXConditions.valesBuffer[1];
|
double longPivot = triggerXConditions.valesBuffer[1];
|
||||||
double shortPivot = upper; // triggerXConditions.peaksBuffer[1];
|
double shortPivot = triggerXConditions.peaksBuffer[1];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Manipulate Conditions Point ...
|
// Manipulate Conditions Point ...
|
||||||
@@ -1395,24 +783,6 @@ bool DetectX121SMCXHKPVSignalSetup(
|
|||||||
isBearish;
|
isBearish;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Detect PriceOB Lifetime Bars ...
|
|
||||||
if (hasPriceBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int obLifetimeBars = (int)(cTime - conditions.priceOBAt) / PeriodSeconds(PERIOD_M1);
|
|
||||||
bool canReset =
|
|
||||||
//
|
|
||||||
!conditions.isPriceOBActed &&
|
|
||||||
obLifetimeBars >= resetAfterUnActedZoneInMinutes
|
|
||||||
//
|
|
||||||
;
|
|
||||||
if (canReset)
|
|
||||||
{
|
|
||||||
conditions.Clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Arrays ...
|
// Cleanup Arrays ...
|
||||||
Clean(triggerPoiEvents);
|
Clean(triggerPoiEvents);
|
||||||
|
|||||||
@@ -57,14 +57,17 @@ struct X121SMCStrategyXOBSSignalConditions
|
|||||||
//
|
//
|
||||||
// Extwnsion ...
|
// Extwnsion ...
|
||||||
|
|
||||||
//
|
|
||||||
datetime vOBAt;
|
|
||||||
XCOrderBlock *vOB;
|
|
||||||
bool isVOBActivated;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
datetime cOBAt;
|
datetime cOBAt;
|
||||||
XCOrderBlock *cOB;
|
XCOrderBlock *cOB;
|
||||||
|
bool isCOBActivated;
|
||||||
|
datetime cOBActivatedAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime aOBAt;
|
||||||
|
XCOrderBlock *aOB;
|
||||||
|
bool isAOBActivated;
|
||||||
|
datetime aOBActivatedAt;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -188,15 +191,16 @@ struct X121SMCStrategyXOBSSignalConditions
|
|||||||
point = 0;
|
point = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
vOB = NULL;
|
|
||||||
cOB = NULL;
|
cOB = NULL;
|
||||||
|
|
||||||
//
|
|
||||||
vOBAt = NULL;
|
|
||||||
cOBAt = NULL;
|
cOBAt = NULL;
|
||||||
|
cOBActivatedAt = NULL;
|
||||||
|
isCOBActivated = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
isVOBActivated = false;
|
aOB = NULL;
|
||||||
|
aOBAt = NULL;
|
||||||
|
aOBActivatedAt = NULL;
|
||||||
|
isAOBActivated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -728,12 +732,6 @@ bool DetectX121SMCXOBSSignalSetup(
|
|||||||
//
|
//
|
||||||
// Detect OrderBlocks ...
|
// Detect OrderBlocks ...
|
||||||
|
|
||||||
//
|
|
||||||
bool hasVOB =
|
|
||||||
conditions.vOB != NULL &&
|
|
||||||
conditions.vOB.IsValid() &&
|
|
||||||
IsValid(conditions.vOBAt);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasCOB =
|
bool hasCOB =
|
||||||
conditions.cOB != NULL &&
|
conditions.cOB != NULL &&
|
||||||
@@ -741,23 +739,23 @@ bool DetectX121SMCXOBSSignalSetup(
|
|||||||
IsValid(conditions.cOBAt);
|
IsValid(conditions.cOBAt);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!hasVOB)
|
if (!hasCOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int poiEvntsCount = ArraySize(visionPoiEvents);
|
int poiEvntsCount = ArraySize(consolidationPoiEvents);
|
||||||
bool hasEvent = IsValidSize(poiEvntsCount);
|
bool hasEvent = IsValidSize(poiEvntsCount);
|
||||||
if (hasEvent)
|
if (hasEvent)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool hasNewBullOB = Contains(
|
bool hasNewBullOB = Contains(
|
||||||
X_BULLISH_ORDERBLOCK_DETECTED,
|
X_BULLISH_ORDERBLOCK_DETECTED,
|
||||||
visionPoiEvents //
|
consolidationPoiEvents //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasNewBearOB = Contains(
|
bool hasNewBearOB = Contains(
|
||||||
X_BEARISH_ORDERBLOCK_DETECTED,
|
X_BEARISH_ORDERBLOCK_DETECTED,
|
||||||
visionPoiEvents //
|
consolidationPoiEvents //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -769,110 +767,155 @@ bool DetectX121SMCXOBSSignalSetup(
|
|||||||
if (hasNewOB)
|
if (hasNewOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
XCOrderBlock *ob = NULL;
|
||||||
if (hasNewBullOB)
|
if (hasNewBullOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int lastIDX = visionState.CountBullishOrderBlocks() - 1;
|
int lastIDX = consolidationState.CountBullishOrderBlocks() - 1;
|
||||||
conditions.vOB = visionState.bullishOrderBlocks[lastIDX];
|
ob = consolidationState.bullishOrderBlocks[lastIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate OB ...
|
||||||
}
|
}
|
||||||
else if (hasNewBearOB)
|
else if (hasNewBearOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int lastIDX = visionState.CountBearishOrderBlocks() - 1;
|
int lastIDX = consolidationState.CountBearishOrderBlocks() - 1;
|
||||||
conditions.vOB = visionState.bearishOrderBlocks[lastIDX];
|
ob = consolidationState.bearishOrderBlocks[lastIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate OB ...
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.vOBAt = cTime;
|
if (ob != NULL && ob.IsValid())
|
||||||
|
|
||||||
//
|
|
||||||
hasVOB =
|
|
||||||
conditions.vOB != NULL &&
|
|
||||||
conditions.vOB.IsValid() &&
|
|
||||||
IsValid(conditions.vOBAt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
X121SMCCycleState vState;
|
conditions.cOB = ob;
|
||||||
bool hasVState = visionCycleHelper.GetCycleState(vState);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasYoungestOB = vState.GetYoungestOB(conditions.vOB);
|
conditions.cOBAt = cTime;
|
||||||
if (hasYoungestOB)
|
|
||||||
|
//
|
||||||
|
hasCOB =
|
||||||
|
conditions.cOB != NULL &&
|
||||||
|
conditions.cOB.IsValid() &&
|
||||||
|
IsValid(conditions.cOBAt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasCOB)
|
||||||
|
{
|
||||||
|
conditions.cOB.To(cTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasAOB =
|
||||||
|
conditions.aOB != NULL &&
|
||||||
|
conditions.aOB.IsValid() &&
|
||||||
|
IsValid(conditions.aOBAt);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasCOB &&
|
||||||
|
!hasAOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
conditions.vOBAt = cTime;
|
int poiEvntsCount = ArraySize(analysePoiEvents);
|
||||||
|
bool hasEvent = IsValidSize(poiEvntsCount);
|
||||||
//
|
if (hasEvent)
|
||||||
hasVOB =
|
|
||||||
conditions.vOB != NULL &&
|
|
||||||
conditions.vOB.IsValid() &&
|
|
||||||
IsValid(conditions.vOBAt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Update To Time ...
|
|
||||||
if (hasVOB)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
conditions.vOB.To(cTime);
|
bool hasNewBullOB = Contains(
|
||||||
}
|
X_BULLISH_ORDERBLOCK_DETECTED,
|
||||||
|
analysePoiEvents //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Vait for Order Block Activation ...
|
bool hasNewBearOB = Contains(
|
||||||
if (hasVOB &&
|
X_BEARISH_ORDERBLOCK_DETECTED,
|
||||||
!conditions.isVOBActivated)
|
analysePoiEvents //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasNewOB =
|
||||||
|
hasNewBullOB ||
|
||||||
|
hasNewBearOB;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasNewOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
conditions.isVOBActivated =
|
XCOrderBlock *ob = NULL;
|
||||||
|
if (hasNewBullOB)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
cBar.low >= conditions.vOB.Lower() &&
|
int lastIDX = analyseState.CountBullishOrderBlocks() - 1;
|
||||||
cBar.high <= conditions.vOB.Upper() &&
|
ob = analyseState.bullishOrderBlocks[lastIDX];
|
||||||
|
|
||||||
//
|
//
|
||||||
bid >= conditions.vOB.Lower() &&
|
// Validate OB ...
|
||||||
bid <= conditions.vOB.Upper()
|
}
|
||||||
|
else if (hasNewBearOB)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
;
|
int lastIDX = analyseState.CountBearishOrderBlocks() - 1;
|
||||||
|
ob = analyseState.bearishOrderBlocks[lastIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate OB ...
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Result ...
|
if (ob != NULL && ob.IsValid())
|
||||||
result = hasVOB &&
|
{
|
||||||
conditions.isVOBActivated;
|
//
|
||||||
|
conditions.aOB = ob;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.aOBAt = cTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
hasAOB =
|
||||||
|
conditions.aOB != NULL &&
|
||||||
|
conditions.aOB.IsValid() &&
|
||||||
|
IsValid(conditions.aOBAt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasAOB)
|
||||||
|
{
|
||||||
|
conditions.aOB.To(cTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = hasCOB &&
|
||||||
|
hasAOB;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Market Trend ...
|
// DRAW ...
|
||||||
bool isTrendOveralBullish = hasVisionBullishTrend &&
|
//
|
||||||
hasConsolidationBullishTrend;
|
|
||||||
bool isTrendOveralBearish = hasVisionBearishTrend &&
|
|
||||||
hasConsolidationBearishTrend;
|
|
||||||
result = (isTrendOveralBullish &&
|
|
||||||
!isTrendOveralBearish) ||
|
|
||||||
(!isTrendOveralBullish &&
|
|
||||||
isTrendOveralBearish);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBullishOB = conditions.vOB.IsBullish();
|
// Draw Orer Block ...
|
||||||
if (isBullishOB)
|
bool isBullishCOB = conditions.cOB.IsBullish();
|
||||||
|
if (isBullishCOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCBullishOrderBlockObject *iObj;
|
XCBullishOrderBlockObject *iObj;
|
||||||
bool isCreated = visionCycleHelper
|
bool isCreated = consolidationCycleHelper
|
||||||
.mPOIDrawer
|
.mPOIDrawer
|
||||||
.CreateBullishOrderBlock(
|
.CreateBullishOrderBlock(
|
||||||
conditions.vOB,
|
conditions.cOB,
|
||||||
iObj //
|
iObj //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -880,14 +923,158 @@ bool DetectX121SMCXOBSSignalSetup(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCBearishOrderBlockObject *iObj;
|
XCBearishOrderBlockObject *iObj;
|
||||||
bool isCreated = visionCycleHelper
|
bool isCreated = consolidationCycleHelper
|
||||||
.mPOIDrawer
|
.mPOIDrawer
|
||||||
.CreateBearishOrderBlock(
|
.CreateBearishOrderBlock(
|
||||||
conditions.vOB,
|
conditions.cOB,
|
||||||
iObj //
|
iObj //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isBullishAOB = conditions.aOB.IsBullish();
|
||||||
|
if (isBullishAOB)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBullishOrderBlockObject *iObj;
|
||||||
|
bool isCreated = analyseCycleHelper
|
||||||
|
.mPOIDrawer
|
||||||
|
.CreateBullishOrderBlock(
|
||||||
|
conditions.aOB,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBearishOrderBlockObject *iObj;
|
||||||
|
bool isCreated = analyseCycleHelper
|
||||||
|
.mPOIDrawer
|
||||||
|
.CreateBearishOrderBlock(
|
||||||
|
conditions.aOB,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw From Bar ...
|
||||||
|
XOHCL cOBFromBar;
|
||||||
|
bool hasCOBFromBar = cOBFromBar.Init(
|
||||||
|
conditions.cOB.GetSymbol(),
|
||||||
|
conditions.cOB.GetPeriod(),
|
||||||
|
conditions.cOB.From() //
|
||||||
|
);
|
||||||
|
if (hasCOBFromBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOHCLObject *barObject;
|
||||||
|
bool iCreated = consolidationCycleHelper
|
||||||
|
.mPOIDrawer
|
||||||
|
.CreateBar(
|
||||||
|
cOBFromBar,
|
||||||
|
barObject //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw From Bar ...
|
||||||
|
XOHCL aOBFromBar;
|
||||||
|
bool hasAOBFromBar = aOBFromBar.Init(
|
||||||
|
conditions.aOB.GetSymbol(),
|
||||||
|
conditions.aOB.GetPeriod(),
|
||||||
|
conditions.aOB.From() //
|
||||||
|
);
|
||||||
|
if (hasAOBFromBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOHCLObject *barObject;
|
||||||
|
bool iCreated = analyseCycleHelper
|
||||||
|
.mPOIDrawer
|
||||||
|
.CreateBar(
|
||||||
|
aOBFromBar,
|
||||||
|
barObject //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// END DRAW ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check AOB Activation ...
|
||||||
|
if (!conditions.isAOBActivated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int aPeakRepetition = analyseCycleHelper.CountPrevPeakRepetition();
|
||||||
|
int aValeRepetition = analyseCycleHelper.CountPrevValeRepetition();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isActivated =
|
||||||
|
//
|
||||||
|
bid >= conditions.aOB.Lower() &&
|
||||||
|
bid <= conditions.aOB.Upper() &&
|
||||||
|
//
|
||||||
|
cBar.low >= conditions.aOB.Lower() &&
|
||||||
|
cBar.high <= conditions.aOB.Upper() &&
|
||||||
|
//
|
||||||
|
(conditions.aOB.IsBullish()
|
||||||
|
? decisionXConditions.valesBuffer[1] >= conditions.aOB.Lower() &&
|
||||||
|
decisionXConditions.valesBuffer[1] <= conditions.aOB.Upper()
|
||||||
|
: decisionXConditions.peaksBuffer[1] >= conditions.aOB.Lower() &&
|
||||||
|
decisionXConditions.peaksBuffer[1] <= conditions.aOB.Upper())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isActivated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.aOBActivatedAt = cTime;
|
||||||
|
conditions.isAOBActivated = isActivated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check COB Activation ...
|
||||||
|
if (!conditions.isCOBActivated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int aPeakRepetition = analyseCycleHelper.CountPrevPeakRepetition();
|
||||||
|
int aValeRepetition = analyseCycleHelper.CountPrevValeRepetition();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isActivated =
|
||||||
|
//
|
||||||
|
bid >= conditions.cOB.Lower() &&
|
||||||
|
bid <= conditions.cOB.Upper() &&
|
||||||
|
//
|
||||||
|
cBar.low >= conditions.cOB.Lower() &&
|
||||||
|
cBar.high <= conditions.cOB.Upper() &&
|
||||||
|
//
|
||||||
|
(conditions.cOB.IsBullish()
|
||||||
|
? decisionXConditions.valesBuffer[1] >= conditions.cOB.Lower() &&
|
||||||
|
decisionXConditions.valesBuffer[1] <= conditions.cOB.Upper()
|
||||||
|
: decisionXConditions.peaksBuffer[1] >= conditions.cOB.Lower() &&
|
||||||
|
decisionXConditions.peaksBuffer[1] <= conditions.cOB.Upper())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isActivated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.cOBActivatedAt = cTime;
|
||||||
|
conditions.isCOBActivated = isActivated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = conditions.isAOBActivated ||
|
||||||
|
conditions.isCOBActivated;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double upper = 0;
|
double upper = 0;
|
||||||
double lower = 0;
|
double lower = 0;
|
||||||
|
|||||||
@@ -1662,10 +1662,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
useXSignal = false;
|
useXSignal = false;
|
||||||
useXOBSSignal = true;
|
useXOBSSignal = false;
|
||||||
useXHKPVSignal = false;
|
useXHKPVSignal = false;
|
||||||
useXOBPVSignal = false;
|
useXOBPVSignal = true;
|
||||||
useXIOBPVSignal = false;
|
useXIOBPVSignal = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
string symbol = GetSymbol();
|
string symbol = GetSymbol();
|
||||||
|
|||||||
Reference in New Issue
Block a user