last ...
This commit is contained in:
@@ -122,6 +122,9 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
double point;
|
||||
XPVPivot pivot;
|
||||
|
||||
//
|
||||
XConsolidationZone consolidationZone;
|
||||
|
||||
//
|
||||
string method;
|
||||
|
||||
@@ -256,6 +259,7 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
//
|
||||
point = 0;
|
||||
pivot.Clean();
|
||||
consolidationZone.Clean();
|
||||
|
||||
//
|
||||
method = NULL;
|
||||
@@ -419,6 +423,16 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
return pivot.IsValid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Model Has Consolidation Zone or not ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasConsolidationZone()
|
||||
{
|
||||
return consolidationZone.IsValid();
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
@@ -515,14 +529,6 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
double llDown = cBar.FindLowesttDown(swingLoopback);
|
||||
double hhUp = cBar.FindHighestUp(swingLoopback);
|
||||
|
||||
//
|
||||
int zoneValidationDivider = 10;
|
||||
int validPivotRepetition = triggerCycleHelper.mX121Helper
|
||||
.GetDonChainLength();
|
||||
|
||||
//
|
||||
double selectedSL = 0;
|
||||
|
||||
//
|
||||
// Cycles Conditions ...
|
||||
|
||||
@@ -640,36 +646,43 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
//
|
||||
// Setup Conditions ...
|
||||
|
||||
// //
|
||||
// // Select Sources ...
|
||||
// XC121SMCCycleHelper *helper = analyseCycleHelper;
|
||||
// X121SMCCycleConditions helperConditions = analyseConditions;
|
||||
// XPOIState helperState = analyseState;
|
||||
|
||||
//
|
||||
// Select Sources ...
|
||||
XC121SMCCycleHelper *helper = analyseCycleHelper;
|
||||
X121SMCCycleConditions helperConditions = analyseConditions;
|
||||
XPOIState helperState = analyseState;
|
||||
|
||||
//
|
||||
// Instance Helper CBar ...
|
||||
XOHCL helperCBar;
|
||||
result = helper.GetBar(
|
||||
XOHCL analyseCBar;
|
||||
result = analyseCycleHelper.GetBar(
|
||||
cBar,
|
||||
helperCBar //
|
||||
analyseCBar //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL analysePBar;
|
||||
result = analyseCBar.GetPreviousBar(analysePBar);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double bullishFib = GetFibonacciLevel(
|
||||
helperCBar.high,
|
||||
helperCBar.low,
|
||||
analyseCBar.high,
|
||||
analyseCBar.low,
|
||||
GetFiboLevelValue(X_FIBO_LEVEL_382),
|
||||
-1 //
|
||||
);
|
||||
|
||||
//
|
||||
double bearishFib = GetFibonacciLevel(
|
||||
helperCBar.high,
|
||||
helperCBar.low,
|
||||
analyseCBar.high,
|
||||
analyseCBar.low,
|
||||
GetFiboLevelValue(X_FIBO_LEVEL_382),
|
||||
1 //
|
||||
);
|
||||
@@ -705,12 +718,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
|
||||
//
|
||||
XPVPivot peakPivot;
|
||||
bool hasPeakPivot = helper
|
||||
bool hasPeakPivot = analyseCycleHelper
|
||||
.GetActivePeakPivot(peakPivot);
|
||||
|
||||
//
|
||||
XPVPivot valePivot;
|
||||
bool hasValePivot = helper
|
||||
bool hasValePivot = analyseCycleHelper
|
||||
.GetActiveValePivot(valePivot);
|
||||
|
||||
//
|
||||
@@ -755,7 +768,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
{
|
||||
//
|
||||
conditions.pivot.to = cTime;
|
||||
helper.FillPivotState(conditions.pivot);
|
||||
analyseCycleHelper.FillPivotState(conditions.pivot);
|
||||
|
||||
//
|
||||
// Check Pivot Renewation ...
|
||||
@@ -886,24 +899,24 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
// PV Conditions ...
|
||||
|
||||
//
|
||||
double peak = helperConditions.x121Conditions.peaksBuffer[1];
|
||||
double peakPrev = helperConditions.x121Conditions.peaksBuffer[2];
|
||||
double peakDiff = MathAbs(peakPrev - peak);
|
||||
double analysePeak = analyseConditions.x121Conditions.peaksBuffer[1];
|
||||
double analysePeakPrev = analyseConditions.x121Conditions.peaksBuffer[2];
|
||||
double analysePeakDiff = MathAbs(analysePeakPrev - analysePeak);
|
||||
|
||||
//
|
||||
bool isNewPeak = helperConditions.x121Conditions.isNewPeak;
|
||||
bool isNewPeakOverLast = helperConditions.x121Conditions.isNewPeakOverLast;
|
||||
bool isNewPeakUnderLast = helperConditions.x121Conditions.isNewPeakUnderLast;
|
||||
bool isNewAnalysePeak = analyseConditions.x121Conditions.isNewPeak;
|
||||
bool isNewAnalysePeakOverLast = analyseConditions.x121Conditions.isNewPeakOverLast;
|
||||
bool isNewAnalysePeakUnderLast = analyseConditions.x121Conditions.isNewPeakUnderLast;
|
||||
|
||||
//
|
||||
double vale = helperConditions.x121Conditions.valesBuffer[1];
|
||||
double valePrev = helperConditions.x121Conditions.valesBuffer[2];
|
||||
double valeDiff = MathAbs(valePrev - vale);
|
||||
double analyseVale = analyseConditions.x121Conditions.valesBuffer[1];
|
||||
double analyseValePrev = analyseConditions.x121Conditions.valesBuffer[2];
|
||||
double analyseValeDiff = MathAbs(analyseValePrev - analyseVale);
|
||||
|
||||
//
|
||||
bool isNewVale = helperConditions.x121Conditions.isNewVale;
|
||||
bool isNewValeOverLast = helperConditions.x121Conditions.isNewValeOverLast;
|
||||
bool isNewValeUnderLast = helperConditions.x121Conditions.isNewValeUnderLast;
|
||||
bool isNewAnalyseVale = analyseConditions.x121Conditions.isNewVale;
|
||||
bool isNewAnalyseValeOverLast = analyseConditions.x121Conditions.isNewValeOverLast;
|
||||
bool isNewAnalyseValeUnderLast = analyseConditions.x121Conditions.isNewValeUnderLast;
|
||||
|
||||
//
|
||||
double triggerPeak = triggerConditions.x121Conditions.peaksBuffer[1];
|
||||
@@ -911,19 +924,19 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
|
||||
//
|
||||
int condition2MinPVDiffPoint = 30;
|
||||
bool isPeakDiffPointPassed = peakDiff >= (condition2MinPVDiffPoint * points);
|
||||
bool isValeDiffPointPassed = valeDiff >= (condition2MinPVDiffPoint * points);
|
||||
bool isPeakDiffPointPassed = analysePeakDiff >= (condition2MinPVDiffPoint * points);
|
||||
bool isValeDiffPointPassed = analyseValeDiff >= (condition2MinPVDiffPoint * points);
|
||||
|
||||
//
|
||||
// DONCHAIN Conditions ...
|
||||
|
||||
//
|
||||
double donCloseUpper = helperConditions.x121Conditions.donCloseUpperBuffer[1];
|
||||
double donCloseLower = helperConditions.x121Conditions.donCloseLowerBuffer[1];
|
||||
// //
|
||||
// double analyseDonCloseUpper = analyseConditions.x121Conditions.donCloseUpperBuffer[1];
|
||||
// double analyseDonCloseLower = analyseConditions.x121Conditions.donCloseLowerBuffer[1];
|
||||
|
||||
//
|
||||
double donOpenUpper = helperConditions.x121Conditions.donOpenUpperBuffer[1];
|
||||
double donOpenLower = helperConditions.x121Conditions.donOpenLowerBuffer[1];
|
||||
// //
|
||||
// double analyseonOpenUpper = analyseConditions.x121Conditions.donOpenUpperBuffer[1];
|
||||
// double analyseonOpenLower = analyseConditions.x121Conditions.donOpenLowerBuffer[1];
|
||||
|
||||
//
|
||||
// OPEN ...
|
||||
@@ -1029,12 +1042,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (isRejectDonUpper ||
|
||||
isRejectDonLower)
|
||||
{
|
||||
Print("Don Rejected ...");
|
||||
}
|
||||
// //
|
||||
// if (isRejectDonUpper ||
|
||||
// isRejectDonLower)
|
||||
// {
|
||||
// Print("Don Rejected ...");
|
||||
// }
|
||||
|
||||
//
|
||||
bool isBreakedDonUpper =
|
||||
@@ -1073,12 +1086,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
//
|
||||
// false
|
||||
hasBullishTrend &&
|
||||
isNewPeakOverLast &&
|
||||
isBullishFiboPassed &&
|
||||
helperCBar.IsBullish() &&
|
||||
conditions.pivot.upper < peak &&
|
||||
conditions.pivot.upper < helperCBar.GetUp() &&
|
||||
conditions.pivot.upper > helperCBar.GetDown()
|
||||
analyseCBar.IsBullish() &&
|
||||
isNewAnalysePeakOverLast &&
|
||||
conditions.pivot.upper < analysePeak &&
|
||||
conditions.pivot.upper < analyseCBar.GetUp() &&
|
||||
conditions.pivot.upper > analyseCBar.GetDown()
|
||||
//
|
||||
;
|
||||
if (bullishConditions1)
|
||||
@@ -1094,12 +1107,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
//
|
||||
// false
|
||||
hasBearishTrend &&
|
||||
isNewValeUnderLast &&
|
||||
isBearishFiboPassed &&
|
||||
helperCBar.IsBearish() &&
|
||||
conditions.pivot.lower > vale &&
|
||||
conditions.pivot.lower < helperCBar.GetUp() &&
|
||||
conditions.pivot.lower > helperCBar.GetDown()
|
||||
analyseCBar.IsBearish() &&
|
||||
isNewAnalyseValeUnderLast &&
|
||||
conditions.pivot.lower > analyseVale &&
|
||||
conditions.pivot.lower < analyseCBar.GetUp() &&
|
||||
conditions.pivot.lower > analyseCBar.GetDown()
|
||||
//
|
||||
;
|
||||
if (bearishConditions1)
|
||||
@@ -1126,7 +1139,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
if (bullishConditions2)
|
||||
{
|
||||
//
|
||||
conditions.point = vale;
|
||||
conditions.point = analyseVale;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2);
|
||||
}
|
||||
|
||||
@@ -1144,7 +1157,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
if (bearishConditions2)
|
||||
{
|
||||
//
|
||||
conditions.point = peak;
|
||||
conditions.point = analysePeak;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2);
|
||||
}
|
||||
|
||||
@@ -1161,7 +1174,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
if (bullishConditions3)
|
||||
{
|
||||
//
|
||||
conditions.point = vale;
|
||||
conditions.point = analyseVale;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3);
|
||||
}
|
||||
|
||||
@@ -1175,7 +1188,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
if (bearishConditions3)
|
||||
{
|
||||
//
|
||||
conditions.point = peak;
|
||||
conditions.point = analysePeak;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3);
|
||||
}
|
||||
|
||||
@@ -1306,22 +1319,30 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = pBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
pIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double ask = GetAsk(symbol);
|
||||
double bid = GetBid(symbol);
|
||||
datetime cTime = TimeCurrent();
|
||||
double points = GetPoints(symbol);
|
||||
|
||||
//
|
||||
double ll = cBar.FindLowest(9, MODE_LOW);
|
||||
double hh = cBar.FindHighest(9, MODE_HIGH);
|
||||
|
||||
//
|
||||
int zoneValidationDivider = 10;
|
||||
int validPivotRepetition = triggerCycleHelper.mX121Helper
|
||||
.GetDonChainLength();
|
||||
|
||||
//
|
||||
double selectedSL = 0;
|
||||
int swingLoopback = 9;
|
||||
double ll = cBar.FindLowest(swingLoopback, MODE_LOW);
|
||||
double hh = cBar.FindHighest(swingLoopback, MODE_HIGH);
|
||||
double llDown = cBar.FindLowesttDown(swingLoopback);
|
||||
double hhUp = cBar.FindHighestUp(swingLoopback);
|
||||
|
||||
//
|
||||
// Cycles Conditions ...
|
||||
@@ -1471,21 +1492,30 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
|
||||
//
|
||||
// Detect Consolidation ...
|
||||
XConsolidationZone consolidationZone;
|
||||
bool hasConsolidationZone = triggerCycleHelper
|
||||
.GetLastConsolidationZone(consolidationZone);
|
||||
bool hasConsolidationZone = conditions.HasConsolidationZone();
|
||||
if (hasConsolidationZone)
|
||||
{
|
||||
//
|
||||
hasConsolidationZone =
|
||||
isBullish
|
||||
? consolidationZone.upper <= conditions.point
|
||||
: consolidationZone.lower >= conditions.point;
|
||||
hasConsolidationZone = triggerCycleHelper
|
||||
.GetLastConsolidationZone(conditions.consolidationZone);
|
||||
|
||||
//
|
||||
if (!hasConsolidationZone)
|
||||
if (hasConsolidationZone)
|
||||
{
|
||||
consolidationZone.Clean();
|
||||
//
|
||||
hasConsolidationZone =
|
||||
isBullish
|
||||
? conditions.consolidationZone.upper <= conditions.point
|
||||
: conditions.consolidationZone.lower >= conditions.point;
|
||||
|
||||
//
|
||||
if (!hasConsolidationZone)
|
||||
{
|
||||
//
|
||||
conditions
|
||||
.consolidationZone
|
||||
.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1551,9 +1581,6 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
Opposit(setupDir) //
|
||||
);
|
||||
|
||||
//
|
||||
double points = GetPoints(conditions.symbol);
|
||||
|
||||
//
|
||||
double entry = GetEntry(
|
||||
conditions.symbol,
|
||||
@@ -1569,14 +1596,14 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
if (isBullish)
|
||||
{
|
||||
Add(
|
||||
consolidationZone.lower,
|
||||
conditions.consolidationZone.lower,
|
||||
sls //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Add(
|
||||
consolidationZone.upper,
|
||||
conditions.consolidationZone.upper,
|
||||
sls //
|
||||
);
|
||||
}
|
||||
|
||||
@@ -281,6 +281,16 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
result = PrepareSignal(signal);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
XCSignalObject *iObj;
|
||||
mPOIDrawer.DrawSignal(signal, iObj);
|
||||
Print("");
|
||||
}
|
||||
|
||||
//
|
||||
hasLong = false;
|
||||
hasShort = false;
|
||||
@@ -712,56 +722,74 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
// Handle Required Drawings ...
|
||||
bool hasPivot = mXTWPVConditions.HasPivot();
|
||||
bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones();
|
||||
bool hasConsolidationZone = mXTWPVConditions.HasConsolidationZone();
|
||||
bool canDraw = hasPivot ||
|
||||
hasPriceInsideZone;
|
||||
hasPriceInsideZone ||
|
||||
hasConsolidationZone;
|
||||
if (canDraw)
|
||||
{
|
||||
// //
|
||||
// ClearDraws();
|
||||
//
|
||||
ClearDraws();
|
||||
|
||||
// //
|
||||
// // Draw Pivot Zone ...
|
||||
// if (hasPivot)
|
||||
// {
|
||||
// //
|
||||
// XCBaseObject *drawnObjects[];
|
||||
// int drawnObjectsCount = DrawXTWPVPivotZone(
|
||||
// mXTWPVConditions,
|
||||
// mPOIDrawer,
|
||||
// drawnObjects,
|
||||
// true, // Draw State ...
|
||||
// true, // Draw Ticks Zone ...
|
||||
// true, // Ignore SwingHighs ...
|
||||
// true, // Ignore SwingLows ...
|
||||
// true, // Ignore SupportZones ...
|
||||
// true, // Ignore ResistanceZones ...
|
||||
// true, // Ignore SupplyZones ...
|
||||
// true, // Ignore DemandZones ...
|
||||
// true, // Ignore BullishOrderBlocks ...
|
||||
// true, // Ignore BearishOrderBlocks ...
|
||||
// true, // Ignore BullishFairValueGaps ...
|
||||
// true, // Ignore BearishFairValueGaps ...
|
||||
// true, // Ignore BullishRejectionBars ...
|
||||
// true, // Ignore BearishRejectionBars ...
|
||||
// true, // Ignore BullishMomentumBars ...
|
||||
// true // Ignore BearishMomentumBars ...
|
||||
// );
|
||||
// AddObjectsIfNotExists(drawnObjects);
|
||||
// }
|
||||
//
|
||||
// Draw Consolidation Zone ...
|
||||
if (hasConsolidationZone)
|
||||
{
|
||||
//
|
||||
XCConsolidationZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateConsolidationZone(
|
||||
mXTWPVConditions.consolidationZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
// //
|
||||
// // Draw Price Inside Zones ...
|
||||
// if (hasPriceInsideZone)
|
||||
// {
|
||||
// //
|
||||
// XCBaseObject *drawnObjects[];
|
||||
// int drawnObjectsCount = DrawTWPVPriceInsideZones(
|
||||
// mXTWPVConditions,
|
||||
// mPOIDrawer,
|
||||
// drawnObjects //
|
||||
// );
|
||||
// AddObjectsIfNotExists(drawnObjects);
|
||||
// }
|
||||
//
|
||||
// Draw Pivot Zone ...
|
||||
if (hasPivot)
|
||||
{
|
||||
//
|
||||
XCBaseObject *drawnObjects[];
|
||||
int drawnObjectsCount = DrawXTWPVPivotZone(
|
||||
mXTWPVConditions,
|
||||
mPOIDrawer,
|
||||
drawnObjects,
|
||||
false, // Draw State ...
|
||||
false, // Draw Ticks Zone ...
|
||||
true, // Ignore SwingHighs ...
|
||||
true, // Ignore SwingLows ...
|
||||
true, // Ignore SupportZones ...
|
||||
true, // Ignore ResistanceZones ...
|
||||
true, // Ignore SupplyZones ...
|
||||
true, // Ignore DemandZones ...
|
||||
true, // Ignore BullishOrderBlocks ...
|
||||
true, // Ignore BearishOrderBlocks ...
|
||||
true, // Ignore BullishFairValueGaps ...
|
||||
true, // Ignore BearishFairValueGaps ...
|
||||
true, // Ignore BullishRejectionBars ...
|
||||
true, // Ignore BearishRejectionBars ...
|
||||
true, // Ignore BullishMomentumBars ...
|
||||
true // Ignore BearishMomentumBars ...
|
||||
);
|
||||
AddObjectsIfNotExists(drawnObjects);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Price Inside Zones ...
|
||||
if (hasPriceInsideZone)
|
||||
{
|
||||
//
|
||||
XCBaseObject *drawnObjects[];
|
||||
int drawnObjectsCount = DrawTWPVPriceInsideZones(
|
||||
mXTWPVConditions,
|
||||
mPOIDrawer,
|
||||
drawnObjects //
|
||||
);
|
||||
AddObjectsIfNotExists(drawnObjects);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user