last ...
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Draw ...
|
||||
//
|
||||
@@ -228,3 +231,264 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// if (hasPriceBox && hasYoungestOB)
|
||||
// {
|
||||
// //
|
||||
// X121SMCCycleState iState;
|
||||
// bool iHasState = visionCycleHelper.GetCycleState(iState);
|
||||
// if (iHasState)
|
||||
// {
|
||||
// //
|
||||
// // Retrieve Youngest Order Blocks ...
|
||||
// XCOrderBlock *iYOB;
|
||||
// bool iHasYoungestOB = iState.GetYoungestOB(iYOB);
|
||||
// if (iHasYoungestOB)
|
||||
// {
|
||||
// //
|
||||
// bool isCreate = false;
|
||||
// bool isYoungestBullish = iYOB.IsBullish();
|
||||
// if (isYoungestBullish)
|
||||
// {
|
||||
// //
|
||||
// // XCBullishOrderBlockObject *iObj;
|
||||
// // isCreate = visionCycleHelper.mPOIDrawer.CreateBullishOrderBlock(
|
||||
// // iYOB,
|
||||
// // iObj //
|
||||
// // );
|
||||
|
||||
// // //
|
||||
// // if (isCreate) {
|
||||
// // //
|
||||
// // iObj.ZoneColor(clrAqua);
|
||||
// // iObj.ZoneWidth(4);
|
||||
// // }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //
|
||||
// // XCBearishOrderBlockObject *iObj;
|
||||
// // isCreate = visionCycleHelper.mPOIDrawer.CreateBearishOrderBlock(
|
||||
// // iYOB,
|
||||
// // iObj //
|
||||
// // );
|
||||
|
||||
// // //
|
||||
// // if (isCreate) {
|
||||
// // //
|
||||
// // iObj.ZoneColor(clrMagenta);
|
||||
// // iObj.ZoneWidth(4);
|
||||
// // }
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Compare it with current Condition PriceOB ...
|
||||
// bool isSame =
|
||||
// //
|
||||
// conditions.priceOB.Upper() == iYOB.Upper() &&
|
||||
// conditions.priceOB.Lower() == iYOB.Lower() &&
|
||||
// conditions.priceOB.From() == iYOB.From() &&
|
||||
// conditions.priceOB.Type() == iYOB.Type()
|
||||
// //
|
||||
// ;
|
||||
// if (!isSame)
|
||||
// {
|
||||
// conditions.Clean();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// bool canReset =
|
||||
// //
|
||||
// hasPriceBox &&
|
||||
// conditions.isPriceOBActed &&
|
||||
// conditions.isPriceOBBreaked &&
|
||||
// //
|
||||
// (
|
||||
// //
|
||||
// IsBullish(conditions.priceBox.dir)
|
||||
// ? pBar.high < lower &&
|
||||
// cBar.high < lower
|
||||
// : pBar.low > upper &&
|
||||
// cBar.low > upper
|
||||
// //
|
||||
// )
|
||||
// //
|
||||
// ;
|
||||
// if (canReset)
|
||||
// {
|
||||
// //
|
||||
// Print("canReset");
|
||||
// }
|
||||
|
||||
//
|
||||
// Check Conditions Clean Senario ...
|
||||
// bool canResetConditions =
|
||||
// //
|
||||
// hasPriceBox &&
|
||||
// !isPriceOBValid &&
|
||||
// conditions.priceOB != NULL &&
|
||||
// conditions.priceOB.IsValid()
|
||||
// //
|
||||
// ;
|
||||
// bool canReset2 =
|
||||
// //
|
||||
// conditions.priceOB != NULL &&
|
||||
// (
|
||||
// //
|
||||
// (
|
||||
// //
|
||||
// conditions.priceOB.IsBullish()
|
||||
// ? hh < conditions.priceOB.Lower()
|
||||
// : ll > conditions.priceOB.Upper()
|
||||
// //
|
||||
// )
|
||||
// //
|
||||
// ||
|
||||
// //
|
||||
// (
|
||||
// //
|
||||
// conditions.priceOB.IsBullish()
|
||||
// ? ll50 > conditions.priceOB.Upper()
|
||||
// : hh50 < conditions.priceOB.Lower()
|
||||
// //
|
||||
// )
|
||||
// //
|
||||
// )
|
||||
// //
|
||||
// ;
|
||||
|
||||
// if (canResetConditions)
|
||||
// {
|
||||
// Print("canResetConditions");
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
X121SMCCycleState iState;
|
||||
bool iHasState = visionCycleHelper.GetCycleState(iState);
|
||||
if (iHasState)
|
||||
{
|
||||
//
|
||||
// Check Price Inside Box ...
|
||||
XBoxZone iPriceBox;
|
||||
XCOrderBlock *iPriceOB = NULL;
|
||||
bool iHasPriceBox = DetectPriceInsideBox(
|
||||
iPriceBox,
|
||||
iPriceOB,
|
||||
decisionXConditions,
|
||||
iState //
|
||||
);
|
||||
|
||||
//
|
||||
if (iHasPriceBox) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// //
|
||||
// // 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 //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ struct X121SMCStrategyXHKPVSignalConditions
|
||||
|
||||
//
|
||||
XBoxZone priceBox;
|
||||
datetime priceOBAt;
|
||||
bool isPriceOBActed;
|
||||
bool isPriceOBBreaked;
|
||||
XCOrderBlock *priceOB;
|
||||
@@ -183,6 +184,7 @@ struct X121SMCStrategyXHKPVSignalConditions
|
||||
state.Clean();
|
||||
priceOB = NULL;
|
||||
priceBox.Clean();
|
||||
priceOBAt = NULL;
|
||||
isPriceOBActed = false;
|
||||
isPriceOBBreaked = false;
|
||||
}
|
||||
@@ -211,7 +213,9 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
XC121SMCCycleHelper *analyseCycleHelper,
|
||||
XC121SMCCycleHelper *verificationCycleHelper,
|
||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||
XC121SMCCycleHelper *visionCycleHelper
|
||||
XC121SMCCycleHelper *visionCycleHelper,
|
||||
//
|
||||
int resetAfterUnActedZoneInMinutes = 120
|
||||
//
|
||||
)
|
||||
{
|
||||
@@ -282,9 +286,11 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
double points = GetPoints(symbol);
|
||||
|
||||
//
|
||||
int swingLoopback = 3;
|
||||
int swingLoopback = 7;
|
||||
double ll = cBar.FindLowest(swingLoopback, MODE_LOW);
|
||||
double hh = cBar.FindHighest(swingLoopback, MODE_HIGH);
|
||||
double ll50 = cBar.FindLowest(50, MODE_LOW);
|
||||
double hh50 = cBar.FindHighest(50, MODE_HIGH);
|
||||
double llDown = cBar.FindLowesttDown(swingLoopback);
|
||||
double hhUp = cBar.FindHighestUp(swingLoopback);
|
||||
|
||||
@@ -720,6 +726,10 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
decisionXConditions,
|
||||
conditions.state //
|
||||
);
|
||||
if (hasPriceBox)
|
||||
{
|
||||
conditions.priceOBAt = cTime;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -892,101 +902,101 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw ...
|
||||
XCBaseObject *drawnObjects[];
|
||||
int drawnObjectsCount = visionCycleHelper.DrawCycleState(
|
||||
conditions.state,
|
||||
drawnObjects //
|
||||
);
|
||||
// //
|
||||
// // Draw ...
|
||||
// XCBaseObject *drawnObjects[];
|
||||
// int drawnObjectsCount = visionCycleHelper.DrawCycleState(
|
||||
// conditions.state,
|
||||
// drawnObjects //
|
||||
// );
|
||||
|
||||
//
|
||||
if (hasPriceBox)
|
||||
{
|
||||
//
|
||||
bool isBullish = IsBullish(conditions.priceBox.dir);
|
||||
color boxColor = isBullish ? clrYellow : clrOrange;
|
||||
// //
|
||||
// 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 //
|
||||
);
|
||||
// //
|
||||
// XCBoxObject *iObj;
|
||||
// bool isCreated = visionCycleHelper.mPOIDrawer.CreateBox(
|
||||
// conditions.priceBox,
|
||||
// iObj,
|
||||
// boxColor,
|
||||
// 1,
|
||||
// false,
|
||||
// STYLE_DASHDOTDOT //
|
||||
// );
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// Add(
|
||||
// (XCBaseObject *)iObj,
|
||||
// drawnObjects //
|
||||
// );
|
||||
// }
|
||||
|
||||
//
|
||||
XCBaseObject *priceOBObj = NULL;
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XCBullishOrderBlockObject *iObj;
|
||||
isCreated = visionCycleHelper
|
||||
.mPOIDrawer
|
||||
.CreateBullishOrderBlock(
|
||||
conditions.priceOB,
|
||||
iObj //
|
||||
);
|
||||
// //
|
||||
// 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);
|
||||
// //
|
||||
// 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 //
|
||||
);
|
||||
// //
|
||||
// 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);
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// iObj.ZoneWidth(2);
|
||||
// iObj.ZoneColor(boxColor);
|
||||
// iObj.ZoneStyle(STYLE_SOLID);
|
||||
|
||||
//
|
||||
priceOBObj = (XCBaseObject *)iObj;
|
||||
}
|
||||
}
|
||||
// //
|
||||
// priceOBObj = (XCBaseObject *)iObj;
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
priceOBObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// Add(
|
||||
// priceOBObj,
|
||||
// drawnObjects //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
//
|
||||
@@ -1383,61 +1393,23 @@ bool DetectX121SMCXHKPVSignalSetup(
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
if (hasPriceBox && hasYoungestOB)
|
||||
// Detect PriceOB Lifetime Bars ...
|
||||
if (hasPriceBox)
|
||||
{
|
||||
//
|
||||
X121SMCCycleState iState;
|
||||
bool iHasState = visionCycleHelper.GetCycleState(iState);
|
||||
if (iHasState)
|
||||
{
|
||||
int obLifetimeBars = (int)(cTime - conditions.priceOBAt) / PeriodSeconds(PERIOD_M1);
|
||||
bool canReset =
|
||||
//
|
||||
// Retrieve Youngest Order Blocks ...
|
||||
XCOrderBlock *iYOB;
|
||||
bool iHasYoungestOB = iState.GetYoungestOB(iYOB);
|
||||
if (iHasYoungestOB)
|
||||
{
|
||||
//
|
||||
// Compare it with current Condition PriceOB ...
|
||||
bool isSame =
|
||||
//
|
||||
conditions.priceOB.Upper() == iYOB.Upper() &&
|
||||
conditions.priceOB.Lower() == iYOB.Lower() &&
|
||||
conditions.priceOB.From() == iYOB.From() &&
|
||||
conditions.priceOB.Type() == iYOB.Type()
|
||||
//
|
||||
;
|
||||
if (!isSame)
|
||||
{
|
||||
conditions.Clean();
|
||||
}
|
||||
}
|
||||
!conditions.isPriceOBActed &&
|
||||
obLifetimeBars >= resetAfterUnActedZoneInMinutes
|
||||
//
|
||||
;
|
||||
if (canReset)
|
||||
{
|
||||
conditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// bool canReset =
|
||||
// //
|
||||
// hasPriceBox &&
|
||||
// conditions.isPriceOBActed &&
|
||||
// conditions.isPriceOBBreaked &&
|
||||
// //
|
||||
// (
|
||||
// //
|
||||
// IsBullish(conditions.priceBox.dir)
|
||||
// ? pBar.high < lower &&
|
||||
// cBar.high < lower
|
||||
// : pBar.low > upper &&
|
||||
// cBar.low > upper
|
||||
// //
|
||||
// )
|
||||
// //
|
||||
// ;
|
||||
// if (canReset)
|
||||
// {
|
||||
// //
|
||||
// Print("canReset");
|
||||
// }
|
||||
|
||||
//
|
||||
// Cleanup Arrays ...
|
||||
ArrayFree(triggerPoiEvents);
|
||||
|
||||
@@ -1159,7 +1159,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
useXSignal = false;
|
||||
useXHKPVSignal = true;
|
||||
useXOBPVSignal = false;
|
||||
useXOBPVSignal = true;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
|
||||
Reference in New Issue
Block a user