last ...
This commit is contained in:
@@ -61,6 +61,9 @@ struct XPVPivot
|
||||
//
|
||||
ENUM_XPV_PIVOTS type;
|
||||
|
||||
//
|
||||
XPOIState state;
|
||||
|
||||
//
|
||||
XPVPivot()
|
||||
{
|
||||
@@ -90,6 +93,9 @@ struct XPVPivot
|
||||
|
||||
//
|
||||
type = XPV_NONE;
|
||||
|
||||
//
|
||||
state.Clean();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -930,4 +936,544 @@ bool DetectPivotDirection(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect all POIs which inside a Pivot ...
|
||||
*
|
||||
* @param pivot: XPVPivot instance, Specified Pivot ...
|
||||
* @param source: XPOIState instance, Reference to Source State ...
|
||||
* @param state: XPOIState instance, Reference to Detected Pivots ...
|
||||
* @param lookupSwingHighs: Boolean ...
|
||||
* @param lookupSwingLows: Boolean ...
|
||||
* @param lookupSupportZones: Boolean ...
|
||||
* @param lookupResistanceZones: Boolean ...
|
||||
* @param lookupSupplyZones: Boolean ...
|
||||
* @param lookupDemandZones: Boolean ...
|
||||
* @param lookupBullishOrderBlocks: Boolean ...
|
||||
* @param lookupBearishOrderBlocks: Boolean ...
|
||||
* @param lookupBullishFairValueGaps: Boolean ...
|
||||
* @param lookupBearishFairValueGaps: Boolean ...
|
||||
* @param lookupBullishRejectionBars: Boolean ...
|
||||
* @param lookupBearishRejectionBars: Boolean ...
|
||||
* @param lookupBullishMomentumBars: Boolean ...
|
||||
* @param lookupBearishMomentumBars: Boolean ...
|
||||
*/
|
||||
void DetectPivotPOIs(
|
||||
XPVPivot &pivot,
|
||||
XPOIState &source,
|
||||
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;
|
||||
|
||||
//
|
||||
state.symbol = pivot.symbol;
|
||||
state.period = pivot.period;
|
||||
state.time = TimeCurrent();
|
||||
|
||||
//
|
||||
// Swings ...
|
||||
|
||||
//
|
||||
// Swing High ...
|
||||
if (lookupSwingHighs)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.swingHighs);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *iSwing = source.swingHighs[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iSwing.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isInside = iBar.high <= pivot.upper;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iSwing,
|
||||
state.swingHighs //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Swing Low ...
|
||||
if (lookupSwingLows)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.swingLows);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *iSwing = source.swingLows[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iSwing.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isInside = iBar.low >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iSwing,
|
||||
state.swingLows //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Support and Resistance Zones ...
|
||||
|
||||
//
|
||||
// Support Zones ...
|
||||
if (lookupSupportZones)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.supportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *iZone = source.supportZones[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.supportZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance Zones ...
|
||||
if (lookupResistanceZones)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.resistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *iZone = source.resistanceZones[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.resistanceZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Supply and Demand Zones ...
|
||||
|
||||
//
|
||||
// Supply Zones ...
|
||||
if (lookupSupplyZones)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.supplyZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupplyZone *iZone = source.supplyZones[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.supplyZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
if (lookupDemandZones)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.demandZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCDemandZone *iZone = source.demandZones[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.demandZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
|
||||
//
|
||||
// Bullish Order Blocks ...
|
||||
if (lookupBullishOrderBlocks)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bullishOrderBlocks);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iZone = source.bullishOrderBlocks[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.bullishOrderBlocks //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Order Blocks ...
|
||||
if (lookupBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bearishOrderBlocks);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iZone = source.bearishOrderBlocks[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.bearishOrderBlocks //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fair Value Gaps ...
|
||||
|
||||
//
|
||||
// Bullish Fair Value Gaps ...
|
||||
if (lookupBullishFairValueGaps)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bullishFairValueGaps);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCFVG *iZone = source.bullishFairValueGaps[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.bullishFairValueGaps //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Fair Value Gaps ...
|
||||
if (lookupBearishFairValueGaps)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bearishFairValueGaps);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCFVG *iZone = source.bearishFairValueGaps[i];
|
||||
|
||||
//
|
||||
bool isInside =
|
||||
iZone.Upper() <= pivot.upper &&
|
||||
iZone.Lower() >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
state.bearishFairValueGaps //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Rejection Bars ...
|
||||
|
||||
//
|
||||
// Bullish Rejection Bars ...
|
||||
if (lookupBullishRejectionBars)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bullishRejectionBars);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *iRejection = source.bullishRejectionBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iRejection.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isInside = iBar.low <= pivot.upper &&
|
||||
iBar.low >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iRejection,
|
||||
state.bullishRejectionBars //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Rejection Bars ...
|
||||
if (lookupBearishRejectionBars)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bearishRejectionBars);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *iRejection = source.bearishRejectionBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iRejection.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isInside = iBar.high <= pivot.upper &&
|
||||
iBar.high >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iRejection,
|
||||
state.bearishRejectionBars //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Momentum Bars ...
|
||||
|
||||
//
|
||||
// Bullish Momentum Bars ...
|
||||
if (lookupBullishMomentumBars)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bullishMomentumBars);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *iMomentum = source.bullishMomentumBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iMomentum.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isInside = iBar.low <= pivot.upper &&
|
||||
iBar.low >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iMomentum,
|
||||
state.bullishMomentumBars //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Momenum Bars ...
|
||||
if (lookupBearishMomentumBars)
|
||||
{
|
||||
//
|
||||
count = ArraySize(source.bearishMomentumBars);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *iMomentum = source.bearishMomentumBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iMomentum.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isInside = iBar.high <= pivot.upper &&
|
||||
iBar.high >= pivot.lower;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iMomentum,
|
||||
state.bearishMomentumBars //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user