add new features to trade handler and protector ...
This commit is contained in:
Binary file not shown.
@@ -93,7 +93,8 @@ input double eaMaxDrawdownPercentForOpenTrades = 3; // Max Drawdown Percent for
|
||||
// Protector ...
|
||||
input group "Protector";
|
||||
input bool eaUseForceMomentumsInProtection = false; // Use Force Momentums In Protection;
|
||||
input int eaDelayBarBetweenTwoSameSignal = 5; // Delay Bars Between Two Same Type Signal
|
||||
input int eaDelayBarBetweenTwoSignal = 5; // Delay Bars Between Two Signal
|
||||
input double mAcceptNextSameTypeSignalWhenLastInProfit = 50; // Accept Next Same Type Signal When Last in Profit in Point
|
||||
|
||||
//
|
||||
// Protector > Hedging Properties ...
|
||||
@@ -114,6 +115,7 @@ input group "Trail";
|
||||
input bool eaAllowTrail = true; // Allow Trail Stop for Positions
|
||||
input double eaTrailStartDistance = 35; // Specify Trail Start in Point
|
||||
input double eaTrailStep = 10; // Trail Step in Point
|
||||
input int eaRemoveTPAfterTrailedLevel = 4; // Remove Trailed Position TP after Level
|
||||
input bool eaOnlyTrailUnprotected = true; // Only Trail Unprotected Positionss
|
||||
|
||||
//
|
||||
@@ -586,7 +588,7 @@ bool InitEA()
|
||||
|
||||
//
|
||||
eaTradeHandler.UseForceMomentumsInProtection(eaUseForceMomentumsInProtection);
|
||||
eaTradeHandler.DelayBarBetweenTwoSameSignal(eaDelayBarBetweenTwoSameSignal);
|
||||
eaTradeHandler.DelayBarBetweenTwoSignal(eaDelayBarBetweenTwoSignal);
|
||||
|
||||
//
|
||||
// Configure Hedging ...
|
||||
@@ -602,9 +604,10 @@ bool InitEA()
|
||||
//
|
||||
// Trail ...
|
||||
eaTradeHandler.AllowTrail(eaAllowTrail);
|
||||
eaTradeHandler.TrailStartDistance(eaTrailStartDistance);
|
||||
eaTradeHandler.TrailStep(eaTrailStep);
|
||||
eaTradeHandler.TrailStartDistance(eaTrailStartDistance);
|
||||
eaTradeHandler.OnlyTrailUnprotected(eaOnlyTrailUnprotected);
|
||||
eaTradeHandler.RemoveTPAfterTrailedLevel(eaRemoveTPAfterTrailedLevel);
|
||||
|
||||
//
|
||||
// Partial Close (In Profit) ...
|
||||
@@ -816,15 +819,15 @@ bool InitEA()
|
||||
//
|
||||
// Register XICHWAP Strategy ...
|
||||
|
||||
//
|
||||
bool isEURUSD = _symbolParser.IsEURUSD(_Symbol);
|
||||
bool isGBPUSD = _symbolParser.IsGBPUSD(_Symbol);
|
||||
bool isUSDCHF = _symbolParser.IsUSDCHF(_Symbol);
|
||||
bool isUSDJPY = _symbolParser.IsUSDJPY(_Symbol);
|
||||
bool canRegisterICHWAP = isEURUSD ||
|
||||
isGBPUSD ||
|
||||
isUSDCHF ||
|
||||
isUSDJPY;
|
||||
//
|
||||
bool isEURUSD = _symbolParser.IsEURUSD(_Symbol);
|
||||
bool isGBPUSD = _symbolParser.IsGBPUSD(_Symbol);
|
||||
bool isUSDCHF = _symbolParser.IsUSDCHF(_Symbol);
|
||||
bool isUSDJPY = _symbolParser.IsUSDJPY(_Symbol);
|
||||
bool canRegisterICHWAP = isEURUSD ||
|
||||
isGBPUSD ||
|
||||
isUSDCHF ||
|
||||
isUSDJPY;
|
||||
if (canRegisterICHWAP)
|
||||
{
|
||||
//
|
||||
@@ -1353,7 +1356,7 @@ void OnSignalRecieved(
|
||||
//
|
||||
// Check Signal Delay ...
|
||||
datetime currentTime = TimeCurrent();
|
||||
int delay = eaDelayBarBetweenTwoSameSignal;
|
||||
int delay = eaDelayBarBetweenTwoSignal;
|
||||
bool isDelayPassed = delay <= 0
|
||||
? true
|
||||
: !IsValid(lastSignalOn)
|
||||
|
||||
@@ -527,26 +527,6 @@ struct XPosition
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Risk ...
|
||||
double GetRisk()
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
result = MathAbs(entry - sl);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double GetPointsValue()
|
||||
{
|
||||
@@ -591,6 +571,26 @@ struct XPosition
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Risk ...
|
||||
double GetRisk()
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
result = MathAbs(entry - sl);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Reward ...
|
||||
double GetReward()
|
||||
@@ -611,6 +611,18 @@ struct XPosition
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double GetRewardInPoint() {
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
result = GetReward() / GetPoints();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Risk Reward Ratio ...
|
||||
double GetRiskRewardRatio()
|
||||
|
||||
Reference in New Issue
Block a user