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 ...
|
// Protector ...
|
||||||
input group "Protector";
|
input group "Protector";
|
||||||
input bool eaUseForceMomentumsInProtection = false; // Use Force Momentums In Protection;
|
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 ...
|
// Protector > Hedging Properties ...
|
||||||
@@ -114,6 +115,7 @@ input group "Trail";
|
|||||||
input bool eaAllowTrail = true; // Allow Trail Stop for Positions
|
input bool eaAllowTrail = true; // Allow Trail Stop for Positions
|
||||||
input double eaTrailStartDistance = 35; // Specify Trail Start in Point
|
input double eaTrailStartDistance = 35; // Specify Trail Start in Point
|
||||||
input double eaTrailStep = 10; // Trail Step 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
|
input bool eaOnlyTrailUnprotected = true; // Only Trail Unprotected Positionss
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -586,7 +588,7 @@ bool InitEA()
|
|||||||
|
|
||||||
//
|
//
|
||||||
eaTradeHandler.UseForceMomentumsInProtection(eaUseForceMomentumsInProtection);
|
eaTradeHandler.UseForceMomentumsInProtection(eaUseForceMomentumsInProtection);
|
||||||
eaTradeHandler.DelayBarBetweenTwoSameSignal(eaDelayBarBetweenTwoSameSignal);
|
eaTradeHandler.DelayBarBetweenTwoSignal(eaDelayBarBetweenTwoSignal);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configure Hedging ...
|
// Configure Hedging ...
|
||||||
@@ -602,9 +604,10 @@ bool InitEA()
|
|||||||
//
|
//
|
||||||
// Trail ...
|
// Trail ...
|
||||||
eaTradeHandler.AllowTrail(eaAllowTrail);
|
eaTradeHandler.AllowTrail(eaAllowTrail);
|
||||||
eaTradeHandler.TrailStartDistance(eaTrailStartDistance);
|
|
||||||
eaTradeHandler.TrailStep(eaTrailStep);
|
eaTradeHandler.TrailStep(eaTrailStep);
|
||||||
|
eaTradeHandler.TrailStartDistance(eaTrailStartDistance);
|
||||||
eaTradeHandler.OnlyTrailUnprotected(eaOnlyTrailUnprotected);
|
eaTradeHandler.OnlyTrailUnprotected(eaOnlyTrailUnprotected);
|
||||||
|
eaTradeHandler.RemoveTPAfterTrailedLevel(eaRemoveTPAfterTrailedLevel);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Partial Close (In Profit) ...
|
// Partial Close (In Profit) ...
|
||||||
@@ -816,15 +819,15 @@ bool InitEA()
|
|||||||
//
|
//
|
||||||
// Register XICHWAP Strategy ...
|
// Register XICHWAP Strategy ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isEURUSD = _symbolParser.IsEURUSD(_Symbol);
|
bool isEURUSD = _symbolParser.IsEURUSD(_Symbol);
|
||||||
bool isGBPUSD = _symbolParser.IsGBPUSD(_Symbol);
|
bool isGBPUSD = _symbolParser.IsGBPUSD(_Symbol);
|
||||||
bool isUSDCHF = _symbolParser.IsUSDCHF(_Symbol);
|
bool isUSDCHF = _symbolParser.IsUSDCHF(_Symbol);
|
||||||
bool isUSDJPY = _symbolParser.IsUSDJPY(_Symbol);
|
bool isUSDJPY = _symbolParser.IsUSDJPY(_Symbol);
|
||||||
bool canRegisterICHWAP = isEURUSD ||
|
bool canRegisterICHWAP = isEURUSD ||
|
||||||
isGBPUSD ||
|
isGBPUSD ||
|
||||||
isUSDCHF ||
|
isUSDCHF ||
|
||||||
isUSDJPY;
|
isUSDJPY;
|
||||||
if (canRegisterICHWAP)
|
if (canRegisterICHWAP)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1353,7 +1356,7 @@ void OnSignalRecieved(
|
|||||||
//
|
//
|
||||||
// Check Signal Delay ...
|
// Check Signal Delay ...
|
||||||
datetime currentTime = TimeCurrent();
|
datetime currentTime = TimeCurrent();
|
||||||
int delay = eaDelayBarBetweenTwoSameSignal;
|
int delay = eaDelayBarBetweenTwoSignal;
|
||||||
bool isDelayPassed = delay <= 0
|
bool isDelayPassed = delay <= 0
|
||||||
? true
|
? true
|
||||||
: !IsValid(lastSignalOn)
|
: !IsValid(lastSignalOn)
|
||||||
|
|||||||
@@ -527,26 +527,6 @@ struct XPosition
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Find Risk ...
|
|
||||||
double GetRisk()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!IsValid())
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = MathAbs(entry - sl);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetPointsValue()
|
double GetPointsValue()
|
||||||
{
|
{
|
||||||
@@ -591,6 +571,26 @@ struct XPosition
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Risk ...
|
||||||
|
double GetRisk()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = MathAbs(entry - sl);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Reward ...
|
// Find Reward ...
|
||||||
double GetReward()
|
double GetReward()
|
||||||
@@ -611,6 +611,18 @@ struct XPosition
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetRewardInPoint() {
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = GetReward() / GetPoints();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Risk Reward Ratio ...
|
// Find Risk Reward Ratio ...
|
||||||
double GetRiskRewardRatio()
|
double GetRiskRewardRatio()
|
||||||
|
|||||||
Reference in New Issue
Block a user