refactor classes constructor and deconstructors ...

This commit is contained in:
2026-01-06 22:47:58 +03:30
parent e6165f44f2
commit 0788de9660
12 changed files with 181 additions and 55 deletions
+3 -3
View File
@@ -57,7 +57,7 @@ class XCAccount : public XCBase
public:
//
// Constructor ...
void XCAccount()
XCAccount()
{
//
mAccountInfo = new CAccountInfo();
@@ -65,7 +65,7 @@ class XCAccount : public XCBase
//
// Deconstructor ...
void ~XCAccount()
~XCAccount()
{
}
@@ -376,7 +376,7 @@ class XCAccount : public XCBase
/**
* Retrieve Specified Message for Report Balance ...
*
*
* @return ( string )
*/
string GetBalanceReportMessage()
+2 -2
View File
@@ -74,13 +74,13 @@ class XCBarAnalyser : public XCBase
//
// Constructor(s) ...
void XCBarAnalyser()
XCBarAnalyser()
{
}
//
// Deconstructor ...
void ~XCBarAnalyser()
~XCBarAnalyser()
{
}
+4 -3
View File
@@ -761,13 +761,13 @@ class XCSignalObject : public XCBaseObject
//
// Constructor ...
void XCSignalObject()
XCSignalObject()
{
}
//
// Deconstructor ...
void ~XCSignalObject()
~XCSignalObject()
{
}
@@ -2150,7 +2150,8 @@ class XCPositionObject : public XCBaseObject
//
// Change Risk Style if Risk Freed Position ...
if (isRiskFreed) {
if (isRiskFreed)
{
//
riskStyle.fill = true;
riskStyle.clr = rewardStyle.clr;
+2 -2
View File
@@ -38,7 +38,7 @@ class XCBaseHelper : public XCBase
public:
//
// Constructor ...
void XCBaseHelper(
XCBaseHelper(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period // Trading Time Frame
)
@@ -50,7 +50,7 @@ class XCBaseHelper : public XCBase
//
// Deconstructor ...
void ~XCBaseHelper()
~XCBaseHelper()
{
//
IndicatorRelease(mHandler);
+3 -3
View File
@@ -46,11 +46,11 @@ class XCHttp : public XCBase
public:
//
// Constructor ...
void XCHttp()
XCHttp()
{
XCHttp("", 10000);
}
void XCHttp(
XCHttp(
string path, // Base Folder to Store Data
int timeout // base timeout for Requests
)
@@ -62,7 +62,7 @@ class XCHttp : public XCBase
//
// Deconstructor ...
void ~XCHttp()
~XCHttp()
{
}
+2 -2
View File
@@ -51,7 +51,7 @@ class XCPOIDrawer : public XCBase
//
// Constructor ...
void XCPOIDrawer()
XCPOIDrawer()
{
//
Default();
@@ -59,7 +59,7 @@ class XCPOIDrawer : public XCBase
//
// Deconstructor ...
void ~XCPOIDrawer()
~XCPOIDrawer()
{
//
boxBullishStyle.Clean();
+2 -2
View File
@@ -49,7 +49,7 @@ class XCRMPanel : public XCAppDialog
//
// Constructor(s) ...
void XCRMPanel()
XCRMPanel()
{
//
Default();
@@ -57,7 +57,7 @@ class XCRMPanel : public XCAppDialog
//
// Deconstructor ...
void ~XCRMPanel()
~XCRMPanel()
{
//
HandleRemoveObjects();
+1 -1
View File
@@ -528,7 +528,7 @@ class XCTrade : public XCBase
//
// Constructors ...
void XCTrade(
XCTrade(
int slippage, // Specify Slippage
ulong magicNumber, // Specify Magic Number
double maxAllowedSpread = 0, // Max Allowed Spred for Opening Trades
@@ -312,12 +312,12 @@ struct X121X3MAConditions
// Buffers ...
//
Clean(fastBuffer);
Clean(mediumBuffer);
Clean(slowBuffer);
Clean(fastStateBuffer);
Clean(mediumStateBuffer);
Clean(slowStateBuffer);
XClean(fastBuffer);
XClean(mediumBuffer);
XClean(slowBuffer);
XClean(fastStateBuffer);
XClean(mediumStateBuffer);
XClean(slowStateBuffer);
//
ArraySetAsSeries(fastBuffer, true);
@@ -274,6 +274,108 @@ class XCX121XKIHelperParser : XCBase
//
return result;
}
int CountKIFastTouches(
int barIndex = 0,
int loopback = 5,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
)
{
//
int result = 0;
//
// Normalize ...
loopback = NormalizeInt(loopback, 1);
barIndex = NormalizeBarIndex(barIndex);
//
if (!IsValid())
{
return result;
}
//
XOHCL iBar;
bool has = false;
double iValue = 0;
double affectedValue = 0;
double iConfirnValue = 0;
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
? X_PRICE_HIGH
: X_PRICE_UP;
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
? X_PRICE_LOW
: X_PRICE_DOWN;
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
? X_PRICE_HIGH
: X_PRICE_UP;
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
? X_PRICE_LOW
: X_PRICE_DOWN;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
has = iBar.Init(symbol, period, i);
if (!has)
{
continue;
}
//
affectedValue = helper.GetKIFast(i);
//
// Bullish Touches ...
if (isBullish)
{
//
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
has =
NotEmptyZero(iValue) &&
NotEmptyZero(affectedValue) &&
NotEmptyZero(iConfirnValue) &&
iValue <= affectedValue &&
iConfirnValue >= affectedValue;
if (has)
{
result++;
}
}
//
// Bearish Touches ...
if (isBearish)
{
//
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
has =
NotEmptyZero(iValue) &&
NotEmptyZero(affectedValue) &&
NotEmptyZero(iConfirnValue) &&
iValue >= affectedValue &&
iConfirnValue <= affectedValue;
if (has)
{
result++;
}
}
//
iBar.Clean();
}
//
iBar.Clean();
//
return result;
}
// #endregion
// #region KI Slow ...
@@ -989,6 +989,8 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
}
//
XBoxZone swingLow;
XBoxZone swingHigh;
ENUM_X_DIRECTION patternsDir[];
ENUM_X_BAR_PATTERN patterns[];
poiDetector.FillStrategy1Patterns(
@@ -997,34 +999,7 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
);
//
isBullish = poiDetector.HasRecentPatternRejected(
zone,
patterns,
patternsDir,
barIndex,
3, // Loopback ..
iBar.period,
X_DIRECTION_BULLISH //
);
if (!isBullish)
{
//
isBearish = poiDetector.HasRecentPatternRejected(
zone,
patterns,
patternsDir,
barIndex,
3, // Loopback ..
iBar.period,
X_DIRECTION_BEARISH //
);
}
// #region Swings/OrderFlow ...
//
// Swings ...
XBoxZone swingLow;
XBoxZone swingHigh;
// Reading Swings ...
poiDetector.DetectRecentSwings(
swingHigh,
swingLow,
@@ -1032,16 +1007,64 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
);
//
// Order Flow ...
// Reading Order Flow ...
//
// Bullish Order Flow ...
XBoxZone bullishOrderFlow[];
int bullishOrderFlowRejectdIDX = -1;
poiDetector.HasOrderFlow(bullishOrderFlow, barIndex, 4, X_DIRECTION_BULLISH, 15);
//
// Bearish Order Flow ...
XBoxZone bearishOrderFlow[];
int bearishOrderFlowRejectdIDX = -1;
poiDetector.HasOrderFlow(bearishOrderFlow, barIndex, 4, X_DIRECTION_BEARISH, 15);
// #endregion
//
// Base Conditions ...
//
isBullish =
IsTFBullishPattern(barIndex, PERIOD_M1) &&
IsTFBullishPattern(barIndex, PERIOD_M5) &&
IsTFBullishPattern(barIndex, iBar.period) &&
HasRejected(
bullishOrderFlowRejectdIDX,
iBar,
bullishOrderFlow //
) &&
poiDetector.HasRecentPatternRejected(
zone,
patterns,
patternsDir,
barIndex,
3, // Loopback ..
iBar.period,
X_DIRECTION_BULLISH //
);
if (!isBullish)
{
//
isBearish =
IsTFBearishPattern(barIndex, PERIOD_M1) &&
IsTFBearishPattern(barIndex, PERIOD_M5) &&
IsTFBearishPattern(barIndex, iBar.period) &&
HasRejected(
bearishOrderFlowRejectdIDX,
iBar,
bearishOrderFlow //
) &&
poiDetector.HasRecentPatternRejected(
zone,
patterns,
patternsDir,
barIndex,
3, // Loopback ..
iBar.period,
X_DIRECTION_BEARISH //
);
}
//
// Validate Conditions ...
@@ -1267,7 +1267,7 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
//
return result;
}
}
// #endregion
// #region Zone Detectors ...