last ...
This commit is contained in:
@@ -108,11 +108,6 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
//
|
||||
int loopback = 10;
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
mConditions.symbol = symbol;
|
||||
mConditions.period = period;
|
||||
@@ -209,6 +204,7 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
double point = 0;
|
||||
double targets[];
|
||||
XBoxZone signalBox;
|
||||
XBoxZone signalZone;
|
||||
bool hasSignalBox = false;
|
||||
ENUM_X_DIRECTION signalBoxDir = X_DIRECTION_NONE;
|
||||
ENUM_X121SMC_XIND_PROVIDERS signalProvider = X121SMC_XIND_PROVIDER_NONE;
|
||||
@@ -219,6 +215,7 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
|
||||
//
|
||||
int waitingBoxesCount = UpdateWaitingBoxes(
|
||||
X_CYCLE_ANALYSE,
|
||||
X_CYCLE_DECISION,
|
||||
provider //
|
||||
);
|
||||
@@ -228,27 +225,26 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
DrawBoxes(drawer);
|
||||
|
||||
//
|
||||
if (hasWaitingBoxes)
|
||||
// Detect Signal Boxes ...
|
||||
hasSignalBox = HasXINDConditions(
|
||||
mWaitingBoxes,
|
||||
mActivatedBoxes,
|
||||
mBreakedBoxes,
|
||||
X_CYCLE_DECISION,
|
||||
signalBox,
|
||||
signalZone,
|
||||
signalBoxDir,
|
||||
provider,
|
||||
zIndex //
|
||||
);
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
hasSignalBox = HasXPVConditions(
|
||||
mWaitingBoxes,
|
||||
mActivatedBoxes,
|
||||
mBreakedBoxes,
|
||||
X_CYCLE_DECISION,
|
||||
signalBox,
|
||||
signalBoxDir,
|
||||
provider,
|
||||
zIndex //
|
||||
);
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
signalProvider = X121SMC_XIND_PROVIDER_XSTR;
|
||||
signalProvider = X121SMC_XIND_PROVIDER_XIND;
|
||||
|
||||
//
|
||||
MakeSignalBoxUnAvailable(signalBox);
|
||||
}
|
||||
//
|
||||
MakeSignalBoxUnAvailable(signalBox);
|
||||
MakeSignalBoxUnAvailable(signalZone);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -329,7 +325,7 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
//
|
||||
// Select and Provide SL Based on ...
|
||||
double iAtr = 0;
|
||||
if (signalProvider == X121SMC_XIND_PROVIDER_XSTR)
|
||||
if (signalProvider == X121SMC_XIND_PROVIDER_XIND)
|
||||
{
|
||||
//
|
||||
iAtr = provider.decisionXConditions.atrBuffer[1];
|
||||
@@ -445,7 +441,8 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
bool DetectSignalTrigger(
|
||||
X121SMCStrategyXINDSignalConditions &conditions,
|
||||
X121SMCStrategySignalProviderData &provider,
|
||||
int maxAllowedSetupAge = 60)
|
||||
int maxAllowedSetupAge = 60 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
@@ -1095,6 +1092,7 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
*/
|
||||
int UpdateWaitingBoxes(
|
||||
ENUM_X_CYCLES cycle,
|
||||
ENUM_X_CYCLES vCycle,
|
||||
X121SMCStrategySignalProviderData &provider //
|
||||
)
|
||||
{
|
||||
@@ -1137,113 +1135,61 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
||||
// Detecting New Boxes ...
|
||||
|
||||
//
|
||||
// Checking Bullish Fair Value Gaps ...
|
||||
has = cState.HasBullishFairValueGaps();
|
||||
XBoxZone tmpBoxes[];
|
||||
count = cState.FairValueGapsAsBox(tmpBoxes);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
XBoxZone tmpBoxes[];
|
||||
ToBox(
|
||||
cState.bullishFairValueGaps,
|
||||
tmpBoxes //
|
||||
);
|
||||
|
||||
//
|
||||
count = ArraySize(tmpBoxes);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = tmpBoxes[i];
|
||||
bool isValid = IsBoxValid(
|
||||
iBox,
|
||||
0,
|
||||
iBox.period //
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
XBoxZone iBox = tmpBoxes[i];
|
||||
|
||||
//
|
||||
has = IsBoxExists(iBox);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iBox,
|
||||
mWaitingBoxes //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(tmpBoxes);
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Bearish Fair Value Gaps ...
|
||||
has = cState.HasBearishFairValueGaps();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
XBoxZone tmpBoxes[];
|
||||
ToBox(
|
||||
cState.bearishFairValueGaps,
|
||||
tmpBoxes //
|
||||
);
|
||||
|
||||
//
|
||||
count = ArraySize(tmpBoxes);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
// Regular Validation of Boxes ...
|
||||
bool isValid = IsBoxValid(
|
||||
iBox,
|
||||
0,
|
||||
iBox.period //
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = tmpBoxes[i];
|
||||
bool isValid = IsBoxValid(
|
||||
iBox,
|
||||
0,
|
||||
iBox.period //
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
has = IsBoxExists(iBox);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iBox,
|
||||
mWaitingBoxes //
|
||||
);
|
||||
}
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Conditional Validation of FVG Boxes ...
|
||||
isValid = IsFVGBoxValid(
|
||||
iBox,
|
||||
vCycle,
|
||||
provider //
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(tmpBoxes);
|
||||
//
|
||||
has = IsBoxExists(iBox);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iBox,
|
||||
mWaitingBoxes //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
Clean(tmpBoxes);
|
||||
|
||||
//
|
||||
// Update Times ...
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
enum ENUM_X121SMC_XIND_PROVIDERS
|
||||
{
|
||||
X121SMC_XIND_PROVIDER_NONE,
|
||||
X121SMC_XIND_PROVIDER_XSTR,
|
||||
X121SMC_XIND_PROVIDER_XIND,
|
||||
X121SMC_XIND_PROVIDER_XTKKUMO,
|
||||
};
|
||||
|
||||
@@ -223,17 +223,469 @@ struct X121SMCStrategyXINDSignalConditions
|
||||
//
|
||||
// Extension Functions ...
|
||||
|
||||
//
|
||||
// Validate FVG BOXes ...
|
||||
|
||||
//
|
||||
bool IsFVGBoxValid(
|
||||
XBoxZone &box,
|
||||
ENUM_X_CYCLES cycle,
|
||||
X121SMCStrategySignalProviderData &provider //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Fil Selected Data ...
|
||||
XPOIState cState;
|
||||
X121Conditions cXConditions;
|
||||
XPOIStateEvents cStateEvents;
|
||||
XC121SMCCycleHelper *cHelper;
|
||||
X121SMCCycleConditions cConditions;
|
||||
result = provider.SelectCycle(
|
||||
cycle,
|
||||
cState,
|
||||
cStateEvents,
|
||||
cXConditions,
|
||||
cHelper,
|
||||
cConditions //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
cState.Clean();
|
||||
ZeroMemory(cHelper);
|
||||
cConditions.Clean();
|
||||
cXConditions.Clean();
|
||||
cStateEvents.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBoxBullish = box.IsBullish();
|
||||
|
||||
//
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
XBoxZone tmpBoxes[];
|
||||
count = cState.FairValueGapsAsBox(tmpBoxes);
|
||||
has = IsValidSize(count);
|
||||
|
||||
//
|
||||
// Check Must Contains Inner Cycle FVG ...
|
||||
XBoxZone selectedBox;
|
||||
bool hasSelectedBox = false;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = tmpBoxes[i];
|
||||
|
||||
//
|
||||
// Regular Validation of Boxes ...
|
||||
bool isValid = IsBoxValid(
|
||||
iBox,
|
||||
0,
|
||||
iBox.period //
|
||||
);
|
||||
bool isTypePassed = iBox.dir == box.dir;
|
||||
bool isFromPssed = iBox.from >= box.from;
|
||||
bool isPlacePassed =
|
||||
IsBoxInsideOr(
|
||||
iBox,
|
||||
box //
|
||||
) &&
|
||||
(isBoxBullish
|
||||
? iBox.lower >= box.lower
|
||||
: iBox.upper <= box.upper);
|
||||
has =
|
||||
isValid &&
|
||||
isFromPssed &&
|
||||
isTypePassed &&
|
||||
isPlacePassed;
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
has =
|
||||
!hasSelectedBox
|
||||
? true
|
||||
: isBoxBullish
|
||||
? selectedBox.upper > iBox.upper
|
||||
: selectedBox.lower < iBox.lower;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
selectedBox = iBox;
|
||||
hasSelectedBox = selectedBox.IsValid();
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = hasSelectedBox;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
|
||||
//
|
||||
// From Index ...
|
||||
int fromIndex = GetBarIndex(
|
||||
selectedBox.symbol,
|
||||
selectedBox.period,
|
||||
selectedBox.from //
|
||||
) + 1;
|
||||
result = IsValidIndex(fromIndex);
|
||||
|
||||
//
|
||||
// To Index ...
|
||||
int toIndex = GetBarIndex(
|
||||
selectedBox.symbol,
|
||||
selectedBox.period,
|
||||
selectedBox.to //
|
||||
);
|
||||
if (toIndex < 1)
|
||||
{
|
||||
toIndex = 1;
|
||||
}
|
||||
result = IsValidIndex(toIndex);
|
||||
|
||||
//
|
||||
// Now we Have Retrieve X121Conditions between from and to Indexes ...
|
||||
// for Check States ...
|
||||
|
||||
//
|
||||
bool hasNewValeUnderLast = false;
|
||||
bool isStrSwitchedToBullish = false;
|
||||
bool isSarSwitchedToBullish = false;
|
||||
bool hasValueGoldenZoneBreak = false;
|
||||
bool isSMHKSwitchedToBullish = false;
|
||||
bool isVWapSwitchedToBullishState = false;
|
||||
bool isX3MaSwitchedToBullishState = false;
|
||||
bool isVWapSwitchedToBullishOrdered = false;
|
||||
bool isX3MaSwitchedToBullishOrdered = false;
|
||||
|
||||
//
|
||||
bool hasNewPeakOverLast = false;
|
||||
bool isStrSwitchedToBearish = false;
|
||||
bool isSarSwitchedToBearish = false;
|
||||
bool hasPeakGoldenZoneBreak = false;
|
||||
bool isSMHKSwitchedToBearish = false;
|
||||
bool isVWapSwitchedToBearishState = false;
|
||||
bool isX3MaSwitchedToBearishState = false;
|
||||
bool isVWapSwitchedToBearishOrdered = false;
|
||||
bool isX3MaSwitchedToBearishOrdered = false;
|
||||
|
||||
//
|
||||
for (int i = fromIndex; i >= toIndex; i--)
|
||||
{
|
||||
//
|
||||
XOHCL iBar;
|
||||
has = iBar.Init(
|
||||
cState.symbol,
|
||||
cState.period,
|
||||
i //
|
||||
);
|
||||
X121Conditions iConditions;
|
||||
has = has &&
|
||||
cHelper.mX121Helper.GetConditions(
|
||||
iConditions,
|
||||
i //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
|
||||
//
|
||||
if (!hasNewValeUnderLast)
|
||||
{
|
||||
hasNewValeUnderLast = iConditions.isNewValeUnderLast;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isStrSwitchedToBullish)
|
||||
{
|
||||
isStrSwitchedToBullish = iConditions.isStrSwitchedToBullish;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isSarSwitchedToBullish)
|
||||
{
|
||||
isSarSwitchedToBullish = iConditions.isSarSwitchedToBullish;
|
||||
}
|
||||
|
||||
//
|
||||
if (!hasValueGoldenZoneBreak)
|
||||
{
|
||||
//
|
||||
hasValueGoldenZoneBreak =
|
||||
iBar.IsBullish() &&
|
||||
iBar.GetUp() > iConditions.valesGoldenBuffer[1] &&
|
||||
iBar.GetDown() < iConditions.valesGoldenBuffer[1];
|
||||
}
|
||||
|
||||
//
|
||||
if (!isSMHKSwitchedToBullish)
|
||||
{
|
||||
isSMHKSwitchedToBullish = iConditions.isSMHKSwitchedToBullish;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isVWapSwitchedToBullishState)
|
||||
{
|
||||
isVWapSwitchedToBullishState = iConditions.isVWapSwitchedToBullishState;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isX3MaSwitchedToBullishState)
|
||||
{
|
||||
isX3MaSwitchedToBullishState = iConditions.isX3MaSwitchedToBullishState;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isVWapSwitchedToBullishOrdered)
|
||||
{
|
||||
isVWapSwitchedToBullishOrdered = iConditions.isVWapSwitchedToBullishOrdered;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isX3MaSwitchedToBullishOrdered)
|
||||
{
|
||||
isX3MaSwitchedToBullishOrdered = iConditions.isX3MaSwitchedToBullishOrdered;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
|
||||
//
|
||||
if (!hasNewPeakOverLast)
|
||||
{
|
||||
hasNewPeakOverLast = iConditions.isNewPeakOverLast;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isStrSwitchedToBearish)
|
||||
{
|
||||
isStrSwitchedToBearish = iConditions.isStrSwitchedToBearish;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isSarSwitchedToBearish)
|
||||
{
|
||||
isSarSwitchedToBearish = iConditions.isSarSwitchedToBearish;
|
||||
}
|
||||
|
||||
//
|
||||
if (!hasPeakGoldenZoneBreak)
|
||||
{
|
||||
//
|
||||
hasPeakGoldenZoneBreak =
|
||||
iBar.IsBearish() &&
|
||||
iBar.GetUp() > iConditions.peaksGoldenBuffer[1] &&
|
||||
iBar.GetDown() < iConditions.peaksGoldenBuffer[1];
|
||||
}
|
||||
|
||||
//
|
||||
if (!isSMHKSwitchedToBearish)
|
||||
{
|
||||
isSMHKSwitchedToBearish = iConditions.isSMHKSwitchedToBearish;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isVWapSwitchedToBearishState)
|
||||
{
|
||||
isVWapSwitchedToBearishState = iConditions.isVWapSwitchedToBearishState;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isX3MaSwitchedToBearishState)
|
||||
{
|
||||
isX3MaSwitchedToBearishState = iConditions.isX3MaSwitchedToBearishState;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isVWapSwitchedToBearishOrdered)
|
||||
{
|
||||
isVWapSwitchedToBearishOrdered = iConditions.isVWapSwitchedToBearishOrdered;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isX3MaSwitchedToBearishOrdered)
|
||||
{
|
||||
isX3MaSwitchedToBearishOrdered = iConditions.isX3MaSwitchedToBearishOrdered;
|
||||
}
|
||||
|
||||
//
|
||||
iConditions.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish Conditions Summary ...
|
||||
|
||||
//
|
||||
bool hasBullishOrConditions =
|
||||
hasNewValeUnderLast ||
|
||||
isStrSwitchedToBullish ||
|
||||
isSarSwitchedToBullish ||
|
||||
hasValueGoldenZoneBreak ||
|
||||
isSMHKSwitchedToBullish ||
|
||||
isVWapSwitchedToBullishState ||
|
||||
isX3MaSwitchedToBullishState ||
|
||||
isVWapSwitchedToBullishOrdered ||
|
||||
isX3MaSwitchedToBullishOrdered;
|
||||
|
||||
//
|
||||
bool hasBullishAndConditions =
|
||||
hasNewValeUnderLast &&
|
||||
hasValueGoldenZoneBreak &&
|
||||
(isStrSwitchedToBullish ||
|
||||
isSarSwitchedToBullish ||
|
||||
isSMHKSwitchedToBullish ||
|
||||
isVWapSwitchedToBullishState ||
|
||||
isX3MaSwitchedToBullishState ||
|
||||
isVWapSwitchedToBullishOrdered ||
|
||||
isX3MaSwitchedToBullishOrdered);
|
||||
|
||||
//
|
||||
// Bearish Conditions Summary ...
|
||||
|
||||
//
|
||||
bool hasBearishOrConditions =
|
||||
hasNewPeakOverLast ||
|
||||
isStrSwitchedToBearish ||
|
||||
isSarSwitchedToBearish ||
|
||||
hasPeakGoldenZoneBreak ||
|
||||
isSMHKSwitchedToBearish ||
|
||||
isVWapSwitchedToBearishState ||
|
||||
isX3MaSwitchedToBearishState ||
|
||||
isVWapSwitchedToBearishOrdered ||
|
||||
isX3MaSwitchedToBearishOrdered;
|
||||
|
||||
//
|
||||
bool hasBearishAndConditions =
|
||||
hasNewPeakOverLast &&
|
||||
hasPeakGoldenZoneBreak &&
|
||||
(isStrSwitchedToBearish ||
|
||||
isSarSwitchedToBearish ||
|
||||
isSMHKSwitchedToBearish ||
|
||||
isVWapSwitchedToBearishState ||
|
||||
isX3MaSwitchedToBearishState ||
|
||||
isVWapSwitchedToBearishOrdered ||
|
||||
isX3MaSwitchedToBearishOrdered);
|
||||
|
||||
//
|
||||
bool isBullish =
|
||||
isBoxBullish &&
|
||||
!hasBearishOrConditions &&
|
||||
hasBullishAndConditions;
|
||||
|
||||
//
|
||||
bool isBearish =
|
||||
!isBoxBullish &&
|
||||
!hasBullishOrConditions &&
|
||||
hasBearishAndConditions;
|
||||
|
||||
//
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iBoxObj;
|
||||
XCBoxObject *iInBoxObj;
|
||||
|
||||
//
|
||||
has = provider
|
||||
.verificationCycleHelper
|
||||
.mPOIDrawer
|
||||
.DrawBox(
|
||||
box,
|
||||
iBoxObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBoxObj.BoxWidth(2);
|
||||
iBoxObj.BoxStyle(STYLE_SOLID);
|
||||
}
|
||||
|
||||
//
|
||||
has = provider
|
||||
.verificationCycleHelper
|
||||
.mPOIDrawer
|
||||
.DrawBox(
|
||||
selectedBox,
|
||||
iInBoxObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iInBoxObj.BoxWidth(2);
|
||||
iInBoxObj.BoxStyle(STYLE_DASH);
|
||||
}
|
||||
|
||||
//
|
||||
Print("Inside Selected Box ...");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
cState.Clean();
|
||||
Clean(tmpBoxes);
|
||||
selectedBox.Clean();
|
||||
ZeroMemory(cHelper);
|
||||
cConditions.Clean();
|
||||
cXConditions.Clean();
|
||||
cStateEvents.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Signalling Conditions Parsers ...
|
||||
|
||||
//
|
||||
// Detect Signals Based On XPV Indicator Golden Zones ...
|
||||
bool HasXPVConditions(
|
||||
bool HasXINDConditions(
|
||||
XBoxZone &waitingBoxes[],
|
||||
XBoxZone &ctivtedBoxes[],
|
||||
XBoxZone &activatedBoxes[],
|
||||
XBoxZone &breakedBoxes[],
|
||||
ENUM_X_CYCLES cycle,
|
||||
XBoxZone &box,
|
||||
XBoxZone &zone,
|
||||
ENUM_X_DIRECTION &dir,
|
||||
X121SMCStrategySignalProviderData &provider,
|
||||
int barIndex = 0 //
|
||||
@@ -244,8 +696,15 @@ bool HasXPVConditions(
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
zone.Clean();
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
// Checking Required Zone Boxes for Signalling ...
|
||||
int waitingBoxesCount = ArraySize(waitingBoxes);
|
||||
int breakedBoxesCount = ArraySize(breakedBoxes);
|
||||
int activatedBoxesCount = ArraySize(activatedBoxes);
|
||||
|
||||
//
|
||||
// Fil Selected Data ...
|
||||
XPOIState cState;
|
||||
@@ -336,115 +795,97 @@ bool HasXPVConditions(
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Conditions ...
|
||||
|
||||
//
|
||||
// Retrieve Some Values ...
|
||||
|
||||
//
|
||||
double peak = cXConditions.peaksBuffer[cIDX];
|
||||
double peakZ = cXConditions.peaksBuffer[zIDX];
|
||||
double peakP = cXConditions.peaksBuffer[pIDX];
|
||||
double peakPP = cXConditions.peaksBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double vale = cXConditions.valesBuffer[cIDX];
|
||||
double valeZ = cXConditions.valesBuffer[zIDX];
|
||||
double valeP = cXConditions.valesBuffer[pIDX];
|
||||
double valePP = cXConditions.valesBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double cSMHKOpen = cXConditions.xhkSMOpenBuffer[cIDX];
|
||||
double cSMHKHigh = cXConditions.xhkSMHighBuffer[cIDX];
|
||||
double cSMHKClose = cXConditions.xhkSMCloseBuffer[cIDX];
|
||||
double cSMHKLow = cXConditions.xhkSMLowBuffer[cIDX];
|
||||
double cSMHKMin = MathMin(cSMHKOpen, cSMHKClose);
|
||||
double cSMHKMax = MathMax(cSMHKOpen, cSMHKClose);
|
||||
|
||||
//
|
||||
double pSMHKOpen = cXConditions.xhkSMOpenBuffer[pIDX];
|
||||
double pSMHKHigh = cXConditions.xhkSMHighBuffer[pIDX];
|
||||
double pSMHKClose = cXConditions.xhkSMCloseBuffer[pIDX];
|
||||
double pSMHKLow = cXConditions.xhkSMLowBuffer[pIDX];
|
||||
double pSMHKMin = MathMin(pSMHKOpen, pSMHKClose);
|
||||
double pSMHKMax = MathMax(pSMHKOpen, pSMHKClose);
|
||||
|
||||
//
|
||||
double atrUpperSM = cXConditions.atrUpperSMBuffer[cIDX];
|
||||
double atrLowerSM = cXConditions.atrLowerSMBuffer[cIDX];
|
||||
|
||||
//
|
||||
double atrUpperSMZ = cXConditions.atrUpperSMBuffer[zIDX];
|
||||
double atrLowerSMZ = cXConditions.atrLowerSMBuffer[zIDX];
|
||||
|
||||
//
|
||||
double atrUpperSMP = cXConditions.atrUpperSMBuffer[pIDX];
|
||||
double atrLowerSMP = cXConditions.atrLowerSMBuffer[pIDX];
|
||||
|
||||
//
|
||||
double atrUpperSMPP = cXConditions.atrUpperSMBuffer[ppIDX];
|
||||
double atrLowerSMPP = cXConditions.atrLowerSMBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double rsiChange = cXConditions.rsiChangeBuffer[cIDX];
|
||||
double rsiChangeZ = cXConditions.rsiChangeBuffer[zIDX];
|
||||
double rsiChangeP = cXConditions.rsiChangeBuffer[pIDX];
|
||||
double rsiChangePP = cXConditions.rsiChangeBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double rsiChangeSM = cXConditions.rsiChangeSMBuffer[cIDX];
|
||||
double rsiChangeSMZ = cXConditions.rsiChangeSMBuffer[zIDX];
|
||||
double rsiChangeSMP = cXConditions.rsiChangeSMBuffer[pIDX];
|
||||
double rsiChangeSMPP = cXConditions.rsiChangeSMBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double peaksGolden = cXConditions.peaksGoldenBuffer[cIDX];
|
||||
double peaksGoldenZ = cXConditions.peaksGoldenBuffer[zIDX];
|
||||
double peaksGoldenP = cXConditions.peaksGoldenBuffer[pIDX];
|
||||
double peaksGoldenPP = cXConditions.peaksGoldenBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double valesGolden = cXConditions.valesGoldenBuffer[cIDX];
|
||||
double valesGoldenZ = cXConditions.valesGoldenBuffer[zIDX];
|
||||
double valesGoldenP = cXConditions.valesGoldenBuffer[pIDX];
|
||||
double valesGoldenPP = cXConditions.valesGoldenBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double priceChange = cXConditions.priceChangeBuffer[cIDX];
|
||||
double priceChangeZ = cXConditions.priceChangeBuffer[zIDX];
|
||||
double priceChangeP = cXConditions.priceChangeBuffer[pIDX];
|
||||
double priceChangePP = cXConditions.priceChangeBuffer[ppIDX];
|
||||
|
||||
//
|
||||
double priceChangeSM = cXConditions.priceChangeSMBuffer[cIDX];
|
||||
double priceChangeSMZ = cXConditions.priceChangeSMBuffer[zIDX];
|
||||
double priceChangeSMP = cXConditions.priceChangeSMBuffer[pIDX];
|
||||
double priceChangeSMPP = cXConditions.priceChangeSMBuffer[ppIDX];
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// XHK ...
|
||||
|
||||
//
|
||||
bool isPBarClosedOverSMHK =
|
||||
// Select Waiting Box ...
|
||||
XBoxZone selectedBox;
|
||||
bool hasSelectedBox = false;
|
||||
bool useWaitingBoxes = false;
|
||||
bool useActivtedBoxes = false;
|
||||
bool useBreakedBoxes = false;
|
||||
if (useWaitingBoxes && IsValidSize(waitingBoxesCount))
|
||||
{
|
||||
//
|
||||
pBar.IsBullish() &&
|
||||
pBar.GetUp() > pSMHKMax &&
|
||||
pBar.GetDown() < pSMHKMin
|
||||
for (int i = 0; i < waitingBoxesCount; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = waitingBoxes[i];
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
;
|
||||
hasSelectedBox = selectedBox.IsValid();
|
||||
if (!hasSelectedBox)
|
||||
{
|
||||
selectedBox.Clean();
|
||||
}
|
||||
}
|
||||
if (useActivtedBoxes && !hasSelectedBox && IsValidSize(activatedBoxesCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < activatedBoxesCount; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = activatedBoxes[i];
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
hasSelectedBox = selectedBox.IsValid();
|
||||
if (!hasSelectedBox)
|
||||
{
|
||||
selectedBox.Clean();
|
||||
}
|
||||
}
|
||||
if (useBreakedBoxes && !hasSelectedBox && IsValidSize(breakedBoxesCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < breakedBoxesCount; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = breakedBoxes[i];
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
hasSelectedBox = selectedBox.IsValid();
|
||||
if (!hasSelectedBox)
|
||||
{
|
||||
selectedBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool isPBarClosedUnderSMHK =
|
||||
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
||||
if (hasSelectedBox)
|
||||
{
|
||||
//
|
||||
pBar.IsBearish() &&
|
||||
pBar.GetUp() > pSMHKMax &&
|
||||
pBar.GetDown() < pSMHKMin
|
||||
//
|
||||
;
|
||||
selectedBox.to = zBar.time;
|
||||
XCBoxObject *iObj;
|
||||
has = drawer.DrawBox(
|
||||
selectedBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iObj.BoxColor(clrCornflowerBlue);
|
||||
iObj.BoxStyle(STYLE_SOLID);
|
||||
iObj.BoxWidth(2);
|
||||
|
||||
//
|
||||
Print("Selected Box ...");
|
||||
}
|
||||
}
|
||||
ZeroMemory(drawer);
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
//
|
||||
@@ -458,6 +899,7 @@ bool HasXPVConditions(
|
||||
//
|
||||
false
|
||||
//
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
@@ -465,6 +907,7 @@ bool HasXPVConditions(
|
||||
//
|
||||
false
|
||||
//
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
@@ -492,7 +935,8 @@ bool HasXPVConditions(
|
||||
|
||||
//
|
||||
// Usually is Preffered SL ...
|
||||
double pivot = 0;
|
||||
double pivot =
|
||||
0;
|
||||
|
||||
//
|
||||
// Usually is Current Price or Entry Price ...
|
||||
@@ -514,28 +958,31 @@ bool HasXPVConditions(
|
||||
: point;
|
||||
|
||||
//
|
||||
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
||||
bool drawBoxes = true;
|
||||
if (drawBoxes)
|
||||
{
|
||||
//
|
||||
if (box.IsValid())
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
bool isCreated = drawer.DrawBox(
|
||||
box,
|
||||
iObj //
|
||||
);
|
||||
zone = selectedBox;
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
// TODO: ...
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
||||
// bool drawBoxes = true;
|
||||
// if (drawBoxes)
|
||||
// {
|
||||
// //
|
||||
// if (box.IsValid())
|
||||
// {
|
||||
// //
|
||||
// XCBoxObject *iObj;
|
||||
// bool isCreated = drawer.DrawBox(
|
||||
// box,
|
||||
// iObj //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// // TODO: ...
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
@@ -556,6 +1003,7 @@ bool HasXPVConditions(
|
||||
cConditions.Clean();
|
||||
cConditions.Clean();
|
||||
ZeroMemory(cHelper);
|
||||
selectedBox.Clean();
|
||||
cStateEvents.Clean();
|
||||
cXConditions.Clean();
|
||||
|
||||
@@ -563,4 +1011,8 @@ bool HasXPVConditions(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user