last try to debug Position Protecting ...
This commit is contained in:
@@ -2055,14 +2055,18 @@ class X121SCTradeHandler : public XSCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
double iSymbolPoint = GetPoints(iPosition.symbol);
|
double iSymbolPoint = GetPoints(iPosition.symbol);
|
||||||
double iDistance = MathAbs(iPosition.profit) / iSymbolPoint;
|
double iDistance = MathAbs(iPosition.profit) * iSymbolPoint;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isDistancePassed = iDistance >= requiredDistance;
|
bool isDistancePassed = iDistance >= requiredDistance;
|
||||||
bool isProtected = HandlePositionProtecting(iPosition);
|
if (isDistancePassed)
|
||||||
if (isProtected)
|
|
||||||
{
|
{
|
||||||
protectedPositions++;
|
//
|
||||||
|
bool isProtected = HandlePositionProtecting(iPosition);
|
||||||
|
if (isProtected)
|
||||||
|
{
|
||||||
|
protectedPositions++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,20 @@ input int eaMaxAllowedLongs = 2; // Max Allowed Long Position
|
|||||||
input int eaMaxAllowedShorts = 2; // Max Allowed Short Positions
|
input int eaMaxAllowedShorts = 2; // Max Allowed Short Positions
|
||||||
input double eaMaxDrawdownPercentForOpenTrades = 3; // Max Drawdown Percent for Open Trades
|
input double eaMaxDrawdownPercentForOpenTrades = 3; // Max Drawdown Percent for Open Trades
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protector ...
|
||||||
|
input group "Protector";
|
||||||
|
input int eaDelayBarBetweenTwoSameSignal = 5; // Delay Bars Between Two Same Type Signal
|
||||||
|
input double eaProtectorStartDistanceInPoint = 35; // Protector Start Distance in Point
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protector > Hedging Properties ...
|
||||||
|
input bool eaAllowHedge = false; // Allow Protector to Hedge Positions
|
||||||
|
input double eaHedgeMinVolumeStep = 0.01; // Minimum Volume Step For Hedge
|
||||||
|
input int eaMinimumOpenPositionsForHEHedge = 2; // Minimum Open Positions For HE Hedge
|
||||||
|
input double eaHedgeHEMinProfitPerVolumeStep = 0.2; // Minimum Required Profit For HE Hedge Per Volume Step
|
||||||
|
input double eaHedgeBEMinProfitPerVolumeStep = 0.05; // Minimum Required Profit For BE Hedge Per Volume Step
|
||||||
|
|
||||||
//
|
//
|
||||||
// Alert ...
|
// Alert ...
|
||||||
input group "Alert";
|
input group "Alert";
|
||||||
@@ -440,18 +454,17 @@ bool InitialEA()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Configure Position Protector ...
|
// Configure Position Protector ...
|
||||||
// TODO: Configure it using Inputs ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
eaTradeHandler.DelayBarBetweenTwoSameSignal(5);
|
eaTradeHandler.DelayBarBetweenTwoSameSignal(eaDelayBarBetweenTwoSameSignal);
|
||||||
eaTradeHandler.ProtectorStartDistanceInPoint(35);
|
eaTradeHandler.ProtectorStartDistanceInPoint(eaProtectorStartDistanceInPoint);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configure Hedging ...
|
// Configure Hedging ...
|
||||||
eaTradeHandler.AllowHedge(true);
|
eaTradeHandler.AllowHedge(eaAllowHedge);
|
||||||
eaTradeHandler.HedgeMinVolumeStep(0.01);
|
eaTradeHandler.HedgeMinVolumeStep(eaHedgeMinVolumeStep);
|
||||||
eaTradeHandler.MinimumOpenPositionsForHEHedge(2);
|
eaTradeHandler.MinimumOpenPositionsForHEHedge(eaMinimumOpenPositionsForHEHedge);
|
||||||
eaTradeHandler.HedgeHEMinProfitPerVolumeStep(0.2);
|
eaTradeHandler.HedgeHEMinProfitPerVolumeStep(eaHedgeHEMinProfitPerVolumeStep);
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: Implement ...
|
// TODO: Implement ...
|
||||||
|
|||||||
Reference in New Issue
Block a user