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 iDistance = MathAbs(iPosition.profit) / iSymbolPoint;
|
||||
double iDistance = MathAbs(iPosition.profit) * iSymbolPoint;
|
||||
|
||||
//
|
||||
bool isDistancePassed = iDistance >= requiredDistance;
|
||||
bool isProtected = HandlePositionProtecting(iPosition);
|
||||
if (isProtected)
|
||||
if (isDistancePassed)
|
||||
{
|
||||
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 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 ...
|
||||
input group "Alert";
|
||||
@@ -440,18 +454,17 @@ bool InitialEA()
|
||||
|
||||
//
|
||||
// Configure Position Protector ...
|
||||
// TODO: Configure it using Inputs ...
|
||||
|
||||
//
|
||||
eaTradeHandler.DelayBarBetweenTwoSameSignal(5);
|
||||
eaTradeHandler.ProtectorStartDistanceInPoint(35);
|
||||
eaTradeHandler.DelayBarBetweenTwoSameSignal(eaDelayBarBetweenTwoSameSignal);
|
||||
eaTradeHandler.ProtectorStartDistanceInPoint(eaProtectorStartDistanceInPoint);
|
||||
|
||||
//
|
||||
// Configure Hedging ...
|
||||
eaTradeHandler.AllowHedge(true);
|
||||
eaTradeHandler.HedgeMinVolumeStep(0.01);
|
||||
eaTradeHandler.MinimumOpenPositionsForHEHedge(2);
|
||||
eaTradeHandler.HedgeHEMinProfitPerVolumeStep(0.2);
|
||||
eaTradeHandler.AllowHedge(eaAllowHedge);
|
||||
eaTradeHandler.HedgeMinVolumeStep(eaHedgeMinVolumeStep);
|
||||
eaTradeHandler.MinimumOpenPositionsForHEHedge(eaMinimumOpenPositionsForHEHedge);
|
||||
eaTradeHandler.HedgeHEMinProfitPerVolumeStep(eaHedgeHEMinProfitPerVolumeStep);
|
||||
|
||||
//
|
||||
// TODO: Implement ...
|
||||
|
||||
Reference in New Issue
Block a user