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