Add Supports for Consolidation Range Founder ...

- [] required to Complete Supply and Demand Zone Retrieve in XConsolidation Zone Struct ...
This commit is contained in:
2024-12-11 02:14:37 +03:30
parent b5cec1f52a
commit a64430a28c
6 changed files with 1256 additions and 151 deletions
+249 -58
View File
@@ -26,6 +26,200 @@
// //
// Definitions ... // Definitions ...
//
// Consolidation Zone ...
struct XConsolidationZone
{
//
// Props ...
//
string symbol; // Symbol ...
ENUM_TIMEFRAMES period; // Period ...
//
double upper; // Upper ...
double lower; // Lower ...
//
int loopback; // Loopback ...
//
ENUM_X_DIRECTION breakDirection; // Break Direction ...
XOHCL breakerBar; // Breaker Bar ...
//
// Constructor ...
XConsolidationZone()
{
Clean();
}
//
// Tools ...
/**
* Initialize Zone ...
*
* @param _symbol: String ...
* @param _period: ENUM_TIMEFRAMES member ...
* @param _upper: Double ...
* @param _lower: Double ...
* @param _loopback: Integer ...
*
* @return ( bool )
*/
bool Init(
string _symbol,
ENUM_TIMEFRAMES _period,
double _upper,
double _lower,
int _loopback //
)
{
//
bool result = false;
//
_symbol = NormalizeSymbol(_symbol);
_period = NormalizePeriod(_period);
//
result =
//
_upper > 0 &&
_lower > 0 &&
_loopback > 0
//
;
//
upper = _upper;
lower = _lower;
symbol = _symbol;
period = _period;
loopback = _loopback;
//
result = IsValid();
//
return result;
}
/**
* Cleanup ...
*/
void Clean()
{
//
symbol = NULL;
period = NULL;
upper = 0;
lower = 0;
loopback = 0;
breakerBar.Clean();
breakDirection = X_DIRECTION_NONE;
}
/**
* Validate ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result =
//
IsValid(symbol) &&
IsValid(period) &&
upper > 0 &&
lower > 0 &&
loopback > 0
//
;
//
return result;
}
/**
* Check Zone is Breaked or not ...
*
* @return ( bool )
*/
bool IsBreaked()
{
//
bool result = false;
//
result = breakerBar.IsValid() &&
HasDirection(breakDirection);
//
return result;
}
/**
* Detect Supply Zone if Exists ...
*
* @return ( bool )
*/
bool DetectSupplyZone(
XCSupplyZone *&zone //
)
{
//
bool result = false;
//
result = IsBreaked();
if (!result)
{
return result;
}
//
// Implment Zone Finding ...
//
return result;
}
/**
* Detect Demand Zone if Exists ...
*
* @return ( bool )
*/
bool DetectDemandZone(
XCDemandZone *&zone //
)
{
//
bool result = false;
//
result = IsBreaked();
if (!result)
{
return result;
}
//
// Implment Zone Finding ...
//
return result;
}
//
};
// //
// Implementations ... // Implementations ...
class XCBarAnalyser : public XCBase class XCBarAnalyser : public XCBase
@@ -359,91 +553,88 @@ class XCBarAnalyser : public XCBase
} }
/** /**
* Detect Consolidation Range ... * Detect Price Consolidation ...
* *
* @param index: Integer, Start Bar Index ... * @param bar: XOHCL instance Reference, Start Bar ...
* @param range: Integer, Range of Bars ... * @param loopback: Integer, Consolidation Range Finder ...
* @param maxRange: Consolidation Price Range in Points ... * @param upper: Double Reference ...
* @param symbol: String, Symbol ... * @param lower: Double Reference ...
* @param period: ENUM_TIMEFRAMES member, Period ... * @param upperAppliedTo: ENUM_APPLIED_PRICE member, Upper Price ...
* @param lowerAppliedTo: ENUM_APPLIED_PRICE member, Lower Price ...
* *
* @return ( bool ) * @return ( bool )
*/ */
bool IsConsolidating( bool IsConsolidate(
int index, XOHCL &bar,
int range, double &upper,
double maxRange, double &lower,
string symbol = NULL, int loopback = 30,
ENUM_TIMEFRAMES period = NULL // ENUM_APPLIED_PRICE upperAppliedTo = PRICE_HIGH,
ENUM_APPLIED_PRICE lowerAppliedTo = PRICE_LOW //
) )
{ {
// //
bool result = false; bool result = false;
// //
if (index < 0) upper = 0;
lower = 0;
//
if (loopback < 7)
{ {
index = 0; loopback = 7;
} }
// //
if (range < 1) result = bar.IsValid();
if (!result)
{ {
range = 1; return result;
} }
// //
if (maxRange < 1) int consolidationRange = 30;
{ double points = GetPoints(bar.symbol);
maxRange = 1; int index = bar.Index();
}
// //
// Normalize ... double upperPrice[];
symbol = NormalizeSymbol(symbol); int upperPriceCount = FillPrice(
period = NormalizePeriod(period); upperPrice,
upperAppliedTo,
// bar.symbol,
// Point Value ... bar.period,
double point = GetPoints(symbol); index,
loopback //
//
double high = iHigh(
symbol,
period,
index //
);
double low = iLow(
symbol,
period,
index //
); );
// //
// Detect Range High and Low ... double lowerPrice[];
for (int i = 1; i < range; i++) int lowerPriceCount = FillPrice(
lowerPrice,
lowerAppliedTo,
bar.symbol,
bar.period,
index,
loopback //
);
//
result = upperPriceCount == lowerPriceCount &&
lowerPriceCount == loopback;
if (!result)
{ {
// return result;
double iH = iHigh(
symbol,
period,
index + i //
);
//
double iL = iLow(
symbol,
period,
index + i //
);
//
high = MathMax(high, iH);
low = MathMin(low, iL);
} }
// //
result = (high - low) <= (maxRange * point); upper = upperPrice[ArrayMaximum(upperPrice)];
lower = lowerPrice[ArrayMinimum(lowerPrice)];
//
double range = upper - lower;
result = range <= consolidationRange * points;
// //
return result; return result;
+90
View File
@@ -2591,3 +2591,93 @@
// // conditions.sl = breakerBar.high; // // conditions.sl = breakerBar.high;
// conditions.sl = conditions.triggerConditions.xchsarConditions.cSars[0]; // conditions.sl = conditions.triggerConditions.xchsarConditions.cSars[0];
// } // }
//////////////////////////////////////////////////////////////////
//
bool isSamePeaks =
//
conditions.triggerConditions.x121Conditions.peaksBuffer[0] == conditions.decisionConditions.x121Conditions.peaksBuffer[0] &&
conditions.decisionConditions.x121Conditions.peaksBuffer[0] == conditions.analyseConditions.x121Conditions.peaksBuffer[0]
// &&
// conditions.analyseConditions.x121Conditions.peaksBuffer[0] == conditions.verificationConditions.x121Conditions.peaksBuffer[0] &&
// conditions.verificationConditions.x121Conditions.peaksBuffer[0] == conditions.consolidationConditions.x121Conditions.peaksBuffer[0] &&
// conditions.consolidationConditions.x121Conditions.peaksBuffer[0] == conditions.visionConditions.x121Conditions.peaksBuffer[0]
//
;
if (isSamePeaks) {
Print("isSamePeaks");
}
//
bool isSameVales =
//
conditions.triggerConditions.x121Conditions.valesBuffer[0] == conditions.decisionConditions.x121Conditions.valesBuffer[0] &&
conditions.decisionConditions.x121Conditions.valesBuffer[0] == conditions.analyseConditions.x121Conditions.valesBuffer[0]
// &&
// conditions.analyseConditions.x121Conditions.valesBuffer[0] == conditions.verificationConditions.x121Conditions.valesBuffer[0] &&
// conditions.verificationConditions.x121Conditions.valesBuffer[0] == conditions.consolidationConditions.x121Conditions.valesBuffer[0] &&
// conditions.consolidationConditions.x121Conditions.valesBuffer[0] == conditions.visionConditions.x121Conditions.valesBuffer[0]
//
;
if (isSameVales) {
Print("isSameVales");
}
//////////////////////////////////////////////////////////////////////
//
// Detect Valid Supply and Demand Zones ...
XCSupplyZone *supplyZone;
XCDemandZone *demandZone;
result = mTriggerCycleHelper
.DetectValisSupplyZone(
cBar,
supplyZone,
demandZone //
);
if (!result)
{
//
conditions.Clean();
return result;
}
//
supplyZone.To(cTime);
XCSupplyZoneObject *iSupplyZoneObj;
result = mPOIDrawer.CreateSupplyZone(
supplyZone,
iSupplyZoneObj //
);
if (!result)
{
//
conditions.Clean();
return result;
}
//
demandZone.To(cTime);
XCDemandZoneObject *iDemandZoneObj;
result = mPOIDrawer.CreateDemandZone(
demandZone,
iDemandZoneObj //
);
if (!result)
{
//
conditions.Clean();
return result;
}
//
Print("Supply and Demand Zone Created ...");
//////////////////////////////////////////////////////////////////////
+113
View File
@@ -8486,6 +8486,119 @@ bool DetectMomentumChange(
return result; return result;
} }
//
// Fill Specified Applied Prices ...
int FillPrice(
double &buffer[],
ENUM_APPLIED_PRICE _mAppliedTo = PRICE_CLOSE,
string _mSymbol = NULL,
ENUM_TIMEFRAMES _mPeriod = NULL,
int _mStart = 0,
int _mLoopback = 10 //
)
{
//
int result = 0;
//
if (_mStart < 0)
{
_mStart = 0;
}
//
if (_mLoopback < 7)
{
_mLoopback = 7;
}
//
_mSymbol = NormalizeSymbol(_mSymbol);
_mPeriod = NormalizePeriod(_mPeriod);
//
Clean(buffer);
ArraySetAsSeries(buffer, true);
//
double open[];
result = CopyOpen(
_mSymbol,
_mPeriod,
_mStart,
_mLoopback,
open //
);
if (!IsValidSize(result)) {
return result;
}
//
double high[];
result = CopyHigh(
_mSymbol,
_mPeriod,
_mStart,
_mLoopback,
high //
);
if (!IsValidSize(result)) {
return result;
}
//
double low[];
result = CopyLow(
_mSymbol,
_mPeriod,
_mStart,
_mLoopback,
low //
);
if (!IsValidSize(result)) {
return result;
}
//
double close[];
result = CopyClose(
_mSymbol,
_mPeriod,
_mStart,
_mLoopback,
close //
);
if (!IsValidSize(result)) {
return result;
}
//
for (int i = 0; i < result; i++)
{
//
double iPrice = GetAppliedPrice(
_mAppliedTo,
open,
high,
low,
close,
i //
);
//
Add(
iPrice,
buffer //
);
}
//
result = ArraySize(buffer);
//
return result;
}
// //
// Symbols ... // Symbols ...
@@ -90,6 +90,33 @@ class XC121SMCCycleHelper : public XCBase
mMaxAllowedSavedChanges = value; mMaxAllowedSavedChanges = value;
} }
/**
* Get Consolidation Loopback Length ...
*
* @return ( int )
*/
int ConsolidationLoopback()
{
return mConsolidationLoopback;
}
/**
* Set Consolidation Loopback Length ...
*
* @param value: Integer ...
*/
void ConsolidationLoopback(int value)
{
//
if (value < 7)
{
value = 7;
}
//
mConsolidationLoopback = value;
}
// //
// Actions ... // Actions ...
@@ -655,6 +682,231 @@ class XC121SMCCycleHelper : public XCBase
return result; return result;
} }
//
// Change Values Actions ...
/**
* Count Saved Parabolic Sar Changes ...
*
* @return ( int )
*/
int CountSarChanges()
{
return ArraySize(mSarChanges);
}
/**
* Fill Saved Sar Changes ...
*
* @param changes: XValueChange instance Array Reference ...
*
* @return ( int )
*/
int FillSarChanges(
XValueChange &changes[] //
)
{
//
Clean(changes);
//
Copy(
mSarChanges,
changes //
);
//
int result = ArraySize(changes);
//
return result;
}
/**
* Count Saved Peaks Changes ...
*
* @return ( int )
*/
int CountPeaksChanges()
{
return ArraySize(mPeaksChanges);
}
/**
* Fill Saved Peaks Changes ...
*
* @param changes: XValueChange instance Array Reference ...
*
* @return ( int )
*/
int FillPeaksChanges(
XValueChange &changes[] //
)
{
//
Clean(changes);
//
Copy(
mPeaksChanges,
changes //
);
//
int result = ArraySize(changes);
//
return result;
}
/**
* Count Saved Vales Changes ...
*
* @return ( int )
*/
int CountValesChanges()
{
return ArraySize(mValesChanges);
}
/**
* Fill Saved Vales Changes ...
*
* @param changes: XValueChange instance Array Reference ...
*
* @return ( int )
*/
int FillValesChanges(
XValueChange &changes[] //
)
{
//
Clean(changes);
//
Copy(
mValesChanges,
changes //
);
//
int result = ArraySize(changes);
//
return result;
}
/**
* Count Saved VWap Order Changes ...
*
* @return ( int )
*/
int CountVWapOrderChanges()
{
return ArraySize(mVWapOrderChanges);
}
/**
* Fill Saved VWap Order Changes ...
*
* @param changes: XValueChange instance Array Reference ...
*
* @return ( int )
*/
int FillVWapOrderChanges(
XValueChange &changes[] //
)
{
//
Clean(changes);
//
Copy(
mVWapOrderChanges,
changes //
);
//
int result = ArraySize(changes);
//
return result;
}
/**
* Count Saved VWap State Changes ...
*
* @return ( int )
*/
int CountVWapStateChanges()
{
return ArraySize(mVWapStateChanges);
}
/**
* Fill Saved VWap State Changes ...
*
* @param changes: XValueChange instance Array Reference ...
*
* @return ( int )
*/
int FillVWapStateChanges(
XValueChange &changes[] //
)
{
//
Clean(changes);
//
Copy(
mVWapStateChanges,
changes //
);
//
int result = ArraySize(changes);
//
return result;
}
/**
* Count Founded Consolidation Zones ...
*
* @return ( int )
*/
int CountConsolidationZones()
{
return ArraySize(mConsolidationZones);
}
/**
* Fill Broken Consolidations ...
*
* @param consolidations: XConsolidationZone instance Array Reference ...
*
* @return ( int )
*/
int FillConsolidations(
XConsolidationZone &consolidations[] //
)
{
//
Clean(consolidations);
//
Copy(
mConsolidationZones,
consolidations //
);
//
int result = ArraySize(consolidations);
//
return result;
}
// //
// Virtuals ... // Virtuals ...
@@ -664,6 +916,7 @@ class XC121SMCCycleHelper : public XCBase
virtual void Default() virtual void Default()
{ {
// //
ConsolidationLoopback(15);
MaxAllowedSavedChanges(50); MaxAllowedSavedChanges(50);
} }
@@ -709,48 +962,358 @@ class XC121SMCCycleHelper : public XCBase
isSarSwitchedToBearish; isSarSwitchedToBearish;
// //
if (period == PERIOD_M1) if (isSarChanged)
{ {
// //
if (isSarChanged) XValueChange sarChanged;
//
datetime time = changeBar.time;
double after = conditions.x121Conditions.sarBuffer[1];
double before = conditions.x121Conditions.sarBuffer[2];
ENUM_X_DIRECTION dir =
isSarSwitchedToBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Initialize Model ...
isInited = sarChanged.Init(
before,
after,
dir,
time //
);
if (isInited)
{ {
// isInited = AddSarChange(sarChanged);
XValueChange sarChanged;
//
datetime time = changeBar.time;
double after = conditions.x121Conditions.sarBuffer[1];
double before = conditions.x121Conditions.sarBuffer[2];
ENUM_X_DIRECTION dir =
isSarSwitchedToBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Initialize Model ...
isInited = sarChanged.Init(
before,
after,
dir,
time //
);
if (isInited)
{
//
isInited = AddSarChange(sarChanged);
if (isInited)
{
Print("Sar Switched ...");
}
}
} }
} }
// //
// Detect Peak Changes ... // Detect Peaks Changes ...
// //
// Detect Vale Changes ... bool isNewPeak = conditions.x121Conditions.isNewPeak;
bool isNewPeakOverLast = conditions.x121Conditions.isNewPeakOverLast;
bool isNewPeakUnderLast = conditions.x121Conditions.isNewPeakUnderLast;
//
if (isNewPeak)
{
//
XValueChange peaksChanged;
//
datetime time = changeBar.time;
double after = conditions.x121Conditions.peaksBuffer[1];
double before = conditions.x121Conditions.peaksBuffer[2];
ENUM_X_DIRECTION dir =
isNewPeakOverLast
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Initialize Model ...
isInited = peaksChanged.Init(
before,
after,
dir,
time //
);
if (isInited)
{
isInited = AddPeaksChange(peaksChanged);
}
}
//
// Detect Vales Changes ...
//
bool isNewVale = conditions.x121Conditions.isNewVale;
bool isNewValeOverLast = conditions.x121Conditions.isNewValeOverLast;
bool isNewValeUnderLast = conditions.x121Conditions.isNewValeUnderLast;
//
if (isNewVale)
{
//
XValueChange valesChanged;
//
datetime time = changeBar.time;
double after = conditions.x121Conditions.valesBuffer[1];
double before = conditions.x121Conditions.valesBuffer[2];
ENUM_X_DIRECTION dir =
isNewValeUnderLast
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Initialize Model ...
isInited = valesChanged.Init(
before,
after,
dir,
time //
);
if (isInited)
{
isInited = AddValesChange(valesChanged);
}
}
//
// VWap Direction Change ...
//
// Ordered Change ...
bool isVWapSwitchedToBullishOrdered =
conditions.x121Conditions.isVWapSwitchedToBullishOrdered;
bool isVWapSwitchedToBearishOrdered =
conditions.x121Conditions.isVWapSwitchedToBearishOrdered;
bool isVWAPOrderedChanged = isVWapSwitchedToBullishOrdered ||
isVWapSwitchedToBearishOrdered;
//
if (isVWAPOrderedChanged)
{
//
XValueChange vwapOrderChanged;
//
datetime time = changeBar.time;
ENUM_X_DIRECTION dir =
isVWapSwitchedToBullishOrdered
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
double after = 0;
double before = 0;
if (isVWapSwitchedToBullishOrdered)
{
//
// After Max ...
after = MathMax(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
after = MathMax(
after,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
//
// Before Min ...
before = MathMin(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
before = MathMin(
before,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
}
else
{
//
// After Min ...
after = MathMin(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
after = MathMin(
after,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
//
// Before Max ...
before = MathMax(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
before = MathMax(
before,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
}
//
// Initialize Model ...
isInited = vwapOrderChanged.Init(
before,
after,
dir,
time //
);
if (isInited)
{
isInited = AddVWapOrderChange(vwapOrderChanged);
}
}
//
// States Changed ...
bool isVWapSwitchedToBullishState =
conditions.x121Conditions.isVWapSwitchedToBullishState;
bool isVWapSwitchedToBearishState =
conditions.x121Conditions.isVWapSwitchedToBearishState;
bool isVWapStatesChanged = isVWapSwitchedToBullishState ||
isVWapSwitchedToBearishState;
//
if (isVWapStatesChanged)
{
//
XValueChange vwapStateChanged;
//
datetime time = changeBar.time;
ENUM_X_DIRECTION dir =
isVWapSwitchedToBullishState
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
double after = 0;
double before = 0;
if (isVWapSwitchedToBullishState)
{
//
// After Max ...
after = MathMax(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
after = MathMax(
after,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
//
// Before Min ...
before = MathMin(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
before = MathMin(
before,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
}
else
{
//
// After Min ...
after = MathMin(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
after = MathMin(
after,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
//
// Before Max ...
before = MathMax(
conditions.x121Conditions.vwapFastBuffer[1],
conditions.x121Conditions.vwapMidBuffer[1] //
);
before = MathMax(
before,
conditions.x121Conditions.vwapSlowBuffer[1] //
);
}
//
// Initialize Model ...
isInited = vwapStateChanged.Init(
before,
after,
dir,
time //
);
if (isInited)
{
isInited = AddVWapStateChange(vwapStateChanged);
}
}
//
// Detect Consolidations ...
//
int consolidationLoopback = ConsolidationLoopback();
if (IsValidSize(consolidationLoopback))
{
//
double upper = 0;
double lower = 0;
bool hasConsolidation =
mBarAnalyser.IsConsolidate(
changeBar,
upper,
lower,
consolidationLoopback //
);
//
if (hasConsolidation &&
!mActioveConsolidationZone.IsValid())
{
//
// Initialize Consolidation Zone ...
bool isInited = mActioveConsolidationZone.Init(
changeBar.symbol,
changeBar.period,
upper,
lower,
consolidationLoopback //
);
}
//
if (!hasConsolidation &&
mActioveConsolidationZone.IsValid())
{
//
// Check Consolidation Breaks ...
// Update Zone ...
// Add it ...
bool isBOSTop = changeBar.high > mActioveConsolidationZone.upper;
bool isBOSBottom = changeBar.low < mActioveConsolidationZone.lower;
//
// Calculate Break Direction ...
ENUM_X_DIRECTION bosDir = isBOSTop
? X_DIRECTION_BULLISH
: isBOSBottom
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
//
// Update Actiove Zone ...
mActioveConsolidationZone.breakerBar = changeBar;
mActioveConsolidationZone.breakDirection = bosDir;
//
// Add Active to List ...
AddRef(
mActioveConsolidationZone,
mConsolidationZones //
);
//
// Clean Active Zone ...
mActioveConsolidationZone.Clean();
//
Print("Breake ...");
}
}
} }
// //
@@ -761,8 +1324,17 @@ class XC121SMCCycleHelper : public XCBase
// //
// Change Holders ... // Change Holders ...
int mMaxAllowedSavedChanges; // Max llowed Changes to Save ... int mMaxAllowedSavedChanges; // Max llowed Changes to Save ...
XValueChange mSarChanges[]; // Holds Parabolic Sar Direction Changes ... XValueChange mSarChanges[]; // Holds Parabolic Sar Direction Changes ...
XValueChange mPeaksChanges[]; // Holds Peaks Changes ...
XValueChange mValesChanges[]; // Holds Vales Changes ...
XValueChange mVWapOrderChanges[]; // Holds Vales Changes ...
XValueChange mVWapStateChanges[]; // Holds Vales Changes ...
//
int mConsolidationLoopback; // Consolidation Loopback Length ...
XConsolidationZone mConsolidationZones[]; // Holds Consolidation Zones ...
XConsolidationZone mActioveConsolidationZone; // Holds Actiove Consolidation Zone ...
// //
// Actions ... // Actions ...
@@ -870,16 +1442,6 @@ class XC121SMCCycleHelper : public XCBase
// //
// Change Values Actions ... // Change Values Actions ...
/**
* Count Saved Parabolic Sar Changes ...
*
* @return ( int )
*/
int CountSarChanges()
{
return ArraySize(mSarChanges);
}
/** /**
* Add Specified Parabolic Sar Changed Item ... * Add Specified Parabolic Sar Changed Item ...
* *
@@ -928,5 +1490,197 @@ class XC121SMCCycleHelper : public XCBase
return result; return result;
} }
/**
* Add Specified Peaks Changed Item ...
*
* @param value: XValueChange instance Reference ...
*
* @return ( bool )
*/
bool AddPeaksChange(XValueChange &value)
{
//
bool result = false;
//
result = value.IsValid();
if (!result)
{
return result;
}
//
int beforeCount = CountSarChanges();
//
AddIfNotExists(
value,
mPeaksChanges //
);
//
int afterCount = CountSarChanges();
//
result = afterCount == beforeCount + 1;
if (result)
{
//
// Cleaning Up Unused Items ...
int maxAllowed = MaxAllowedSavedChanges();
CleanupArray(
mPeaksChanges,
maxAllowed //
);
}
//
return result;
}
/**
* Add Specified Vales Changed Item ...
*
* @param value: XValueChange instance Reference ...
*
* @return ( bool )
*/
bool AddValesChange(XValueChange &value)
{
//
bool result = false;
//
result = value.IsValid();
if (!result)
{
return result;
}
//
int beforeCount = CountSarChanges();
//
AddIfNotExists(
value,
mValesChanges //
);
//
int afterCount = CountSarChanges();
//
result = afterCount == beforeCount + 1;
if (result)
{
//
// Cleaning Up Unused Items ...
int maxAllowed = MaxAllowedSavedChanges();
CleanupArray(
mValesChanges,
maxAllowed //
);
}
//
return result;
}
/**
* Add Specified VWap Order Changed Item ...
*
* @param value: XValueChange instance Reference ...
*
* @return ( bool )
*/
bool AddVWapOrderChange(XValueChange &value)
{
//
bool result = false;
//
result = value.IsValid();
if (!result)
{
return result;
}
//
int beforeCount = CountSarChanges();
//
AddIfNotExists(
value,
mVWapOrderChanges //
);
//
int afterCount = CountSarChanges();
//
result = afterCount == beforeCount + 1;
if (result)
{
//
// Cleaning Up Unused Items ...
int maxAllowed = MaxAllowedSavedChanges();
CleanupArray(
mVWapOrderChanges,
maxAllowed //
);
}
//
return result;
}
/**
* Add Specified VWap State Changed Item ...
*
* @param value: XValueChange instance Reference ...
*
* @return ( bool )
*/
bool AddVWapStateChange(XValueChange &value)
{
//
bool result = false;
//
result = value.IsValid();
if (!result)
{
return result;
}
//
int beforeCount = CountSarChanges();
//
AddIfNotExists(
value,
mVWapStateChanges //
);
//
int afterCount = CountSarChanges();
//
result = afterCount == beforeCount + 1;
if (result)
{
//
// Cleaning Up Unused Items ...
int maxAllowed = MaxAllowedSavedChanges();
CleanupArray(
mVWapStateChanges,
maxAllowed //
);
}
//
return result;
}
// //
}; };
+3
View File
@@ -637,6 +637,9 @@ struct X121SMCStrategyConditions
string provider; string provider;
ENUM_X_DIRECTION marketStructureDir; ENUM_X_DIRECTION marketStructureDir;
//
// //
void X121SMCStrategyConditions() void X121SMCStrategyConditions()
{ {
@@ -115,10 +115,12 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
// Start Calculations ... // Start Calculations ...
// //
// Retrieve Common Data ...
string symbol = GetSymbol(); string symbol = GetSymbol();
ENUM_TIMEFRAMES period = GetPeriod(); ENUM_TIMEFRAMES period = GetPeriod();
// //
// Required Value For SL/TP Calculations ...
double points = GetPoints(symbol); double points = GetPoints(symbol);
double pip = GetPipPrice(symbol); double pip = GetPipPrice(symbol);
double pip2 = 2 * pip; double pip2 = 2 * pip;
@@ -466,54 +468,6 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
double bid = GetBid(symbol); double bid = GetBid(symbol);
datetime cTime = TimeCurrent(); datetime cTime = TimeCurrent();
// //
// // Detect Valid Supply and Demand Zones ...
// XCSupplyZone *supplyZone;
// XCDemandZone *demandZone;
// result = mTriggerCycleHelper
// .DetectValisSupplyZone(
// cBar,
// supplyZone,
// demandZone //
// );
// if (!result)
// {
// //
// conditions.Clean();
// return result;
// }
// //
// supplyZone.To(cTime);
// XCSupplyZoneObject *iSupplyZoneObj;
// result = mPOIDrawer.CreateSupplyZone(
// supplyZone,
// iSupplyZoneObj //
// );
// if (!result)
// {
// //
// conditions.Clean();
// return result;
// }
// //
// demandZone.To(cTime);
// XCDemandZoneObject *iDemandZoneObj;
// result = mPOIDrawer.CreateDemandZone(
// demandZone,
// iDemandZoneObj //
// );
// if (!result)
// {
// //
// conditions.Clean();
// return result;
// }
// //
// Print("Supply and Demand Zone Created ...");
// //
if (!result) if (!result)
{ {