last ...
This commit is contained in:
@@ -2513,6 +2513,647 @@ class XCPOIDrawer : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw Specified POI State ...
|
||||||
|
*
|
||||||
|
* @param state: XPOIState instance Reference ...
|
||||||
|
* @param drawnObjects: CArrayObj instance for Holding Drawn Objects ...
|
||||||
|
* @param ignoreSwingHighs: Boolean ...
|
||||||
|
* @param ignoreSwingLows: Boolean ...
|
||||||
|
* @param ignoreSupportZones: Boolean ...
|
||||||
|
* @param ignoreResistanceZones: Boolean ...
|
||||||
|
* @param ignoreSupplyZones: Boolean ...
|
||||||
|
* @param ignoreDemandZones: Boolean ...
|
||||||
|
* @param ignoreBullishOrderBlocks: Boolean ...
|
||||||
|
* @param ignoreBearishOrderBlocks: Boolean ...
|
||||||
|
* @param ignoreBullishFairValueGaps: Boolean ...
|
||||||
|
* @param ignoreBearishFairValueGaps: Boolean ...
|
||||||
|
* @param ignoreBullishRejectionBars: Boolean ...
|
||||||
|
* @param ignoreBearishRejectionBars: Boolean ...
|
||||||
|
* @param ignoreBullishMomentumBars: Boolean ...
|
||||||
|
* @param ignoreBearishMomentumBars: Boolean ...
|
||||||
|
*/
|
||||||
|
int DrawState(
|
||||||
|
XPOIState &state,
|
||||||
|
XCBaseObject *&drawnObjects[],
|
||||||
|
bool ignoreSwingHighs = false,
|
||||||
|
bool ignoreSwingLows = false,
|
||||||
|
bool ignoreSupportZones = false,
|
||||||
|
bool ignoreResistanceZones = false,
|
||||||
|
bool ignoreSupplyZones = false,
|
||||||
|
bool ignoreDemandZones = false,
|
||||||
|
bool ignoreBullishOrderBlocks = false,
|
||||||
|
bool ignoreBearishOrderBlocks = false,
|
||||||
|
bool ignoreBullishFairValueGaps = false,
|
||||||
|
bool ignoreBearishFairValueGaps = false,
|
||||||
|
bool ignoreBullishRejectionBars = false,
|
||||||
|
bool ignoreBearishRejectionBars = false,
|
||||||
|
bool ignoreBullishMomentumBars = false,
|
||||||
|
bool ignoreBearishMomentumBars = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!state.IsValid() ||
|
||||||
|
!state.HasChild())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
// SwingHighs ...
|
||||||
|
if (!ignoreSwingHighs)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountSwingHighs();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing *iSwing = state.swingHighs[i];
|
||||||
|
XCSwingHighObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateSwingHigh(
|
||||||
|
iSwing,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SwingLows ...
|
||||||
|
if (!ignoreSwingLows)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountSwingLows();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing *iSwing = state.swingLows[i];
|
||||||
|
XCSwingLowObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateSwingLow(
|
||||||
|
iSwing,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SupportZones ...
|
||||||
|
if (!ignoreSupportZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountSupportZones();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZone *iZone = state.supportZones[i];
|
||||||
|
XCSupportZoneObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateSupportZone(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ResistanceZones ...
|
||||||
|
if (!ignoreResistanceZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountResistanceZones();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZone *iZone = state.resistanceZones[i];
|
||||||
|
XCResistanceZoneObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateResistanceZone(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SupplyZones ...
|
||||||
|
if (!ignoreSupplyZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountSupplyZones();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupplyZone *iZone = state.supplyZones[i];
|
||||||
|
XCSupplyZoneObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateSupplyZone(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// DemandZones ...
|
||||||
|
if (!ignoreDemandZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountDemandZones();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCDemandZone *iZone = state.demandZones[i];
|
||||||
|
XCDemandZoneObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateDemandZone(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BullishOrderBlocks ...
|
||||||
|
if (!ignoreBullishOrderBlocks)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBullishOrderBlocks();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *iZone = state.bullishOrderBlocks[i];
|
||||||
|
XCBullishOrderBlockObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBullishOrderBlock(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BearishOrderBlocks ...
|
||||||
|
if (!ignoreBearishOrderBlocks)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBearishOrderBlocks();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *iZone = state.bearishOrderBlocks[i];
|
||||||
|
XCBearishOrderBlockObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBearishOrderBlock(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BullishFairValueGaps ...
|
||||||
|
if (!ignoreBullishFairValueGaps)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBullishFairValueGaps();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG *iZone = state.bullishFairValueGaps[i];
|
||||||
|
XCBullishFairValueGapObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBullishFairValueGap(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BearishFairValueGaps ...
|
||||||
|
if (!ignoreBearishFairValueGaps)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBearishFairValueGaps();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG *iZone = state.bearishFairValueGaps[i];
|
||||||
|
XCBearishFairValueGapObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBearishFairValueGap(
|
||||||
|
iZone,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BullishRejectionBars ...
|
||||||
|
if (!ignoreBullishRejectionBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBullishRejectionBars();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar *iBar = state.bullishRejectionBars[i];
|
||||||
|
XCBullishRejectionBarObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBullishRejectionBar(
|
||||||
|
iBar,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BearishRejectionBars ...
|
||||||
|
if (!ignoreBearishRejectionBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBearishRejectionBars();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar *iBar = state.bearishRejectionBars[i];
|
||||||
|
XCBearishRejectionBarObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBearishRejectionBar(
|
||||||
|
iBar,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BullishMomentumBars ...
|
||||||
|
if (!ignoreBullishMomentumBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBullishMomentumBars();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar *iBar = state.bullishMomentumBars[i];
|
||||||
|
XCBullishMomentumBarObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBullishMomentumBar(
|
||||||
|
iBar,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// BearishMomentumBars ...
|
||||||
|
if (!ignoreBearishMomentumBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBearishMomentumBars();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar *iBar = state.bearishMomentumBars[i];
|
||||||
|
XCBearishMomentumBarObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = CreateBearishMomentumBar(
|
||||||
|
iBar,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw Specific Pivot ...
|
||||||
|
*
|
||||||
|
* @param pivot: XPVPivot instance Reference ...
|
||||||
|
* @param drawState: Boolean ...
|
||||||
|
* @param filterByPrice: Boolean ...
|
||||||
|
* @param ignoreSwingHighs: Boolean ...
|
||||||
|
* @param ignoreSwingLows: Boolean ...
|
||||||
|
* @param ignoreSupportZones: Boolean ...
|
||||||
|
* @param ignoreResistanceZones: Boolean ...
|
||||||
|
* @param ignoreSupplyZones: Boolean ...
|
||||||
|
* @param ignoreDemandZones: Boolean ...
|
||||||
|
* @param ignoreBullishOrderBlocks: Boolean ...
|
||||||
|
* @param ignoreBearishOrderBlocks: Boolean ...
|
||||||
|
* @param ignoreBullishFairValueGaps: Boolean ...
|
||||||
|
* @param ignoreBearishFairValueGaps: Boolean ...
|
||||||
|
* @param ignoreBullishRejectionBars: Boolean ...
|
||||||
|
* @param ignoreBearishRejectionBars: Boolean ...
|
||||||
|
* @param ignoreBullishMomentumBars: Boolean ...
|
||||||
|
* @param ignoreBearishMomentumBars: Boolean ...
|
||||||
|
*/
|
||||||
|
int DrawPivot(
|
||||||
|
XPVPivot &pivot,
|
||||||
|
XCBaseObject *&drawnObjects[],
|
||||||
|
bool drawState = true,
|
||||||
|
bool ignoreSwingHighs = false,
|
||||||
|
bool ignoreSwingLows = false,
|
||||||
|
bool ignoreSupportZones = false,
|
||||||
|
bool ignoreResistanceZones = false,
|
||||||
|
bool ignoreSupplyZones = false,
|
||||||
|
bool ignoreDemandZones = false,
|
||||||
|
bool ignoreBullishOrderBlocks = false,
|
||||||
|
bool ignoreBearishOrderBlocks = false,
|
||||||
|
bool ignoreBullishFairValueGaps = false,
|
||||||
|
bool ignoreBearishFairValueGaps = false,
|
||||||
|
bool ignoreBullishRejectionBars = false,
|
||||||
|
bool ignoreBearishRejectionBars = false,
|
||||||
|
bool ignoreBullishMomentumBars = false,
|
||||||
|
bool ignoreBearishMomentumBars = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!pivot.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Pivot it self ...
|
||||||
|
XCXPVPivotObject *iPivotObj;
|
||||||
|
iPivotObj = new XCXPVPivotObject();
|
||||||
|
bool isCreated = iPivotObj.Create(
|
||||||
|
ChartIdentification(),
|
||||||
|
SubWindowIdentification(),
|
||||||
|
pivot //
|
||||||
|
);
|
||||||
|
if (!isCreated)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
color clrPivotColor = pivot.IsPeak()
|
||||||
|
? clrAqua
|
||||||
|
: clrMagenta;
|
||||||
|
iPivotObj.PivotColor(clrPivotColor);
|
||||||
|
iPivotObj.PivotWidth(2);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iPivotObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!drawState)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!pivot.state.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBaseObject *stateObjects[];
|
||||||
|
int stateCount = DrawState(
|
||||||
|
pivot.state,
|
||||||
|
stateObjects,
|
||||||
|
ignoreSwingHighs,
|
||||||
|
ignoreSwingLows,
|
||||||
|
ignoreSupportZones,
|
||||||
|
ignoreResistanceZones,
|
||||||
|
ignoreSupplyZones,
|
||||||
|
ignoreDemandZones,
|
||||||
|
ignoreBullishOrderBlocks,
|
||||||
|
ignoreBearishOrderBlocks,
|
||||||
|
ignoreBullishFairValueGaps,
|
||||||
|
ignoreBearishFairValueGaps,
|
||||||
|
ignoreBullishRejectionBars,
|
||||||
|
ignoreBearishRejectionBars,
|
||||||
|
ignoreBullishMomentumBars,
|
||||||
|
ignoreBearishMomentumBars //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidSize(stateCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
stateObjects,
|
||||||
|
drawnObjects,
|
||||||
|
false // Doesn't Clean ...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
protected:
|
protected:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
//
|
||||||
|
// Decision ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Peak ...
|
||||||
|
bool isDecisionNewPeak = decisionConditions.x121Conditions.isNewPeak;
|
||||||
|
bool isDecisionNewPeakOverLast = decisionConditions.x121Conditions.isNewPeakOverLast;
|
||||||
|
bool isDecisionNewPeakUnderLast = decisionConditions.x121Conditions.isNewPeakUnderLast;
|
||||||
|
double decisionPeak = decisionConditions.x121Conditions.peaksBuffer[1];
|
||||||
|
XPVPivotPoint decisionPeakPivots[];
|
||||||
|
XPVPivotPoint decisionLastPeakPivot;
|
||||||
|
XPVPivotPoint decisionPrevPeakPivot;
|
||||||
|
int decisionPeakPivotsCount = decisionCycleHelper
|
||||||
|
.FillPeakPivotPoints(decisionPeakPivots);
|
||||||
|
bool hasDecisionPeak = decisionPeakPivotsCount >= 2;
|
||||||
|
if (hasDecisionPeak)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
decisionLastPeakPivot = decisionPeakPivots[decisionPeakPivotsCount - 1];
|
||||||
|
decisionPrevPeakPivot = decisionPeakPivots[decisionPeakPivotsCount - 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Vale ...
|
||||||
|
bool isDecisionNewVale = decisionConditions.x121Conditions.isNewVale;
|
||||||
|
bool isDecisionNewValeOverLast = decisionConditions.x121Conditions.isNewValeOverLast;
|
||||||
|
bool isDecisionNewValeUnderLast = decisionConditions.x121Conditions.isNewValeUnderLast;
|
||||||
|
double decisionVale = decisionConditions.x121Conditions.valesBuffer[1];
|
||||||
|
XPVPivotPoint decisionValePivots[];
|
||||||
|
XPVPivotPoint decisionLastValePivot;
|
||||||
|
XPVPivotPoint decisionPrevValePivot;
|
||||||
|
int decisionValePivotsCount = decisionCycleHelper
|
||||||
|
.FillValePivotPoints(decisionValePivots);
|
||||||
|
bool hasDecisionVale = decisionValePivotsCount >= 2;
|
||||||
|
if (hasDecisionVale)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
decisionLastValePivot = decisionValePivots[decisionValePivotsCount - 1];
|
||||||
|
decisionPrevValePivot = decisionValePivots[decisionValePivotsCount - 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDecisionBullish =
|
||||||
|
//
|
||||||
|
hasDecisionVale &&
|
||||||
|
isDecisionNewVale &&
|
||||||
|
isDecisionNewValeUnderLast &&
|
||||||
|
decisionLastValePivot.value > decisionPrevValePivot.value
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDecisionBearish =
|
||||||
|
//
|
||||||
|
false &&
|
||||||
|
hasDecisionPeak &&
|
||||||
|
decisionLastPeakPivot.value
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isDecisionBullish ||
|
||||||
|
isDecisionBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.pivot =
|
||||||
|
isDecisionBullish
|
||||||
|
? decisionVale
|
||||||
|
: decisionPeak;
|
||||||
|
conditions.dir =
|
||||||
|
isDecisionBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
conditions.cycle = X_CYCLE_DECISION;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,911 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Signal Conditions ...
|
||||||
|
bool hasSignal = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool useTestSignal = false;
|
||||||
|
bool useXPVOBSignal = false;
|
||||||
|
bool useXPVDPSignal = false;
|
||||||
|
bool useXVWPBSignal = false;
|
||||||
|
bool useXTWPVSignal = true;
|
||||||
|
bool useXPVSUPDEMSignal = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasTestSignal = false;
|
||||||
|
bool hasXPVOBSignal = false;
|
||||||
|
bool hasXPVDPSignal = false;
|
||||||
|
bool hasXVWPBSignal = false;
|
||||||
|
bool hasXTWPVSignal = false;
|
||||||
|
bool hasXPVSUPDEMSignal = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test Signal ...
|
||||||
|
if (useTestSignal && !hasSignal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasTestSignal = DetectTestSignal(conditions);
|
||||||
|
hasSignal = hasTestSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XPVOB Signal ...
|
||||||
|
if (useXPVOBSignal && !hasSignal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasXPVOBSignal = DetectXPVOBSignal(conditions);
|
||||||
|
hasSignal = hasXPVOBSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XPVDP Signal ...
|
||||||
|
if (useXPVDPSignal && !hasSignal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasXPVDPSignal = DetectXPVDPSignal(conditions);
|
||||||
|
hasSignal = hasXPVDPSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XVWPB Signal ...
|
||||||
|
if (useXVWPBSignal && !hasSignal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasXVWPBSignal = DetectXVWPBSignal(conditions);
|
||||||
|
hasSignal = hasXVWPBSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTWPV Signal ...
|
||||||
|
if (useXTWPVSignal && !hasSignal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasXTWPVSignal = DetectXTWPVSignal(conditions);
|
||||||
|
hasSignal = hasXTWPVSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XPVSUPDEM Signal ...
|
||||||
|
if (useXPVSUPDEMSignal && !hasSignal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasXPVSUPDEMSignal = DetectXPVSUPDEMSignal(conditions);
|
||||||
|
hasSignal = hasXPVSUPDEMSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test Signal ...
|
||||||
|
X121SMCStrategyTestSignalConditions mTestConditions;
|
||||||
|
bool DetectTestSignal(
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XTEST;
|
||||||
|
string providerStr = ToString(provider);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Setup Conditions ...
|
||||||
|
datetime setupTime = mTestConditions.setupTime;
|
||||||
|
bool isSetuped = mTestConditions.IsSetuped();
|
||||||
|
ENUM_X_DIRECTION setupDir = mTestConditions.dir;
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Setup ...
|
||||||
|
isSetuped = DetectX121SMCTestSiganlSetup(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTestConditions,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
setupDir = mTestConditions.dir;
|
||||||
|
setupTime = mTestConditions.setupTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearDraws();
|
||||||
|
// ENUM_X_DIRECTION activeZoneDir;
|
||||||
|
// bool hasTicksZone = mTestConditions.HasTicksZone();
|
||||||
|
// bool hasActiveZone = mTestConditions.HasActiveZone(activeZoneDir);
|
||||||
|
// if (hasActiveZone)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// if (IsBullish(activeZoneDir))
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// mTestConditions.activeDemandZone.To(cTime);
|
||||||
|
// XCDemandZoneObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateDemandZone(
|
||||||
|
// mTestConditions.activeDemandZone,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// mTestConditions.activeSupplyZone.To(cTime);
|
||||||
|
// XCSupplyZoneObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateSupplyZone(
|
||||||
|
// mTestConditions.activeSupplyZone,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (hasTicksZone)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// XCTicksZoneObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateTicksZone(
|
||||||
|
// mTestConditions.ticksZone,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isSetuped;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trigger Conditions ...
|
||||||
|
bool canTrigger = mTestConditions.CanTrigger();
|
||||||
|
datetime triggerTime = mTestConditions.triggerTime;
|
||||||
|
if (!canTrigger)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Trigger ...
|
||||||
|
canTrigger = DetectX121SMCTestSiganlTrigger(
|
||||||
|
mTestConditions,
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canTrigger;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
triggerTime = mTestConditions.triggerTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish = IsBullish(setupDir);
|
||||||
|
isBearish = IsBearish(setupDir);
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Issues Signal on Conditions ...
|
||||||
|
conditions.signalDir = setupDir;
|
||||||
|
conditions.provider = providerStr;
|
||||||
|
conditions.sl = mTestConditions.sl;
|
||||||
|
conditions.target = mTestConditions.target;
|
||||||
|
|
||||||
|
//
|
||||||
|
mTestConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XPVOB Signal ...
|
||||||
|
X121SMCStrategyXPVOBSignalConditions mXPVOBConditions;
|
||||||
|
bool DetectXPVOBSignal(
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPVOB;
|
||||||
|
string providerStr = ToString(provider);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Setup Conditions ...
|
||||||
|
datetime setupTime = mXPVOBConditions.setupTime;
|
||||||
|
bool isSetuped = mXPVOBConditions.IsSetuped();
|
||||||
|
ENUM_X_DIRECTION setupDir = mXPVOBConditions.dir;
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Setup ...
|
||||||
|
isSetuped = DetectX121SMCXPVOBSiganlSetup(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mXPVOBConditions,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isSetuped;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
setupDir = mXPVOBConditions.dir;
|
||||||
|
setupTime = mXPVOBConditions.setupTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Conditions Active FVG ...
|
||||||
|
// if (isSetuped)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// XCFVG *iFVG = mXPVOBConditions.activeFVG;
|
||||||
|
// if (iFVG != NULL && iFVG.IsValid())
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// ClearDraws();
|
||||||
|
// iFVG.To(cTime);
|
||||||
|
// if (IsBullish(setupDir) && iFVG.IsBullish())
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// XCBullishFairValueGapObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateBullishFairValueGap(
|
||||||
|
// iFVG,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (IsBearish(setupDir) && iFVG.IsBearish())
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// XCBearishFairValueGapObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateBearishFairValueGap(
|
||||||
|
// iFVG,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trigger Conditions ...
|
||||||
|
bool canTrigger = mXPVOBConditions.CanTrigger();
|
||||||
|
datetime triggerTime = mXPVOBConditions.triggerTime;
|
||||||
|
if (!canTrigger)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Trigger ...
|
||||||
|
canTrigger = DetectX121SMCXPVOBSiganlTrigger(
|
||||||
|
mXPVOBConditions,
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canTrigger;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
triggerTime = mXPVOBConditions.triggerTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish = IsBullish(setupDir);
|
||||||
|
isBearish = IsBearish(setupDir);
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Issues Signal on Conditions ...
|
||||||
|
conditions.signalDir = setupDir;
|
||||||
|
conditions.provider = providerStr;
|
||||||
|
conditions.sl = mXPVOBConditions.sl;
|
||||||
|
conditions.target = mXPVOBConditions.target;
|
||||||
|
|
||||||
|
//
|
||||||
|
mXPVOBConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XPVDP Signal ...
|
||||||
|
X121SMCStrategyXPVDPSignalConditions mXPVDPConditions;
|
||||||
|
bool DetectXPVDPSignal(
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPVDP;
|
||||||
|
string providerStr = ToString(provider);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Setup Conditions ...
|
||||||
|
datetime setupTime = mXPVDPConditions.setupTime;
|
||||||
|
bool isSetuped = mXPVDPConditions.IsSetuped();
|
||||||
|
ENUM_X_DIRECTION setupDir = mXPVDPConditions.dir;
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Setup ...
|
||||||
|
isSetuped = DetectX121SMCXPVDPSiganlSetup(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mXPVDPConditions,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
setupDir = mXPVDPConditions.dir;
|
||||||
|
setupTime = mXPVDPConditions.setupTime;
|
||||||
|
}
|
||||||
|
result = isSetuped;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trigger Conditions ...
|
||||||
|
bool canTrigger = mXPVDPConditions.CanTrigger();
|
||||||
|
datetime triggerTime = mXPVDPConditions.triggerTime;
|
||||||
|
if (!canTrigger)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Trigger ...
|
||||||
|
canTrigger = DetectX121SMCXPVDPSiganlTrigger(
|
||||||
|
mXPVDPConditions,
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canTrigger;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
triggerTime = mXPVDPConditions.triggerTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish = IsBullish(setupDir);
|
||||||
|
isBearish = IsBearish(setupDir);
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Issues Signal on Conditions ...
|
||||||
|
conditions.signalDir = setupDir;
|
||||||
|
conditions.provider = providerStr;
|
||||||
|
conditions.sl = mXPVDPConditions.sl;
|
||||||
|
conditions.target = mXPVDPConditions.target;
|
||||||
|
|
||||||
|
//
|
||||||
|
mXPVDPConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XVWPB Signal ...
|
||||||
|
X121SMCStrategyXVWPBSignalConditions mXVWPBConditions;
|
||||||
|
bool DetectXVWPBSignal(
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XVWPB;
|
||||||
|
string providerStr = ToString(provider);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Setup Conditions ...
|
||||||
|
datetime setupTime = mXVWPBConditions.setupTime;
|
||||||
|
bool isSetuped = mXVWPBConditions.IsSetuped();
|
||||||
|
ENUM_X_DIRECTION setupDir = mXVWPBConditions.dir;
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Setup ...
|
||||||
|
isSetuped = DetectX121SMCXVWPBSiganlSetup(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mXVWPBConditions,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
setupDir = mXVWPBConditions.dir;
|
||||||
|
setupTime = mXVWPBConditions.setupTime;
|
||||||
|
}
|
||||||
|
result = isSetuped;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trigger Conditions ...
|
||||||
|
bool canTrigger = mXVWPBConditions.CanTrigger();
|
||||||
|
datetime triggerTime = mXVWPBConditions.triggerTime;
|
||||||
|
if (!canTrigger)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Trigger ...
|
||||||
|
canTrigger = DetectX121SMCXVWPBSiganlTrigger(
|
||||||
|
mXVWPBConditions,
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canTrigger;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
triggerTime = mXVWPBConditions.triggerTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish = IsBullish(setupDir);
|
||||||
|
isBearish = IsBearish(setupDir);
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Issues Signal on Conditions ...
|
||||||
|
conditions.signalDir = setupDir;
|
||||||
|
conditions.provider = providerStr;
|
||||||
|
conditions.sl = mXVWPBConditions.sl;
|
||||||
|
conditions.target = mXVWPBConditions.target;
|
||||||
|
|
||||||
|
//
|
||||||
|
mXVWPBConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTWPV Signal ...
|
||||||
|
X121SMCStrategyXTWPVSignalConditions mXTWPVConditions;
|
||||||
|
bool DetectXTWPVSignal(
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XTWPV;
|
||||||
|
string providerStr = ToString(provider);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Setup Conditions ...
|
||||||
|
datetime setupTime = mXTWPVConditions.setupTime;
|
||||||
|
bool isSetuped = mXTWPVConditions.IsSetuped();
|
||||||
|
ENUM_X_DIRECTION setupDir = mXTWPVConditions.dir;
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Setup ...
|
||||||
|
isSetuped = DetectX121SMCXTWPVSiganlSetup(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mXTWPVConditions,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
setupDir = mXTWPVConditions.dir;
|
||||||
|
setupTime = mXTWPVConditions.setupTime;
|
||||||
|
}
|
||||||
|
result = isSetuped;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trigger Conditions ...
|
||||||
|
bool canTrigger = mXTWPVConditions.CanTrigger();
|
||||||
|
datetime triggerTime = mXTWPVConditions.triggerTime;
|
||||||
|
if (!canTrigger)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Trigger ...
|
||||||
|
canTrigger = DetectX121SMCXTWPVSiganlTrigger(
|
||||||
|
mXTWPVConditions,
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canTrigger;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
triggerTime = mXTWPVConditions.triggerTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish = IsBullish(setupDir);
|
||||||
|
isBearish = IsBearish(setupDir);
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Issues Signal on Conditions ...
|
||||||
|
conditions.signalDir = setupDir;
|
||||||
|
conditions.provider = providerStr;
|
||||||
|
conditions.sl = mXTWPVConditions.sl;
|
||||||
|
conditions.target = mXTWPVConditions.target;
|
||||||
|
|
||||||
|
//
|
||||||
|
mXTWPVConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XPVSUPDEM Signal ...
|
||||||
|
X121SMCStrategyXPVSUPDEMSignalConditions mXPVSUPDEMConditions;
|
||||||
|
bool DetectXPVSUPDEMSignal(
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPVSUPDEM;
|
||||||
|
string providerStr = ToString(provider);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Setup Conditions ...
|
||||||
|
datetime setupTime = mXPVSUPDEMConditions.setupTime;
|
||||||
|
bool isSetuped = mXPVSUPDEMConditions.IsSetuped();
|
||||||
|
ENUM_X_DIRECTION setupDir = mXPVSUPDEMConditions.dir;
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Setup ...
|
||||||
|
isSetuped = DetectX121SMCXPVSUPDEMSiganlSetup(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mXPVSUPDEMConditions,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
setupDir = mXPVSUPDEMConditions.dir;
|
||||||
|
setupTime = mXPVSUPDEMConditions.setupTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearDraws();
|
||||||
|
// ENUM_X_DIRECTION activeZoneDir;
|
||||||
|
// bool hasTicksZone = mXPVSUPDEMConditions.HasTicksZone();
|
||||||
|
// bool hasActiveZone = mXPVSUPDEMConditions.HasActiveZone(activeZoneDir);
|
||||||
|
// if (hasActiveZone)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// if (IsBullish(activeZoneDir))
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// mXPVSUPDEMConditions.activeDemandZone.To(cTime);
|
||||||
|
// XCDemandZoneObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateDemandZone(
|
||||||
|
// mXPVSUPDEMConditions.activeDemandZone,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// mXPVSUPDEMConditions.activeSupplyZone.To(cTime);
|
||||||
|
// XCSupplyZoneObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateSupplyZone(
|
||||||
|
// mXPVSUPDEMConditions.activeSupplyZone,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (hasTicksZone)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// XCTicksZoneObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateTicksZone(
|
||||||
|
// mXPVSUPDEMConditions.ticksZone,
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// if (isCreated)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iObj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isSetuped;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trigger Conditions ...
|
||||||
|
bool canTrigger = mXPVSUPDEMConditions.CanTrigger();
|
||||||
|
datetime triggerTime = mXPVSUPDEMConditions.triggerTime;
|
||||||
|
if (!canTrigger)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Signal Trigger ...
|
||||||
|
canTrigger = DetectX121SMCXPVSUPDEMSiganlTrigger(
|
||||||
|
mXPVSUPDEMConditions,
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canTrigger;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
triggerTime = mXPVSUPDEMConditions.triggerTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish = IsBullish(setupDir);
|
||||||
|
isBearish = IsBearish(setupDir);
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Issues Signal on Conditions ...
|
||||||
|
conditions.signalDir = setupDir;
|
||||||
|
conditions.provider = providerStr;
|
||||||
|
conditions.sl = mXPVSUPDEMConditions.sl;
|
||||||
|
conditions.target = mXPVSUPDEMConditions.target;
|
||||||
|
|
||||||
|
//
|
||||||
|
mXPVSUPDEMConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
ClearDraws();
|
||||||
|
XPVPivot peakPivot;
|
||||||
|
bool hasActivePeakPivot =
|
||||||
|
mTriggerCycleHelper
|
||||||
|
.GetActivePeakPivot(peakPivot);
|
||||||
|
if (hasActivePeakPivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBaseObject *iPivotObjs[];
|
||||||
|
int drawnCount = mPOIDrawer.DrawPivot(
|
||||||
|
peakPivot,
|
||||||
|
iPivotObjs //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidSize(drawnCount))
|
||||||
|
{
|
||||||
|
AddObjectsIfNotExists(iPivotObjs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XPVPivot valePivot;
|
||||||
|
bool hasActiveValePivot =
|
||||||
|
mTriggerCycleHelper
|
||||||
|
.GetActiveValePivot(valePivot);
|
||||||
|
if (hasActiveValePivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBaseObject *iPivotObjs[];
|
||||||
|
int drawnCount = mPOIDrawer.DrawPivot(
|
||||||
|
valePivot,
|
||||||
|
iPivotObjs //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidSize(drawnCount))
|
||||||
|
{
|
||||||
|
AddObjectsIfNotExists(iPivotObjs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// XPVPivot pivots[];
|
||||||
|
// int pivotsCount = mTriggerCycleHelper.FillPivots(pivots);
|
||||||
|
// if (IsValidSize(pivotsCount))
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// for (int i = 0; i < pivotsCount; i++)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// XPVPivot iPivot = pivots[i];
|
||||||
|
|
||||||
|
// //
|
||||||
|
// XCBaseObject *iPivotObjects[];
|
||||||
|
// mPOIDrawer.DrawPivot(
|
||||||
|
// iPivot,
|
||||||
|
// iPivotObjects,
|
||||||
|
// false // Don't Draw State ...
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// int iPivotObjectsCount = ArraySize(iPivotObjects);
|
||||||
|
// if (IsValidSize(iPivotObjectsCount))
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// for (int j = 0; j < iPivotObjectsCount; j++)
|
||||||
|
// {
|
||||||
|
// AddObjectIfNotExists(iPivotObjects[j]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
@@ -44,20 +44,20 @@ input string eaSymbols = "EURUSDb,GBPUSDb,USDJPYb,USDCHFb"; // Trading Symbols
|
|||||||
//
|
//
|
||||||
// Signalling ...
|
// Signalling ...
|
||||||
input group "Signalling";
|
input group "Signalling";
|
||||||
input bool eaAllowLong = true; // Allow Long Signals
|
input bool eaAllowLong = true; // Allow Long Signals
|
||||||
input bool eaAllowShort = true; // Allow Short Signals
|
input bool eaAllowShort = true; // Allow Short Signals
|
||||||
input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals
|
input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals
|
||||||
input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals
|
input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals
|
||||||
input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed Signal Types Per Symbol
|
input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed Signal Types Per Symbol
|
||||||
input double eaLastPositionProfitForAcceptNextInPoint = 0; // Last Position Profit In Points for Accept new Signal
|
input double eaLastPositionProfitForAcceptNextInPoint = 30; // Last Position Profit In Points for Accept new Signal
|
||||||
input int eaDelaysBetweenTwoSignalsInBar = 7; // Delay between two Signals in Bars
|
input int eaDelaysBetweenTwoSignalsInBar = 50; // Delay between two Signals in Bars
|
||||||
input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling
|
input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling
|
||||||
input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Verification for Signalling
|
input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Verification for Signalling
|
||||||
|
|
||||||
//
|
//
|
||||||
// Risk Management ...
|
// Risk Management ...
|
||||||
input group "Risk Management";
|
input group "Risk Management";
|
||||||
input double eaR2R = 6; // Signallers Risk to Reward Ratio
|
input double eaR2R = 3; // Signallers Risk to Reward Ratio
|
||||||
input double eaVolume = 0.05; // Static Volume
|
input double eaVolume = 0.05; // Static Volume
|
||||||
input double eaRiskPercentPerBalance = 0.1; // Risk Percent Per Balance in Each Trade
|
input double eaRiskPercentPerBalance = 0.1; // Risk Percent Per Balance in Each Trade
|
||||||
input bool eaDynamicRiskManagement = false; // Dynamic Risk Management
|
input bool eaDynamicRiskManagement = false; // Dynamic Risk Management
|
||||||
@@ -65,7 +65,7 @@ input bool eaUseDynamicVolume = false; // Use Dy
|
|||||||
input double eaDynamicVolumeStep = 0.01; // Increase Volume Step
|
input double eaDynamicVolumeStep = 0.01; // Increase Volume Step
|
||||||
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
|
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
|
||||||
input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades
|
input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades
|
||||||
input int eaMaxAllowedSLToPauseSignallingPerSymbol = 2; // Max Allowed SL for Pause Signalling Per Symbol
|
input int eaMaxAllowedSLToPauseSignallingPerSymbol = 1; // Max Allowed SL for Pause Signalling Per Symbol
|
||||||
input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 14400; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds
|
input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 14400; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -929,6 +929,10 @@ struct XSignal
|
|||||||
double tpLevelForBreakEven; // TP Level for Break Even ...
|
double tpLevelForBreakEven; // TP Level for Break Even ...
|
||||||
bool riskFreeOnBreakEven; // Risk Free Signal On Break Even ...
|
bool riskFreeOnBreakEven; // Risk Free Signal On Break Even ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Traget ...
|
||||||
|
double target; // Force Risk Free On Target ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// SL Trail ...
|
// SL Trail ...
|
||||||
bool trailSL; // Do SL Trail ...
|
bool trailSL; // Do SL Trail ...
|
||||||
@@ -1486,6 +1490,9 @@ struct XSignal
|
|||||||
provider = NULL;
|
provider = NULL;
|
||||||
conditions = NULL;
|
conditions = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
target = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
trailSL = false;
|
trailSL = false;
|
||||||
riskFreeOnBreakEven = false;
|
riskFreeOnBreakEven = false;
|
||||||
|
|||||||
@@ -625,7 +625,8 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
end,
|
end,
|
||||||
minRequiredTicksVerification //
|
minRequiredTicksVerification //
|
||||||
);
|
);
|
||||||
if (!result) {
|
if (!result)
|
||||||
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,6 +727,61 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Draw Functions ...
|
// Draw Functions ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw Specified Signal ...
|
||||||
|
*
|
||||||
|
* @param signal: XSignal instance ...
|
||||||
|
*/
|
||||||
|
void DrawSignal(XSignal &signal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!signal.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// DrawConditions(conditions);
|
||||||
|
|
||||||
|
//
|
||||||
|
string name = signal.GetTag();
|
||||||
|
RemoveObject(name);
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSignalObject *iObj;
|
||||||
|
iObj = new XCSignalObject();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCreated = iObj.Create(
|
||||||
|
ChartIdentification(),
|
||||||
|
name,
|
||||||
|
SubWindowIdentification(),
|
||||||
|
signal //
|
||||||
|
);
|
||||||
|
if (!isCreated)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iObj.TPWidth(1);
|
||||||
|
iObj.TPColor(clrGreen);
|
||||||
|
iObj.TPWidth(STYLE_DOT);
|
||||||
|
|
||||||
|
//
|
||||||
|
iObj.SLWidth(1);
|
||||||
|
iObj.SLColor(clrRed);
|
||||||
|
iObj.SLWidth(STYLE_DOT);
|
||||||
|
|
||||||
|
//
|
||||||
|
iObj.EntryWidth(1);
|
||||||
|
iObj.EntryColor(clrYellow);
|
||||||
|
iObj.EntryWidth(STYLE_DOT);
|
||||||
|
|
||||||
|
//
|
||||||
|
mDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all Drawn Objects ...
|
* Clear all Drawn Objects ...
|
||||||
*/
|
*/
|
||||||
@@ -785,562 +841,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw Specified Signal ...
|
|
||||||
*
|
|
||||||
* @param signal: XSignal instance ...
|
|
||||||
*/
|
|
||||||
void DrawSignal(XSignal &signal)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!signal.IsValid())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// DrawConditions(conditions);
|
|
||||||
|
|
||||||
//
|
|
||||||
string name = signal.GetTag();
|
|
||||||
RemoveObject(name);
|
|
||||||
|
|
||||||
//
|
|
||||||
XCSignalObject *iObj;
|
|
||||||
iObj = new XCSignalObject();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isCreated = iObj.Create(
|
|
||||||
ChartIdentification(),
|
|
||||||
name,
|
|
||||||
SubWindowIdentification(),
|
|
||||||
signal //
|
|
||||||
);
|
|
||||||
if (!isCreated)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
iObj.TPWidth(1);
|
|
||||||
iObj.TPColor(clrGreen);
|
|
||||||
iObj.TPWidth(STYLE_DOT);
|
|
||||||
|
|
||||||
//
|
|
||||||
iObj.SLWidth(1);
|
|
||||||
iObj.SLColor(clrRed);
|
|
||||||
iObj.SLWidth(STYLE_DOT);
|
|
||||||
|
|
||||||
//
|
|
||||||
iObj.EntryWidth(1);
|
|
||||||
iObj.EntryColor(clrYellow);
|
|
||||||
iObj.EntryWidth(STYLE_DOT);
|
|
||||||
|
|
||||||
//
|
|
||||||
mDrawnObjects.Add(iObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw Specified State on Chart ...
|
|
||||||
*
|
|
||||||
* @param state: XPOIState instance ...
|
|
||||||
*/
|
|
||||||
void DrawState(
|
|
||||||
XPOIState &state,
|
|
||||||
bool forceUpdateTo = false,
|
|
||||||
bool drawSwingHighs = true,
|
|
||||||
bool drawSwingLows = true,
|
|
||||||
bool drawSupportZones = true,
|
|
||||||
bool drawResistanceZones = true,
|
|
||||||
bool drawSupplyZones = true,
|
|
||||||
bool drawDemandZones = true,
|
|
||||||
bool drawBullishOrderBlocks = true,
|
|
||||||
bool drawBearishOrderBlocks = true,
|
|
||||||
bool drawBullishFairValueGaps = true,
|
|
||||||
bool drawBearishFairValueGaps = true,
|
|
||||||
bool drawBullishRejectionBars = true,
|
|
||||||
bool drawBearishRejectionBars = true,
|
|
||||||
bool drawBullishMomentumBars = true,
|
|
||||||
bool drawBearishMomentumBars = true,
|
|
||||||
bool drawTicksZone = true //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int count = 0;
|
|
||||||
datetime cTime = TimeCurrent();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Swings ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Swing Highs ...
|
|
||||||
if (drawSwingHighs)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.swingHighs);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSwing item = state.swingHighs[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
XCSwingHighObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateSwingHigh(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Swing Lows ...
|
|
||||||
if (drawSwingLows)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.swingLows);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSwing item = state.swingLows[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
XCSwingLowObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateSwingLow(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Support and Resistance Zones ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Support Zones ...
|
|
||||||
if (drawSupportZones)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.supportZones);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSupportZone item = state.supportZones[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCSupportZoneObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateSupportZone(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Resistance Zones ...
|
|
||||||
if (drawResistanceZones)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.resistanceZones);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCResistanceZone item = state.resistanceZones[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCResistanceZoneObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateResistanceZone(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Supply and Demand Zones ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Supply Zones ...
|
|
||||||
if (drawSupplyZones)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.supplyZones);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSupplyZone item = state.supplyZones[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCSupplyZoneObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateSupplyZone(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Demand Zones ...
|
|
||||||
if (drawDemandZones)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.demandZones);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCDemandZone item = state.demandZones[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCDemandZoneObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateDemandZone(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Order Blocks ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish Order Blocks ...
|
|
||||||
if (drawBullishOrderBlocks)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bullishOrderBlocks);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCOrderBlock item = state.bullishOrderBlocks[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBullishOrderBlockObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBullishOrderBlock(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish Order Blocks ...
|
|
||||||
if (drawBearishOrderBlocks)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bearishOrderBlocks);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCOrderBlock item = state.bearishOrderBlocks[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBearishOrderBlockObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBearishOrderBlock(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fair Value Gaps ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish Fair Value Gaps ...
|
|
||||||
if (drawBullishFairValueGaps)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bullishFairValueGaps);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCFVG item = state.bullishFairValueGaps[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBullishFairValueGapObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBullishFairValueGap(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish Fair Value Gaps ...
|
|
||||||
if (drawBearishFairValueGaps)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bearishFairValueGaps);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCFVG item = state.bearishFairValueGaps[i];
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
item.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBearishFairValueGapObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBearishFairValueGap(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Rejection Bars ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish Rejection Bars ...
|
|
||||||
if (drawBullishRejectionBars)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bullishRejectionBars);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCRejectionBar item = state.bullishRejectionBars[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBullishRejectionBarObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBullishRejectionBar(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish Rejection Bars ...
|
|
||||||
if (drawBearishRejectionBars)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bearishRejectionBars);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCRejectionBar item = state.bearishRejectionBars[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBearishRejectionBarObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBearishRejectionBar(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Momentum Bars ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish Momentum Bars ...
|
|
||||||
if (drawBullishMomentumBars)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bullishMomentumBars);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCMomentumBar item = state.bullishMomentumBars[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBullishMomentumBarObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBullishMomentumBar(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish Momentum Bars ...
|
|
||||||
if (drawBearishMomentumBars)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = ArraySize(state.bearishMomentumBars);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCMomentumBar item = state.bearishMomentumBars[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBearishMomentumBarObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateBearishMomentumBar(
|
|
||||||
item,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Ticks Zone ...
|
|
||||||
if (drawTicksZone &&
|
|
||||||
state.ticksZone != NULL)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCTicksZone *iZone = state.ticksZone;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (forceUpdateTo)
|
|
||||||
{
|
|
||||||
iZone.To(cTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XCTicksZoneObject *iObj;
|
|
||||||
bool isCreated = mPOIDrawer.CreateTicksZone(
|
|
||||||
iZone,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Specified Object to Drawn Objects if not Exists ...
|
* Add Specified Object to Drawn Objects if not Exists ...
|
||||||
*/
|
*/
|
||||||
@@ -1377,6 +877,25 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Specified Objects to Drawn Objects if not Exists ...
|
||||||
|
*/
|
||||||
|
void AddObjectsIfNotExists(XCBaseObject *&objects[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = ArraySize(objects);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(objects[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
enum ENUM_X_CYCLES
|
enum ENUM_X_CYCLES
|
||||||
{
|
{
|
||||||
|
X_CYCLE_NONE,
|
||||||
X_CYCLE_TRIGGER,
|
X_CYCLE_TRIGGER,
|
||||||
X_CYCLE_DECISION,
|
X_CYCLE_DECISION,
|
||||||
X_CYCLE_ANALYSE,
|
X_CYCLE_ANALYSE,
|
||||||
@@ -41,6 +42,18 @@ enum ENUM_X_CYCLES
|
|||||||
X_CYCLE_VISION,
|
X_CYCLE_VISION,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
string ToString(ENUM_X_CYCLES value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string result = EnumToString(value);
|
||||||
|
|
||||||
|
//
|
||||||
|
StringReplace(result, "X_CYCLE_", "");
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
enum ENUM_X_CYCLE_EVENTS
|
enum ENUM_X_CYCLE_EVENTS
|
||||||
{
|
{
|
||||||
SAR_CHANGE_DETECTED,
|
SAR_CHANGE_DETECTED,
|
||||||
@@ -50,8 +63,10 @@ enum ENUM_X_CYCLE_EVENTS
|
|||||||
VWAP_ORDER_CHANGE_ETECTED,
|
VWAP_ORDER_CHANGE_ETECTED,
|
||||||
VWAP_STATE_CHANGE_DETCTED,
|
VWAP_STATE_CHANGE_DETCTED,
|
||||||
CONSOLIDATION_BREAKED_DETECTED,
|
CONSOLIDATION_BREAKED_DETECTED,
|
||||||
PIVOT_STARTED,
|
PEAK_PIVOT_STARTED,
|
||||||
PIVOT_ENDED,
|
PEAK_PIVOT_ENDED,
|
||||||
|
VALE_PIVOT_STARTED,
|
||||||
|
VALE_PIVOT_ENDED,
|
||||||
};
|
};
|
||||||
|
|
||||||
class XC121SMCCycleHelper : public XCBase
|
class XC121SMCCycleHelper : public XCBase
|
||||||
@@ -144,6 +159,35 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
mConsolidationLoopback = value;
|
mConsolidationLoopback = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Valid Pivot Points Repetition Length ...
|
||||||
|
* min => 7
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int ValidPivotRepetition()
|
||||||
|
{
|
||||||
|
return mValidPivotRepetition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Valid Pivot Points Repetition Length ...
|
||||||
|
*
|
||||||
|
* @param value: Integer ...
|
||||||
|
* min => 7
|
||||||
|
*/
|
||||||
|
void ValidPivotRepetition(int value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 7)
|
||||||
|
{
|
||||||
|
value = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mValidPivotRepetition = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|
||||||
@@ -191,7 +235,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
symbol,
|
symbol,
|
||||||
period //
|
period //
|
||||||
);
|
);
|
||||||
mPOIDetector.MaxNumberOfRequiredPOIs(0);
|
mPOIDetector.MaxNumberOfRequiredPOIs(10);
|
||||||
mPOIDetector.Init();
|
mPOIDetector.Init();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -457,6 +501,12 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
if (!IsValidSize(ArraySize(mPivots)))
|
||||||
|
{
|
||||||
|
Detect(barIndex);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Calculate(
|
Calculate(
|
||||||
barIndex,
|
barIndex,
|
||||||
@@ -572,315 +622,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect XPV Based POI(s) ...
|
|
||||||
*
|
|
||||||
* @param barIndex: Start Bar Index ...
|
|
||||||
* @param minRepetition: minimum Repeate of POI for Validation ...
|
|
||||||
* @param requiredPivots: Number of Min Requirement POI(s) ...
|
|
||||||
* @param pivotHelper: XC121SMCCycleHelper instance Pointer ...
|
|
||||||
* @param orderFlow: XPVPivot instance Array Reference ...
|
|
||||||
* @param orderFlowDirection: ENUM_X_DIRECTION member Reference which represents OrderFlow Direction ...
|
|
||||||
* @param maxAllowedLoopbackBars: Integer, Max Allowed Loopback Bars ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool DetectOrderFlow(
|
|
||||||
int barIndex,
|
|
||||||
XPVPivot &orderFlow[], // OrderFlows ...
|
|
||||||
ENUM_X_DIRECTION &orderFlowDirection, // Order Flow Direction ...
|
|
||||||
int minRepetition = 0,
|
|
||||||
int requiredPivots = 0,
|
|
||||||
int maxAllowedLoopbackBars = 576 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
orderFlowDirection = X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (maxAllowedLoopbackBars <= 0)
|
|
||||||
{
|
|
||||||
maxAllowedLoopbackBars = 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (minRepetition <= 0)
|
|
||||||
{
|
|
||||||
minRepetition = mX121Helper.GetDonChainLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (requiredPivots <= 0)
|
|
||||||
{
|
|
||||||
requiredPivots = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int start = barIndex;
|
|
||||||
int end = start + maxAllowedLoopbackBars;
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(orderFlow);
|
|
||||||
|
|
||||||
//
|
|
||||||
result = minRepetition > 0 &&
|
|
||||||
requiredPivots > 0;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
string symbol = GetSymbol();
|
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
|
||||||
|
|
||||||
//
|
|
||||||
double peak = 0;
|
|
||||||
XPVPivot peaks[];
|
|
||||||
int peakRepeate = 0;
|
|
||||||
int peakToBarIndex = 0;
|
|
||||||
int peakFromBarIndex = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
double vale = 0;
|
|
||||||
XPVPivot vales[];
|
|
||||||
int valeRepeate = 0;
|
|
||||||
int valeToBarIndex = 0;
|
|
||||||
int valeFromBarIndex = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool canLookupPeak = true;
|
|
||||||
bool canLookupVale = true;
|
|
||||||
bool canLookup = true;
|
|
||||||
while (canLookup)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Check Peak ...
|
|
||||||
double iPeak = mX121Helper.GetPeak(barIndex);
|
|
||||||
if (iPeak != peak)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (peak != 0 &&
|
|
||||||
peakRepeate >= minRepetition)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isExists = false;
|
|
||||||
int count = ArraySize(peaks);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPVPivot iPivot = peaks[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
if (iPivot.upper == iPeak)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isExists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isExists)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPVPivot iPivot;
|
|
||||||
|
|
||||||
//
|
|
||||||
iPivot.lower = 0;
|
|
||||||
iPivot.upper = peak;
|
|
||||||
iPivot.symbol = symbol;
|
|
||||||
iPivot.period = period;
|
|
||||||
iPivot.type = XPV_PEAK;
|
|
||||||
iPivot.repetition = peakRepeate;
|
|
||||||
iPivot.to = iTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
peakToBarIndex //
|
|
||||||
);
|
|
||||||
iPivot.from = iTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
peakFromBarIndex //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
iPivot.lower = iPivot.CalculateLower();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isValid = iPivot.IsValid();
|
|
||||||
if (isValid)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
iPivot,
|
|
||||||
peaks //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
peak = iPeak;
|
|
||||||
peakRepeate = 0;
|
|
||||||
peakFromBarIndex = 0;
|
|
||||||
peakToBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
else if (iPeak == peak)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
peakRepeate++;
|
|
||||||
peakFromBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Vale ...
|
|
||||||
double iVale = mX121Helper.GetVale(barIndex);
|
|
||||||
if (iVale != vale)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (vale != 0 &&
|
|
||||||
valeRepeate >= minRepetition)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isExists = false;
|
|
||||||
int count = ArraySize(vales);
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPVPivot iPivot = vales[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
if (iPivot.lower == iVale)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isExists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isExists)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPVPivot iPivot;
|
|
||||||
|
|
||||||
//
|
|
||||||
iPivot.upper = 0;
|
|
||||||
iPivot.lower = vale;
|
|
||||||
iPivot.symbol = symbol;
|
|
||||||
iPivot.period = period;
|
|
||||||
iPivot.type = XPV_VALE;
|
|
||||||
iPivot.repetition = valeRepeate;
|
|
||||||
iPivot.to = iTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
valeToBarIndex //
|
|
||||||
);
|
|
||||||
iPivot.from = iTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
valeFromBarIndex //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
iPivot.upper = iPivot.CalculateUpper();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isValid = iPivot.IsValid();
|
|
||||||
if (isValid)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
iPivot,
|
|
||||||
vales //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
vale = iVale;
|
|
||||||
valeRepeate = 0;
|
|
||||||
valeFromBarIndex = 0;
|
|
||||||
valeToBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
else if (iVale == vale)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
valeRepeate++;
|
|
||||||
valeFromBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
canLookupPeak = ArraySize(peaks) < requiredPivots;
|
|
||||||
canLookupVale = ArraySize(vales) < requiredPivots;
|
|
||||||
canLookup = barIndex < end &&
|
|
||||||
(canLookupPeak ||
|
|
||||||
canLookupVale);
|
|
||||||
if (canLookup)
|
|
||||||
{
|
|
||||||
barIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsValidSize(ArraySize(peaks)) ||
|
|
||||||
IsValidSize(ArraySize(vales));
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Order Flow ...
|
|
||||||
Copy(
|
|
||||||
peaks,
|
|
||||||
orderFlow,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
vales,
|
|
||||||
orderFlow,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
int count = ArraySize(orderFlow);
|
|
||||||
result = IsValidSize(orderFlow);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sort Pivots ...
|
|
||||||
SortPivots(orderFlow);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Filter Broken Order Flows ...
|
|
||||||
FilterBrokenPivots(orderFlow);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Order Flow Direction ...
|
|
||||||
result = DetectPivotDirection(
|
|
||||||
orderFlow,
|
|
||||||
orderFlowDirection //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Cycle Trend Based On Pivots ...
|
* Detect Cycle Trend Based On Pivots ...
|
||||||
*
|
*
|
||||||
@@ -1616,18 +1357,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Current Active Pivot ...
|
|
||||||
*
|
|
||||||
* @param pivot: XPVPivot instance reference ...
|
|
||||||
*/
|
|
||||||
void GetActivePivot(XPVPivot &pivot)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
mActivePivot.to = TimeCurrent();
|
|
||||||
pivot = mActivePivot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count Calculated Pivots ...
|
* Count Calculated Pivots ...
|
||||||
*
|
*
|
||||||
@@ -1666,6 +1395,86 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Last Pivot ...
|
||||||
|
*
|
||||||
|
* @param pivot: XPVPivot instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool GetLastPivot(XPVPivot &pivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
pivot.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
XPVPivot pivots[];
|
||||||
|
int count = FillPivots(pivots);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
pivot = pivots[count - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = pivot.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Active Peak Pivot ...
|
||||||
|
*
|
||||||
|
* @param pivot: XPVPivot instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool GetActivePeakPivot(XPVPivot &pivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
pivot.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
pivot = mActivePeakPivot;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = pivot.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Active Vale Pivot ...
|
||||||
|
*
|
||||||
|
* @param pivot: XPVPivot instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool GetActiveValePivot(XPVPivot &pivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
pivot.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
pivot = mActiveValePivot;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = pivot.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Virtuals ...
|
// Virtuals ...
|
||||||
|
|
||||||
@@ -1675,6 +1484,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
virtual void Default()
|
virtual void Default()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
ValidPivotRepetition(21);
|
||||||
ConsolidationLoopback(10);
|
ConsolidationLoopback(10);
|
||||||
MaxAllowedSavedChanges(50);
|
MaxAllowedSavedChanges(50);
|
||||||
}
|
}
|
||||||
@@ -2118,7 +1928,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
int repetition = 0;
|
int repetition = 0;
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
int periodSeconds = PeriodSeconds(period);
|
int periodSeconds = PeriodSeconds(period);
|
||||||
int minRepetition = mX121Helper.GetDonChainLength();
|
int minRepetition = ValidPivotRepetition();
|
||||||
ENUM_XPV_PIVOTS type = isNewPeak
|
ENUM_XPV_PIVOTS type = isNewPeak
|
||||||
? XPV_PEAK
|
? XPV_PEAK
|
||||||
: XPV_VALE;
|
: XPV_VALE;
|
||||||
@@ -2180,67 +1990,340 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //
|
//
|
||||||
// // Calculate Pivots ...
|
// Calculate XPVPivot ...
|
||||||
// if (isNewPeak || isNewVale)
|
int pvValidation = ValidPivotRepetition();
|
||||||
// {
|
if (IsValidSize(pvValidation))
|
||||||
// //
|
{
|
||||||
// if (!mActivePivot.IsValid())
|
//
|
||||||
// {
|
// Peak ...
|
||||||
// //
|
mActivePeakPivot.symbol = symbol;
|
||||||
// mActivePivot.symbol = symbol;
|
mActivePeakPivot.period = period;
|
||||||
// mActivePivot.period = period;
|
mActivePeakPivot.type = XPV_PEAK;
|
||||||
|
|
||||||
// //
|
//
|
||||||
// mActivePivot.upper = peak;
|
if (mActivePeakPivot.upper == 0 && peak > 0)
|
||||||
// mActivePivot.lower = vale;
|
{
|
||||||
|
//
|
||||||
|
mActivePeakPivot.upper = peak;
|
||||||
|
mActivePeakPivot.lower = vale;
|
||||||
|
mActivePeakPivot.from = changeBar.time;
|
||||||
|
|
||||||
// //
|
//
|
||||||
// mActivePivot.from = cTime;
|
Add(
|
||||||
// mActivePivot.to = cTime;
|
PEAK_PIVOT_STARTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (mActivePeakPivot.upper > 0 && mActivePeakPivot.upper == peak)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mActivePeakPivot.repetition++;
|
||||||
|
mActivePeakPivot.to = changeBar.time;
|
||||||
|
}
|
||||||
|
else if (mActivePeakPivot.upper > 0 && mActivePeakPivot.upper != peak)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (mActivePeakPivot.repetition >= pvValidation)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
mActivePeakPivot,
|
||||||
|
mPivots //
|
||||||
|
);
|
||||||
|
|
||||||
// //
|
//
|
||||||
// mActivePivot.type =
|
Add(
|
||||||
// isNewPeak
|
PEAK_PIVOT_ENDED,
|
||||||
// ? XPV_VALE
|
events //
|
||||||
// : XPV_PEAK;
|
);
|
||||||
// mActivePivot.repetition++;
|
|
||||||
|
|
||||||
// //
|
//
|
||||||
// Add(
|
mActivePeakPivot.Clean();
|
||||||
// PIVOT_STARTED,
|
}
|
||||||
// events //
|
else
|
||||||
// );
|
{
|
||||||
// }
|
//
|
||||||
// else
|
mActivePeakPivot.upper = peak;
|
||||||
// {
|
mActivePeakPivot.lower = vale;
|
||||||
// //
|
mActivePeakPivot.repetition = 0;
|
||||||
// mActivePivot.to = cTime;
|
mActivePeakPivot.from = changeBar.time;
|
||||||
|
|
||||||
// //
|
//
|
||||||
// mActivePivot.repetition++;
|
Add(
|
||||||
|
PEAK_PIVOT_STARTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// //
|
//
|
||||||
// if (mActivePivot.to > mActivePivot.from)
|
// Vale ...
|
||||||
// {
|
mActiveValePivot.symbol = symbol;
|
||||||
// FillPivotState(mActivePivot);
|
mActiveValePivot.period = period;
|
||||||
// }
|
mActiveValePivot.type = XPV_VALE;
|
||||||
|
|
||||||
// //
|
//
|
||||||
// // Check Ticks Zone is Valid ...
|
// Peak ...
|
||||||
// bool isTicksZoneValid =
|
if (mActiveValePivot.lower == 0 && vale > 0)
|
||||||
// //
|
{
|
||||||
// mActivePivot.state.IsValid() &&
|
//
|
||||||
// mActivePivot.state.ticksZone != NULL &&
|
mActiveValePivot.lower = vale;
|
||||||
// mActivePivot.state.ticksZone.IsValid()
|
mActiveValePivot.upper = peak;
|
||||||
// //
|
mActiveValePivot.from = changeBar.time;
|
||||||
// ;
|
|
||||||
// if (isTicksZoneValid) {
|
//
|
||||||
// //
|
Add(
|
||||||
// Print("Has Valid Ticks Zone ...");
|
VALE_PIVOT_STARTED,
|
||||||
// }
|
events //
|
||||||
// }
|
);
|
||||||
// }
|
}
|
||||||
|
else if (mActiveValePivot.lower > 0 && mActiveValePivot.lower == vale)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mActiveValePivot.repetition++;
|
||||||
|
mActiveValePivot.to = changeBar.time;
|
||||||
|
}
|
||||||
|
else if (mActiveValePivot.lower > 0 && mActiveValePivot.lower != vale)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (mActiveValePivot.repetition >= pvValidation)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
mActiveValePivot,
|
||||||
|
mPivots //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
VALE_PIVOT_ENDED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
mActiveValePivot.Clean();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mActiveValePivot.lower = vale;
|
||||||
|
mActiveValePivot.upper = peak;
|
||||||
|
mActiveValePivot.repetition = 0;
|
||||||
|
mActiveValePivot.from = changeBar.time;
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
VALE_PIVOT_STARTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Requirements ...
|
||||||
|
*/
|
||||||
|
void Detect(int barIndex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (isDetecting)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int start = barIndex;
|
||||||
|
int max = 576;
|
||||||
|
int validPivotRepetition = ValidPivotRepetition();
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try To Detect Valid Peaks or Vales ...
|
||||||
|
double peak = 0;
|
||||||
|
double vale = 0;
|
||||||
|
int peakRepetition = 0;
|
||||||
|
int valeRepetition = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
int from = start;
|
||||||
|
int index = from;
|
||||||
|
int count = start + max;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canContinue = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Loop Throug Peaks and Vales ...
|
||||||
|
while (canContinue)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
datetime toTime = iTime(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
index //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double iPeak = mX121Helper.GetPeak(index);
|
||||||
|
double iVale = mX121Helper.GetVale(index);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Peak ...
|
||||||
|
if (peak == 0 && iPeak > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
peak = iPeak;
|
||||||
|
peakRepetition = 0;
|
||||||
|
}
|
||||||
|
else if (peak > 0 && iPeak > 0 && peak == iPeak)
|
||||||
|
{
|
||||||
|
peakRepetition++;
|
||||||
|
}
|
||||||
|
else if (peak > 0 && iPeak > 0 && peak != iPeak)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (peakRepetition >= validPivotRepetition)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
datetime fromTime = iTime(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
index - peakRepetition //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create XPVPivotPoint ...
|
||||||
|
XPVPivotPoint pivotPoint;
|
||||||
|
pivotPoint.value = iPeak;
|
||||||
|
pivotPoint.time = toTime;
|
||||||
|
pivotPoint.type = XPV_PEAK;
|
||||||
|
pivotPoint.repetition = peakRepetition;
|
||||||
|
if (pivotPoint.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
pivotPoint,
|
||||||
|
mPivotPoints //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create XPVPivot ...
|
||||||
|
XPVPivot pivot;
|
||||||
|
pivot.symbol = symbol;
|
||||||
|
pivot.period = period;
|
||||||
|
pivot.from = fromTime;
|
||||||
|
pivot.to = toTime;
|
||||||
|
pivot.repetition = peakRepetition;
|
||||||
|
pivot.type = XPV_PEAK;
|
||||||
|
pivot.upper = peak;
|
||||||
|
pivot.lower = iVale;
|
||||||
|
FillPivotState(pivot);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (pivot.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
pivot,
|
||||||
|
mPivots //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
peak = iPeak;
|
||||||
|
peakRepetition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Vale ...
|
||||||
|
if (vale == 0 && iVale > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
vale = iVale;
|
||||||
|
valeRepetition = 0;
|
||||||
|
}
|
||||||
|
else if (vale > 0 && iVale > 0 && vale == iVale)
|
||||||
|
{
|
||||||
|
valeRepetition++;
|
||||||
|
}
|
||||||
|
else if (vale > 0 && iVale > 0 && vale != iVale)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (valeRepetition >= validPivotRepetition)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
datetime fromTime = iTime(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
index - valeRepetition //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create XPVPivotPoint ...
|
||||||
|
XPVPivotPoint pivotPoint;
|
||||||
|
pivotPoint.value = iVale;
|
||||||
|
pivotPoint.time = toTime;
|
||||||
|
pivotPoint.type = XPV_VALE;
|
||||||
|
pivotPoint.repetition = valeRepetition;
|
||||||
|
if (pivotPoint.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
pivotPoint,
|
||||||
|
mPivotPoints //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create XPVPivot ...
|
||||||
|
XPVPivot pivot;
|
||||||
|
pivot.symbol = symbol;
|
||||||
|
pivot.period = period;
|
||||||
|
pivot.from = fromTime;
|
||||||
|
pivot.to = toTime;
|
||||||
|
pivot.repetition = valeRepetition;
|
||||||
|
pivot.type = XPV_VALE;
|
||||||
|
pivot.upper = iPeak;
|
||||||
|
pivot.lower = vale;
|
||||||
|
FillPivotState(pivot);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (pivot.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
pivot,
|
||||||
|
mPivots //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
vale = iVale;
|
||||||
|
valeRepetition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
index++;
|
||||||
|
canContinue = index < count;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int pivotsCount = ArraySize(mPivots);
|
||||||
|
if (IsValidSize(mPivots))
|
||||||
|
{
|
||||||
|
ArrayReverse(mPivots);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isDetecting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2263,12 +2346,14 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
XConsolidationZone mActioveConsolidationZone; // Holds Actiove Consolidation Zone ...
|
XConsolidationZone mActioveConsolidationZone; // Holds Actiove Consolidation Zone ...
|
||||||
|
|
||||||
//
|
//
|
||||||
|
int mValidPivotRepetition; // Valid Pivot Point's Repetition ...
|
||||||
XPVPivotPoint mPivotPoints[]; // Holds Pivots ...
|
XPVPivotPoint mPivotPoints[]; // Holds Pivots ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XCXPVPivotObject mActivePivotObject;
|
bool isDetecting;
|
||||||
XPVPivot mActivePivot;
|
XPVPivot mActivePeakPivot; // Active Pivots ...
|
||||||
XPVPivot mPivots[];
|
XPVPivot mActiveValePivot; // Active Pivots ...
|
||||||
|
XPVPivot mPivots[]; // Holds Active Pivot ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|||||||
@@ -629,6 +629,16 @@ struct X121SMCTradeData
|
|||||||
return signal.tp;
|
return signal.tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Model Target ...
|
||||||
|
*
|
||||||
|
* @return ( double )
|
||||||
|
*/
|
||||||
|
double Target()
|
||||||
|
{
|
||||||
|
return signal.target;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Position Spread on Open Time ...
|
* Get Position Spread on Open Time ...
|
||||||
*
|
*
|
||||||
@@ -2369,8 +2379,9 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Check Deal Reason ...
|
// Check Deal Reason ...
|
||||||
bool isTP = deal.reason == DEAL_REASON_TP;
|
bool isTP = deal.reason == DEAL_REASON_TP ||
|
||||||
bool isSL = deal.reason == DEAL_REASON_SL;
|
(deal.reason == DEAL_REASON_SL && deal.profit > 0);
|
||||||
|
bool isSL = deal.reason == DEAL_REASON_SL && deal.profit < 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare Specified Message Based on Deal Reason ...
|
// Prepare Specified Message Based on Deal Reason ...
|
||||||
@@ -2494,7 +2505,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Simulate TP/SL based on Closing Profit ...
|
// Simulate TP/SL based on Closing Profit ...
|
||||||
bool isTP = position.profit > 0;
|
bool isTP = position.profit > 0;
|
||||||
bool isSL = position.profit < 0;
|
bool isSL = position.profit <= 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isTP || isSL)
|
if (isTP || isSL)
|
||||||
@@ -2890,7 +2901,8 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
mTrader.GetPositions(
|
mTrader.GetPositions(
|
||||||
longs,
|
longs,
|
||||||
shorts,
|
shorts,
|
||||||
signal.symbol //
|
signal.symbol,
|
||||||
|
signal.provider //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2899,7 +2911,8 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
mTrader.GetPositions(
|
mTrader.GetPositions(
|
||||||
longs,
|
longs,
|
||||||
shorts,
|
shorts,
|
||||||
NULL // All Symbols ...
|
NULL, // All Symbols ...
|
||||||
|
signal.provider //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3394,6 +3407,40 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle RF On Target ...
|
||||||
|
double target = iData.Target();
|
||||||
|
bool canRF =
|
||||||
|
target > 0 &&
|
||||||
|
target > entry &&
|
||||||
|
(isLong
|
||||||
|
? iPosition.sl < target
|
||||||
|
: iPosition.sl > target) &&
|
||||||
|
iPosition.price > target + (10 * points);
|
||||||
|
if (canRF)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double sl = target;
|
||||||
|
double tp = iPosition.tp;
|
||||||
|
string comment = "RF On Target ...";
|
||||||
|
bool isModified = mTrader.Modify(
|
||||||
|
iData.ticket,
|
||||||
|
sl,
|
||||||
|
tp,
|
||||||
|
comment //
|
||||||
|
);
|
||||||
|
if (isModified)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string message = ToString(iData.Type()) +
|
||||||
|
" Position: " +
|
||||||
|
ToString(iData.ticket) +
|
||||||
|
" RF On Traget: " + ToString(target) +
|
||||||
|
" Successfully ...";
|
||||||
|
Alert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,7 @@ struct X121SMCStrategyTestSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
double sl;
|
double sl;
|
||||||
|
double target;
|
||||||
ENUM_X_DIRECTION dir;
|
ENUM_X_DIRECTION dir;
|
||||||
ENUM_X_POSITION_TYPES type;
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ struct X121SMCStrategyTestSignalConditions
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
sl = 0;
|
sl = 0;
|
||||||
|
target = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,7 @@ struct X121SMCStrategyXPVDPSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
double sl;
|
double sl;
|
||||||
|
double target;
|
||||||
ENUM_X_DIRECTION dir;
|
ENUM_X_DIRECTION dir;
|
||||||
ENUM_X_POSITION_TYPES type;
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
@@ -68,6 +69,7 @@ struct X121SMCStrategyXPVDPSignalConditions
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
sl = 0;
|
sl = 0;
|
||||||
|
target = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ struct X121SMCStrategyXPVOBSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
double sl;
|
double sl;
|
||||||
|
double target;
|
||||||
ENUM_X_DIRECTION dir;
|
ENUM_X_DIRECTION dir;
|
||||||
ENUM_X_POSITION_TYPES type;
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ struct X121SMCStrategyXPVOBSignalConditions
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
sl = 0;
|
sl = 0;
|
||||||
|
target = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ struct X121SMCStrategyXPVSUPDEMSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
double sl;
|
double sl;
|
||||||
|
double target;
|
||||||
ENUM_X_DIRECTION dir;
|
ENUM_X_DIRECTION dir;
|
||||||
ENUM_X_POSITION_TYPES type;
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ struct X121SMCStrategyXPVSUPDEMSignalConditions
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
sl = 0;
|
sl = 0;
|
||||||
|
target = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
double sl;
|
double sl;
|
||||||
|
double target;
|
||||||
ENUM_X_DIRECTION dir;
|
ENUM_X_DIRECTION dir;
|
||||||
ENUM_X_POSITION_TYPES type;
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
@@ -47,6 +48,18 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
datetime setupTime;
|
datetime setupTime;
|
||||||
datetime triggerTime;
|
datetime triggerTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
int peakRepeat;
|
||||||
|
double farPeak;
|
||||||
|
double middlePeak;
|
||||||
|
double nearPeak;
|
||||||
|
|
||||||
|
//
|
||||||
|
int valeRepeat;
|
||||||
|
double farVale;
|
||||||
|
double middleVale;
|
||||||
|
double nearVale;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
X121SMCStrategyXTWPVSignalConditions()
|
X121SMCStrategyXTWPVSignalConditions()
|
||||||
@@ -64,6 +77,7 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
sl = 0;
|
sl = 0;
|
||||||
|
target = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
@@ -160,6 +174,17 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
*/
|
*/
|
||||||
void ExtensionClean()
|
void ExtensionClean()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
peakRepeat = 0;
|
||||||
|
farPeak = 0;
|
||||||
|
middlePeak = 0;
|
||||||
|
nearPeak = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
valeRepeat = 0;
|
||||||
|
farVale = 0;
|
||||||
|
middleVale = 0;
|
||||||
|
nearVale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -368,28 +393,29 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
// Setup Conditions ...
|
// Setup Conditions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullish =
|
// Detect Market Trend ...
|
||||||
//
|
// ENUM_X_DIRECTION trend;
|
||||||
false
|
// bool hasTrend = verificationCycleHelper
|
||||||
//
|
// .DetectTrend(trend);
|
||||||
;
|
// bool hasBullishTrend = hasTrend &&
|
||||||
|
// IsBullish(trend);
|
||||||
|
// bool hasBearishTrend = hasTrend &&
|
||||||
|
// IsBearish(trend);
|
||||||
|
// result = hasBullishTrend ||
|
||||||
|
// hasBearishTrend;
|
||||||
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
isBearish =
|
// Check Exists Valid Peaks or Vales ...
|
||||||
//
|
|
||||||
false
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isBullish ||
|
result = isBullish ||
|
||||||
isBearish;
|
isBearish;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Clean Conditions for Regenerate ...
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,17 +639,54 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
//
|
//
|
||||||
// Trigger Conditions ...
|
// Trigger Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check VWap State ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWapBullishState = triggerConditions.x121Conditions.isVWapBullishState;
|
||||||
|
bool isVWapBearishState = triggerConditions.x121Conditions.isVWapBearishState;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
IsBullish(setupDir) &&
|
||||||
|
isVWapBullishState;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
IsBearish(setupDir) &&
|
||||||
|
isVWapBearishState;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Waitings For Sar Switched to Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double sar = triggerConditions.x121Conditions.sarBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSarSwitchedToBullish = triggerConditions.x121Conditions.isSarSwitchedToBullish;
|
||||||
|
bool isSarSwitchedToBearish = triggerConditions.x121Conditions.isSarSwitchedToBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullish =
|
isBullish =
|
||||||
//
|
//
|
||||||
false
|
isBullish &&
|
||||||
|
isSarSwitchedToBullish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
isBearish =
|
isBearish =
|
||||||
//
|
//
|
||||||
false
|
isBearish &&
|
||||||
|
isSarSwitchedToBearish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -647,10 +710,32 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Detect Nearest FVG or Supply Zone For Traget ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Source State ...
|
||||||
|
XPOIState state = triggerState;
|
||||||
|
|
||||||
|
//
|
||||||
|
double target = CalculateTarget(
|
||||||
|
cBar,
|
||||||
|
state,
|
||||||
|
setupDir //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = target > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.target = target;
|
||||||
conditions.triggerTime = cTime;
|
conditions.triggerTime = cTime;
|
||||||
conditions.sl = isBullish
|
conditions.sl = isBullish
|
||||||
? 0
|
? sar
|
||||||
: 0;
|
: sar;
|
||||||
conditions.type = isBullish
|
conditions.type = isBullish
|
||||||
? X_POSITION_TYPE_LONG
|
? X_POSITION_TYPE_LONG
|
||||||
: X_POSITION_TYPE_SHORT;
|
: X_POSITION_TYPE_SHORT;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ struct X121SMCStrategyXVWPBSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
double sl;
|
double sl;
|
||||||
|
double target;
|
||||||
ENUM_X_DIRECTION dir;
|
ENUM_X_DIRECTION dir;
|
||||||
ENUM_X_POSITION_TYPES type;
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ struct X121SMCStrategyXVWPBSignalConditions
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
sl = 0;
|
sl = 0;
|
||||||
|
target = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user