kast ...
This commit is contained in:
@@ -182,6 +182,88 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XPVPivot lastPivot;
|
||||||
|
result = GetLastItem(
|
||||||
|
lastPivot,
|
||||||
|
mOrderFlow //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
XPOIState pivotState;
|
||||||
|
DetectPivotPOIs(
|
||||||
|
lastPivot,
|
||||||
|
pivotState //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Areas ...
|
||||||
|
double bid = GetBid(_symbol);
|
||||||
|
bool isBullish = IsBullish(mOrderFlowDir);
|
||||||
|
bool isBearish = IsBearish(mOrderFlowDir);
|
||||||
|
double pivotMid = lastPivot.CalculateMid();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Looks For Long ...
|
||||||
|
// - [] Bullish Direction;
|
||||||
|
// - [] Discount Area;
|
||||||
|
bool lookupLong =
|
||||||
|
isBullish &&
|
||||||
|
bid < pivotMid &&
|
||||||
|
bid > lastPivot.lower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Looks For Short ...
|
||||||
|
// - [] Bearish Direction ...
|
||||||
|
// - [] Premium Area ...
|
||||||
|
bool lookupShort =
|
||||||
|
isBearish &&
|
||||||
|
bid > pivotMid &&
|
||||||
|
bid < lastPivot.upper;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Order Flow Validation ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// For Bullish Order Flow ...
|
||||||
|
// if Price Breakes Lower to Down, means Change of Charcter Happens ...
|
||||||
|
bool isCHOCHHappens =
|
||||||
|
isBullish ? bid < lastPivot.lower - pip
|
||||||
|
: bid > lastPivot.upper + pip;
|
||||||
|
|
||||||
|
//
|
||||||
|
// For Bullish Order Flow ...
|
||||||
|
// if Price Breakes Upper to Up, means Breake of Structure Happens ...
|
||||||
|
bool isBOSHappens =
|
||||||
|
isBullish ? bid > lastPivot.upper + pip
|
||||||
|
: bid < lastPivot.lower - pip;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isCHOCHHappens)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
DrawStateSwings(_5MState);
|
||||||
|
Print("CHOCH ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBOSHappens)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
DrawStateSwings(_5MState);
|
||||||
|
Print("BOS ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = lookupLong ||
|
||||||
|
lookupShort;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = hasLong ||
|
result = hasLong ||
|
||||||
hasShort;
|
hasShort;
|
||||||
@@ -459,11 +541,12 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (result)
|
// Check Order Flow Direction ...
|
||||||
|
result = mOrderFlowDir != X_DIRECTION_NONE;
|
||||||
|
if (!result)
|
||||||
{
|
{
|
||||||
Print("Result: ", result);
|
return result;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -765,6 +848,300 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DetectPivotPOIs(
|
||||||
|
XPVPivot &pivot,
|
||||||
|
XPOIState &state,
|
||||||
|
bool lookupSwingHighs = true,
|
||||||
|
bool lookupSwingLows = true,
|
||||||
|
bool lookupSupportZones = true,
|
||||||
|
bool lookupResistanceZones = true,
|
||||||
|
bool lookupSupplyZones = true,
|
||||||
|
bool lookupDemandZones = true,
|
||||||
|
bool lookupBullishOrderBlocks = true,
|
||||||
|
bool lookupBearishOrderBlocks = true,
|
||||||
|
bool lookupBullishFairValueGaps = true,
|
||||||
|
bool lookupBearishFairValueGaps = true,
|
||||||
|
bool lookupBullishRejectionBars = true,
|
||||||
|
bool lookupBearishRejectionBars = true,
|
||||||
|
bool lookupBullishMomentumBars = true,
|
||||||
|
bool lookupBearishMomentumBars = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
state.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!pivot.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swings ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing High ...
|
||||||
|
if (lookupSwingHighs)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.swingHighs);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing iSwing = state.swingHighs[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Low ...
|
||||||
|
if (lookupSwingLows)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.swingLows);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support and Resistance Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support Zones ...
|
||||||
|
if (lookupSupportZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.supportZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance Zones ...
|
||||||
|
if (lookupResistanceZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.resistanceZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply and Demand Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply Zones ...
|
||||||
|
if (lookupSupplyZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.supplyZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Demand Zones ...
|
||||||
|
if (lookupDemandZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.demandZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Blocks ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Order Blocks ...
|
||||||
|
if (lookupBullishOrderBlocks)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishOrderBlocks);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Order Blocks ...
|
||||||
|
if (lookupBearishOrderBlocks)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishOrderBlocks);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gaps ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Fair Value Gaps ...
|
||||||
|
if (lookupBullishFairValueGaps)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishFairValueGaps);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Fair Value Gaps ...
|
||||||
|
if (lookupBearishFairValueGaps)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishFairValueGaps);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rejection Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Rejection Bars ...
|
||||||
|
if (lookupBullishRejectionBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishRejectionBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Rejection Bars ...
|
||||||
|
if (lookupBearishRejectionBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishRejectionBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Momentum Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Momentum Bars ...
|
||||||
|
if (lookupBullishMomentumBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishMomentumBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Momenum Bars ...
|
||||||
|
if (lookupBearishMomentumBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishMomentumBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function fulfills the will of the developer
|
||||||
|
* @param state: Argument 1
|
||||||
|
*/
|
||||||
|
void DrawStateSwings(XPOIState &state)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
DrawState(
|
||||||
|
state, // State ...
|
||||||
|
true, // Draw SwingHighs ..
|
||||||
|
true, // Draw SwingLows ..
|
||||||
|
false, // Draw SupportZones ..
|
||||||
|
false, // Draw ResistanceZones ..
|
||||||
|
false, // Draw SupplyZones ..
|
||||||
|
false, // Draw DemandZones ..
|
||||||
|
true, // Draw BullishOrderBlocks ..
|
||||||
|
true, // Draw BearishOrderBlocks ..
|
||||||
|
true, // Draw BullishFairValueGaps ..
|
||||||
|
true, // Draw BearishFairValueGaps ..
|
||||||
|
true, // Draw BullishRejectionBars ..
|
||||||
|
true, // Draw BearishRejectionBars ..
|
||||||
|
true, // Draw BullishMomentumBars ..
|
||||||
|
true // Draw BearishMomentumBars ..
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user