implement all props ...

This commit is contained in:
2024-12-25 00:11:25 +03:30
parent b5021a80d7
commit 0a4859982b
4 changed files with 981 additions and 360 deletions
@@ -1714,7 +1714,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
//
// Signalling Properties ...
// Signalling Props ...
/**
* Get Allow Long Signals State ...
@@ -1758,7 +1758,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
/**
* Get Max Allowed Long Signals ...
* = 0 => Unlimited ...
* 0 => Unlimited ...
*
* @return ( int )
*/
@@ -1769,9 +1769,9 @@ class XC121SMCTradeHandler : public XCBaseAlert
/**
* Set Max Allowed Long Signals ...
* = 0 => Unlimited ...
*
* @param value: Integer ...
* 0 => Unlimited ...
*/
void MaxAllowedLongs(int value)
{
@@ -1787,7 +1787,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
/**
* Get Max Allowed Short Signals ...
* = 0 => Unlimited ...
* 0 => Unlimited ...
*
* @return ( int )
*/
@@ -1798,9 +1798,9 @@ class XC121SMCTradeHandler : public XCBaseAlert
/**
* Set Max Allowed Short Signals ...
* = 0 => Unlimited ...
*
* @param value: Integer ...
* 0 => Unlimited ...
*/
void MaxAllowedShorts(int value)
{
@@ -1815,23 +1815,110 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
/**
* Get Use Max Allowed Signals Per Symbol or at All State ...
* Get Use Max Allowed Signal Types Per Symbol State ...
*
* @return ( bool )
*/
bool UseMaxAllowedTradesPerSymbol()
bool UseMaxAllowedSignalsPerSymbol()
{
return mUseMaxAllowedTradesPerSymbol;
return mUseMaxAllowedSignalsPerSymbol;
}
/**
* Set Use Max Allowed Signals Per Symbol or at All State ...
* Set Use Max Allowed Signal Types Per Symbol State ...
*
* @param value: Boolean ...
*/
void UseMaxAllowedTradesPerSymbol(bool value)
void UseMaxAllowedSignalsPerSymbol(bool value)
{
mUseMaxAllowedTradesPerSymbol = value;
mUseMaxAllowedSignalsPerSymbol = false;
}
/**
* Get Last Position Profit In Points for Accept new Signal ...
* 0 => Accept All ...
*
* @return ( double )
*/
double LastPositionProfitForAcceptNextInPoint()
{
return mLastPositionProfitForAcceptNextInPoint;
}
/**
* Set Last Position Profit In Points for Accept new Signal ...
*
* @param value: Double ...
* 0 => Accept All ...
*/
void LastPositionProfitForAcceptNextInPoint(double value)
{
//
if (value < 0)
{
value = 0;
}
//
mLastPositionProfitForAcceptNextInPoint = value;
}
/**
* Get Delay between two Signals in Bars ...
* 0 => Accept All ...
*
* @return ( int )
*/
int DelaysBetweenTwoSignalsInBar()
{
return mDelaysBetweenTwoSignalsInBar;
}
/**
* Set Delay between two Signals in Bars ...
*
* @param value: Integer ...
* 0 => Accept All ...
*/
void DelaysBetweenTwoSignalsInBar(int value)
{
//
if (value < 0)
{
value = 0;
}
//
mDelaysBetweenTwoSignalsInBar = value;
}
/**
* Get Max Allowed Spread for Signalling ...
* 0 => Accept All ...
*
* @return ( double )
*/
double MaxAllowedSpread()
{
return mMaxAllowedSpread;
}
/**
* Set Max Allowed Spread for Signalling ...
*
* @param value: Double ...
* 0 => Accept All ...
*/
void MaxAllowedSpread(double value)
{
//
if (value < 0)
{
value = 0;
}
//
mMaxAllowedSpread = value;
}
/**
@@ -1868,53 +1955,31 @@ class XC121SMCTradeHandler : public XCBaseAlert
mAdditionalVolume = value;
}
/**
* Get How Many Bars Must Passed after a Signal for Accept Next ...
* 0 => Unlimited ...
*
* @return ( int )
*/
int DelayBarBetweenTwoSignal()
{
return mDelayBarBetweenTwoSignal;
}
//
// Risk Management Props ...
/**
* Set How Many Bars Must Passed after a Signal for Accept Next ...
*
* @param value: Integer ...
* 0 => Unlimited ...
*/
void DelayBarBetweenTwoSignal(int value)
{
//
if (value < 0)
{
value = 0;
}
//
mDelayBarBetweenTwoSignal = value;
}
/**
* Get Max Allowed Drawdown Percent for Open New Positions ...
* 0 => Unlimited ...
* Get Max Allowed Drawdown Percent for Open Trades ...
* 0 => Ignore ...
* min => 0 ...
* max => 100 ...
*
* @return ( double )
*/
double MaxDrawdownPercentForOpenTrades()
double MaxAllowedDrawdownToOpenTrades()
{
return mMaxDrawdownPercentForOpenTrades;
return mMaxAllowedDrawdownToOpenTrades;
}
/**
* Set Max Allowed Drawdown Percent for Open New Positions ...
* Set Max Allowed Drawdown Percent for Open Trades ...
*
* @param value: Double ...
* 0 => Unlimited ...
* 0 => Ignore ...
* min => 0 ...
* max => 100 ...
*/
void MaxDrawdownPercentForOpenTrades(double value)
void MaxAllowedDrawdownToOpenTrades(double value)
{
//
if (value < 0)
@@ -1923,59 +1988,33 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
//
mMaxDrawdownPercentForOpenTrades = value;
}
/**
* Get Accept Next Same Type Signal only When last Issued Signal is InProfit by Points ...
*
* @return ( double )
* 0 => Accept All ...
*/
double AcceptNextSameTypeSignalWhenLastInProfit()
{
return mAcceptNextSameTypeSignalWhenLastInProfit;
}
/**
* Set Accept Next Same Type Signal only When last Issued Signal is InProfit by Points ...
*
* @param value: Double ...
* 0 => Accept All ...
*/
void AcceptNextSameTypeSignalWhenLastInProfit(double value)
{
//
if (value < 0)
if (value > 50)
{
value = 0;
value = 50;
}
//
mAcceptNextSameTypeSignalWhenLastInProfit = value;
mMaxAllowedDrawdownToOpenTrades = value;
}
//
// Protecting Properties ...
/**
* Get Max Allower SL Per Symbol before Pausing ...
* Get Max Allowed SL for Pause Signalling Per Symbol ...
* 0 => Unlimited ...
*
* @return ( int )
*/
int MaxAllowedSLToPause()
int MaxAllowedSLToPauseSignallingPerSymbol()
{
return mMaxAllowedSLToPause;
return mMaxAllowedSLToPauseSignallingPerSymbol;
}
/**
* Set Max Allower SL Per Symbol before Pausing ...
* Set Max Allowed SL for Pause Signalling Per Symbol ...
*
* @param value: Integer ...
* 0 => Unlimited ...
*/
void MaxAllowedSLToPause(int value)
void MaxAllowedSLToPauseSignallingPerSymbol(int value)
{
//
if (value < 0)
@@ -1984,27 +2023,27 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
//
mMaxAllowedSLToPause = value;
mMaxAllowedSLToPauseSignallingPerSymbol = value;
}
/**
* Get Specified Delay For Pause Symbol Trade if Reached Max Allowed SL in Seconds ...
* 0 => Ignored ...
* Get Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds ...
* 0 => Ignore ...
*
* @return ( int )
*/
int MaxAllowedSLReachedPauseDelay()
int PauseSignallingAfterReachesMaxAllowedSLInSecconds()
{
return mMaxAllowedSLReachedPauseDelay;
return mPauseSignallingAfterReachesMaxAllowedSLInSecconds;
}
/**
* Set Specified Delay For Pause Symbol Trade if Reached Max Allowed SL in Seconds ...
* Set Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds ...
*
* @param value: Integer ...
* 0 => Ignored ...
* 0 => Ignore ...
*/
void MaxAllowedSLReachedPauseDelay(int value)
void PauseSignallingAfterReachesMaxAllowedSLInSecconds(int value)
{
//
if (value < 0)
@@ -2013,54 +2052,79 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
//
mMaxAllowedSLReachedPauseDelay = value;
mPauseSignallingAfterReachesMaxAllowedSLInSecconds = value;
}
//
// Hedge Props ...
// Protection Props ...
/**
* Get Allow Hedge Position State ...
* Get Allow Hedge Positions State ...
*
* @return ( bool )
*/
bool AllowHedge()
bool AllowHedging()
{
return mAllowHedge;
return mAllowHedging;
}
/**
* Set Allow Hedge Position State ...
* Set Allow Hedge Positions State ...
*
* @param value: Boolean ...
*/
void AllowHedge(bool value)
void AllowHedging(bool value)
{
mAllowHedge = value;
mAllowHedging = value;
}
/**
* Get Minimum Volume Steps for Hedge Requirement Calculation ...
* 0 => Ignore Hedging ...
* min => 0.01 ...
* max => 0.1 ...
* Get Minimum Open Positions for Hedging ...
* 0 => Ignore ...
*
* @return ( int )
*/
int MinOpenTradesFroHedging()
{
return mMinOpenTradesFroHedging;
}
/**
* Set Minimum Open Positions for Hedging ...
*
* @param value: Integer ...
* 0 => Ignore ...
*/
void MinOpenTradesFroHedging(int value)
{
//
if (value < 0)
{
value = 0;
}
//
mMinOpenTradesFroHedging = value;
}
/**
* Get Minimum Volume Step for Hedging ...
* 0 => Ignore ...
*
* @return ( double )
*/
double HedgeMinVolumeStep()
double HedgingMinVolumeStep()
{
return mHedgeMinVolumeStep;
return mHedgingMinVolumeStep;
}
/**
* Set Minimum Volume Steps for Hedge Requirement Calculation ...
* Set Minimum Volume Step for Hedging ...
*
* @param value: Double ...
* 0 => Ignore Hedging ...
* min => 0.01 ...
* max => 0.1 ...
* 0 => Ignore ...
*/
void HedgeMinVolumeStep(double value)
void HedgingMinVolumeStep(double value)
{
//
if (value < 0)
@@ -2081,57 +2145,27 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
//
mHedgeMinVolumeStep = value;
}
/**
* Get Minimum Requirement Open Positions for Hedging ...
* 0 => Ignore Hedging ...
*
* @return ( int )
*/
int MinimumOpenPositionsForHedge()
{
return mMinimumOpenPositionsForHedge;
}
/**
* Set Minimum Requirement Open Positions for Hedging ...
*
* @param value: Integer ...
* 0 => Ignore Hedging ...
*/
void MinimumOpenPositionsForHedge(int value)
{
//
if (value < 0)
{
value = 0;
}
//
mMinimumOpenPositionsForHedge = value;
mHedgingMinVolumeStep = value;
}
/**
* Get Minimum Required Profit Per Volume Step for Hedging ...
* 0 => Ignore Hedging ...
* 0 => Ignore ...
*
* @return ( double )
*/
double HedgeMinProfitPerVolumeStep()
double HedgeingMinRequiredProfitPerVolumeStep()
{
return mHedgeMinProfitPerVolumeStep;
return mHedgeingMinRequiredProfitPerVolumeStep;
}
/**
* Set Minimum Required Profit Per Volume Step for Hedging ...
*
* @param value: Double ...
* 0 => Ignore Hedging ...
* min => 0.01 ...
* 0 => Ignore ...
*/
void HedgeMinProfitPerVolumeStep(double value)
void HedgeingMinRequiredProfitPerVolumeStep(double value)
{
//
if (value < 0)
@@ -2140,13 +2174,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
//
if (value > 0 && value < 0.01)
{
value = 0.01;
}
//
mHedgeMinProfitPerVolumeStep = value;
mHedgeingMinRequiredProfitPerVolumeStep = value;
}
//
@@ -2634,8 +2662,8 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
//
int maxAllowedSLToPause = MaxAllowedSLToPause();
int pauseDelay = MaxAllowedSLReachedPauseDelay();
int maxAllowedSLToPause = MaxAllowedSLToPauseSignallingPerSymbol();
int pauseDelay = PauseSignallingAfterReachesMaxAllowedSLInSecconds();
if (maxAllowedSLToPause <= 0 || pauseDelay <= 0)
{
return;
@@ -2796,7 +2824,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
ENUM_X_POSITION_TYPES pType = ToPositionType(signal.type);
double requiredProfitForAcceptNext = AcceptNextSameTypeSignalWhenLastInProfit();
double requiredProfitForAcceptNext = LastPositionProfitForAcceptNextInPoint();
//
// Implement Same Signal Conditions ...
@@ -2839,7 +2867,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
// Retrieve Longs and Shorts ...
XPosition longs[];
XPosition shorts[];
bool useMaxAllowedPositionsPerSymbol = UseMaxAllowedTradesPerSymbol();
bool useMaxAllowedPositionsPerSymbol = UseMaxAllowedSignalsPerSymbol();
//
// Retrieve Positions ...
@@ -2895,7 +2923,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
// Check Delays Bar if Provided ...
int delaysBarBetweenTwoSignal = DelayBarBetweenTwoSignal();
int delaysBarBetweenTwoSignal = DelaysBetweenTwoSignalsInBar();
if (delaysBarBetweenTwoSignal > 0)
{
//
@@ -2970,7 +2998,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
// Check Max Drawdown Percent for Open Trades ...
double maxAllowedDrawdownPercent = MaxDrawdownPercentForOpenTrades();
double maxAllowedDrawdownPercent = MaxAllowedDrawdownToOpenTrades();
if (maxAllowedDrawdownPercent > 0)
{
//
@@ -3343,13 +3371,13 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
// Checking Hedge ...
bool allowHedge = AllowHedge();
bool allowHedge = AllowHedging();
if (allowHedge)
{
//
double minHedgeVolumeStep = HedgeMinVolumeStep();
int minRequiredPositionsForHedge = MinimumOpenPositionsForHedge();
double minRequiredProfitPerVolumeStepForHedge = HedgeMinProfitPerVolumeStep();
double minHedgeVolumeStep = HedgingMinVolumeStep();
int minRequiredPositionsForHedge = MinOpenTradesFroHedging();
double minRequiredProfitPerVolumeStepForHedge = HedgeingMinRequiredProfitPerVolumeStep();
//
double minRequiredAdditionalProfit =
@@ -3357,7 +3385,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
((volumeSummary / minHedgeVolumeStep) * minRequiredProfitPerVolumeStepForHedge);
//
bool canHedge = AllowHedge() &&
bool canHedge = AllowHedging() &&
profitSummary > 0 &&
minHedgeVolumeStep > 0 &&
minRequiredProfitPerVolumeStepForHedge > 0 &&
@@ -3419,26 +3447,29 @@ class XC121SMCTradeHandler : public XCBaseAlert
bool mSaveConditions; // Save SL Conditions
//
bool mAllowLong; // Allow Long/Buy Trade Type
bool mAllowShort; // Allow Short/Sell Trade Type
int mMaxAllowedLongs; // Max Allowe Long/Buy Trades
int mMaxAllowedShorts; // Max Allowe Short/Sell Trades
double mAdditionalVolume; // Volume Additional
int mDelayBarBetweenTwoSignal; // Delay Bars Between Two Signal
bool mUseMaxAllowedTradesPerSymbol; // Use Max Allowed Trades Per Symbol
double mMaxDrawdownPercentForOpenTrades; // Max Drawdown Percent for Open Trades
double mAcceptNextSameTypeSignalWhenLastInProfit; // Accept Next Same Type Signal When Last in Profit in Point
// Signalling Props ...
bool mAllowLong; // Allow Long Signals ...
bool mAllowShort; // Allow Short Signals ...
int mMaxAllowedLongs; // Max Allowed Long Signals ...
int mMaxAllowedShorts; // Max Allowed Short Signals ...
bool mUseMaxAllowedSignalsPerSymbol; // Use Max Allowed Signal Types Per Symbol ...
double mLastPositionProfitForAcceptNextInPoint; // Last Position Profit In Points for Accept new Signal ...
int mDelaysBetweenTwoSignalsInBar; // Delay between two Signals in Bars ...
double mMaxAllowedSpread; // Max Allowed Spread for Signalling ...
double mAdditionalVolume; // Volume Additional ...
//
int mMaxAllowedSLToPause; // Max Allowed SL Per Symbol
int mMaxAllowedSLReachedPauseDelay; // Pause Symbol Trading After Max Allowed SL Reached
// Risk Management Props ...
double mMaxAllowedDrawdownToOpenTrades; // Max Allowed Drawdown for Open Trades ...
int mMaxAllowedSLToPauseSignallingPerSymbol; // Max Allowed SL for Pause Signalling Per Symbol ...
int mPauseSignallingAfterReachesMaxAllowedSLInSecconds; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds ...
//
// Hedging Properties ...
bool mAllowHedge; // Allow Protector to Hedge Positions
double mHedgeMinVolumeStep; // Minimum Volume Step For Hedge
int mMinimumOpenPositionsForHedge; // Minimum Open Positions For Hedge
double mHedgeMinProfitPerVolumeStep; // Minimum Required Profit For Hedge Per Volume Step
// Protection Props ...
bool mAllowHedging; // Allow Hedge Positions ...
int mMinOpenTradesFroHedging; // Minimum Open Positions for Hedging ...
double mHedgingMinVolumeStep; // Minimum Volume Step for Hedging ...
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
//
XCBarAnalyser mBarAnalyser;