last ...
This commit is contained in:
@@ -1971,6 +1971,112 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int GetBreakoutsSignals(XSignal &signals[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(signals);
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = Count();
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string iSymbol = data[i].symbol;
|
||||||
|
ENUM_TIMEFRAMES iPeriod = data[i].period;
|
||||||
|
|
||||||
|
//
|
||||||
|
double hotLevels[];
|
||||||
|
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
0.25,
|
||||||
|
hotLevels //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
0.20,
|
||||||
|
hotLevels //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
0.12,
|
||||||
|
hotLevels //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
XSCZonesInput zonesInput;
|
||||||
|
zonesInput.length = 71;
|
||||||
|
zonesInput.numberOfZones = 10;
|
||||||
|
XSCZones *zones = new XSCZones(
|
||||||
|
iSymbol,
|
||||||
|
_Period //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
zonesInput.AddLevelColor(
|
||||||
|
hotLevels[0],
|
||||||
|
clrRed //
|
||||||
|
);
|
||||||
|
zonesInput.AddLevelColor(
|
||||||
|
hotLevels[1],
|
||||||
|
clrOrange //
|
||||||
|
);
|
||||||
|
zonesInput.AddLevelColor(
|
||||||
|
hotLevels[2],
|
||||||
|
clrLightCoral //
|
||||||
|
);
|
||||||
|
bool canUseZones = zones.Init(zonesInput);
|
||||||
|
|
||||||
|
//
|
||||||
|
XSCCFInput cfInputs;
|
||||||
|
cfInputs.Default();
|
||||||
|
XSCCF *cf = new XSCCF(
|
||||||
|
iSymbol,
|
||||||
|
_Period //
|
||||||
|
);
|
||||||
|
bool canUseCF = cf.Init(cfInputs);
|
||||||
|
|
||||||
|
//
|
||||||
|
XSCTrendInput tInputs;
|
||||||
|
tInputs.Default();
|
||||||
|
XSCTrend *trend = new XSCTrend(
|
||||||
|
iSymbol,
|
||||||
|
_Period //
|
||||||
|
);
|
||||||
|
bool canUseTrend = trend.Init(tInputs);
|
||||||
|
|
||||||
|
if (canUseCF && canUseTrend && canUseZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// cf.Draw();
|
||||||
|
trend.Draw();
|
||||||
|
// zones.Draw();
|
||||||
|
Print("Use CF ...");
|
||||||
|
// cf.Remove();
|
||||||
|
// trend.Remove();
|
||||||
|
// zones.Remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(signals);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protected ...
|
// Protected ...
|
||||||
protected:
|
protected:
|
||||||
@@ -2783,6 +2889,18 @@ public:
|
|||||||
mGetVerificationFromOtherTimeFrames = value;
|
mGetVerificationFromOtherTimeFrames = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool ExecuteSignalsOnBreakout()
|
||||||
|
{
|
||||||
|
return mExecuteSignalsOnBreakout;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ExecuteSignalsOnBreakout(bool value)
|
||||||
|
{
|
||||||
|
mExecuteSignalsOnBreakout = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Risk Management ...
|
// Risk Management ...
|
||||||
|
|
||||||
@@ -3304,75 +3422,6 @@ public:
|
|||||||
mTradeHandler.SetSave(value);
|
mTradeHandler.SetSave(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
double ForceCloseProfit()
|
|
||||||
{
|
|
||||||
return mForceCloseProfit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void ForceCloseProfit(double value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (value < 0)
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mForceCloseProfit = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double MaxDrawdownForce()
|
|
||||||
{
|
|
||||||
return mMaxDrawdownForce;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void MaxDrawdownForce(double value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (value < 0)
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mMaxDrawdownForce = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int MaxPositionsForce()
|
|
||||||
{
|
|
||||||
return mMaxPositionsForce;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void MaxPositionsForce(int value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (value < 0)
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mMaxPositionsForce = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool AllowSymbolHedgeOnForce()
|
|
||||||
{
|
|
||||||
return mAllowSymbolHedgeOnForce;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void AllowSymbolHedgeOnForce(bool value)
|
|
||||||
{
|
|
||||||
mAllowSymbolHedgeOnForce = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
double MinFreeMargingForHandleForce()
|
double MinFreeMargingForHandleForce()
|
||||||
{
|
{
|
||||||
@@ -3392,18 +3441,6 @@ public:
|
|||||||
mMinFreeMargingForHandleForce = value;
|
mMinFreeMargingForHandleForce = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //
|
|
||||||
// bool ForceState()
|
|
||||||
// {
|
|
||||||
// return mForceState;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
|
||||||
// void ForceState(bool value)
|
|
||||||
// {
|
|
||||||
// mForceState = value;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides ...
|
// Overrides ...
|
||||||
|
|
||||||
@@ -3533,6 +3570,13 @@ public:
|
|||||||
bool allowLong = AllowLong();
|
bool allowLong = AllowLong();
|
||||||
bool allowShort = AllowShort();
|
bool allowShort = AllowShort();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool useCMarket = false;
|
||||||
|
bool useSMarket = true;
|
||||||
|
bool useMMarket = false;
|
||||||
|
bool useLMarket = false;
|
||||||
|
bool useHMarket = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
@@ -3547,24 +3591,26 @@ public:
|
|||||||
cConditions.Clean();
|
cConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
cHasSignal = mSetups[i]
|
cHasSignal = !useCMarket
|
||||||
.ProcessMarket(
|
? false
|
||||||
cSignal,
|
: mSetups[i]
|
||||||
cConditions,
|
.ProcessMarket(
|
||||||
cPusher,
|
cSignal,
|
||||||
cProvider,
|
cConditions,
|
||||||
X_MARKET_CYCLE_UNKNOWN,
|
cPusher,
|
||||||
canSupport,
|
cProvider,
|
||||||
allowLong,
|
X_MARKET_CYCLE_UNKNOWN,
|
||||||
allowShort,
|
canSupport,
|
||||||
volume,
|
allowLong,
|
||||||
slPoint,
|
allowShort,
|
||||||
ignoreSL,
|
volume,
|
||||||
tpPoint,
|
slPoint,
|
||||||
ignoreTP,
|
ignoreSL,
|
||||||
0,
|
tpPoint,
|
||||||
5 //
|
ignoreTP,
|
||||||
);
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Short Market ...
|
// Short Market ...
|
||||||
@@ -3577,24 +3623,26 @@ public:
|
|||||||
sConditions.Clean();
|
sConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
sHasSignal = mSetups[i]
|
sHasSignal = !useSMarket
|
||||||
.ProcessMarket(
|
? false
|
||||||
sSignal,
|
: mSetups[i]
|
||||||
sConditions,
|
.ProcessMarket(
|
||||||
sPusher,
|
sSignal,
|
||||||
sProvider,
|
sConditions,
|
||||||
X_MARKET_CYCLE_SHORT,
|
sPusher,
|
||||||
canSupport,
|
sProvider,
|
||||||
allowLong,
|
X_MARKET_CYCLE_SHORT,
|
||||||
allowShort,
|
canSupport,
|
||||||
volume,
|
allowLong,
|
||||||
slPoint,
|
allowShort,
|
||||||
ignoreSL,
|
volume,
|
||||||
tpPoint,
|
slPoint,
|
||||||
ignoreTP,
|
ignoreSL,
|
||||||
0,
|
tpPoint,
|
||||||
5 //
|
ignoreTP,
|
||||||
);
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Medium Market ...
|
// Medium Market ...
|
||||||
@@ -3607,24 +3655,26 @@ public:
|
|||||||
mConditions.Clean();
|
mConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
mHasSignal = mSetups[i]
|
mHasSignal = !useMMarket
|
||||||
.ProcessMarket(
|
? false
|
||||||
mSignal,
|
: mSetups[i]
|
||||||
mConditions,
|
.ProcessMarket(
|
||||||
mPusher,
|
mSignal,
|
||||||
mProvider,
|
mConditions,
|
||||||
X_MARKET_CYCLE_MEDIUM,
|
mPusher,
|
||||||
canSupport,
|
mProvider,
|
||||||
allowLong,
|
X_MARKET_CYCLE_MEDIUM,
|
||||||
allowShort,
|
canSupport,
|
||||||
volume,
|
allowLong,
|
||||||
slPoint,
|
allowShort,
|
||||||
ignoreSL,
|
volume,
|
||||||
tpPoint,
|
slPoint,
|
||||||
ignoreTP,
|
ignoreSL,
|
||||||
0,
|
tpPoint,
|
||||||
5 //
|
ignoreTP,
|
||||||
);
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Long Market ...
|
// Long Market ...
|
||||||
@@ -3637,24 +3687,26 @@ public:
|
|||||||
lConditions.Clean();
|
lConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
lHasSignal = mSetups[i]
|
lHasSignal = !useLMarket
|
||||||
.ProcessMarket(
|
? false
|
||||||
lSignal,
|
: mSetups[i]
|
||||||
lConditions,
|
.ProcessMarket(
|
||||||
lPusher,
|
lSignal,
|
||||||
lProvider,
|
lConditions,
|
||||||
X_MARKET_CYCLE_LONG,
|
lPusher,
|
||||||
canSupport,
|
lProvider,
|
||||||
allowLong,
|
X_MARKET_CYCLE_LONG,
|
||||||
allowShort,
|
canSupport,
|
||||||
volume,
|
allowLong,
|
||||||
slPoint,
|
allowShort,
|
||||||
ignoreSL,
|
volume,
|
||||||
tpPoint,
|
slPoint,
|
||||||
ignoreTP,
|
ignoreSL,
|
||||||
0,
|
tpPoint,
|
||||||
5 //
|
ignoreTP,
|
||||||
);
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hind Market ...
|
// Hind Market ...
|
||||||
@@ -3667,24 +3719,26 @@ public:
|
|||||||
hConditions.Clean();
|
hConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
hHasSignal = mSetups[i]
|
hHasSignal = !useHMarket
|
||||||
.ProcessMarket(
|
? false
|
||||||
hSignal,
|
: mSetups[i]
|
||||||
hConditions,
|
.ProcessMarket(
|
||||||
hPusher,
|
hSignal,
|
||||||
hProvider,
|
hConditions,
|
||||||
X_MARKET_CYCLE_HIND,
|
hPusher,
|
||||||
canSupport,
|
hProvider,
|
||||||
allowLong,
|
X_MARKET_CYCLE_HIND,
|
||||||
allowShort,
|
canSupport,
|
||||||
volume,
|
allowLong,
|
||||||
slPoint,
|
allowShort,
|
||||||
ignoreSL,
|
volume,
|
||||||
tpPoint,
|
slPoint,
|
||||||
ignoreTP,
|
ignoreSL,
|
||||||
0,
|
tpPoint,
|
||||||
5 //
|
ignoreTP,
|
||||||
);
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse Signals and Add them for Executing ...
|
// Parse Signals and Add them for Executing ...
|
||||||
@@ -4317,12 +4371,33 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
ENUM_X_SIGNAL_EXECUTION_RESULT states[];
|
bool executeOnBreakouts = ExecuteSignalsOnBreakout();
|
||||||
int executedSignalsCount = ExecuteSignals(
|
if (executeOnBreakouts)
|
||||||
signals,
|
{
|
||||||
states,
|
//
|
||||||
false //
|
XSignal bSignals[];
|
||||||
);
|
int bSignalsCount = mTradeHandler.GetBreakoutsSignals(bSignals);
|
||||||
|
if (IsValidSize(bSignalsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT states[];
|
||||||
|
int executedSignalsCount = ExecuteSignals(
|
||||||
|
signals,
|
||||||
|
states,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT states[];
|
||||||
|
int executedSignalsCount = ExecuteSignals(
|
||||||
|
signals,
|
||||||
|
states,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4404,24 +4479,27 @@ protected:
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
int maxAllowed = MaxPositionsForce();
|
// int maxAllowed = MaxPositionsForce();
|
||||||
result = maxAllowed <= 0;
|
// result = maxAllowed <= 0;
|
||||||
if (result)
|
// if (result)
|
||||||
{
|
// {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// XPosition positions[];
|
||||||
|
// int positionsCount = mTrader.GetPositions(positions);
|
||||||
|
// result = !IsValidSize(positionsCount);
|
||||||
|
// if (result)
|
||||||
|
// {
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// result = positionsCount < maxAllowed;
|
||||||
|
|
||||||
//
|
//
|
||||||
XPosition positions[];
|
result = true;
|
||||||
int positionsCount = mTrader.GetPositions(positions);
|
|
||||||
result = !IsValidSize(positionsCount);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = positionsCount < maxAllowed;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -4437,8 +4515,8 @@ private:
|
|||||||
// Signals ...
|
// Signals ...
|
||||||
bool mAllowLong; // Allow Long
|
bool mAllowLong; // Allow Long
|
||||||
bool mAllowShort; // Allow Short
|
bool mAllowShort; // Allow Short
|
||||||
double mForceCloseProfit; // Close All Positions Regardless of Policies when Profit Reached
|
|
||||||
int mReuiredSignalVerifications; // Required Verifications for Validate Signals
|
int mReuiredSignalVerifications; // Required Verifications for Validate Signals
|
||||||
|
bool mExecuteSignalsOnBreakout; // Execute Signals On Breakouts
|
||||||
bool mGetVerificationFromOtherTimeFrames; // Get Verifications from Other Time Frames
|
bool mGetVerificationFromOtherTimeFrames; // Get Verifications from Other Time Frames
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4667,7 +4745,7 @@ private:
|
|||||||
int restingTime = RestingAfterHedge();
|
int restingTime = RestingAfterHedge();
|
||||||
if (result && IsValidSize(restingTime))
|
if (result && IsValidSize(restingTime))
|
||||||
{
|
{
|
||||||
Sleep(restingTime * 1000);
|
Sleeping(restingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4838,222 +4916,6 @@ private:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
if (!IsValidSize(setupsCount))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Here i Can Check what to do In Force State ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Handle Hedging Based On Positions ...
|
|
||||||
double drawdown = GetDrawdownPercent();
|
|
||||||
double forceDrawdown = MaxDrawdownForce();
|
|
||||||
int positionsForce = MaxPositionsForce();
|
|
||||||
double forceCloseProfit = ForceCloseProfit();
|
|
||||||
double minRequiredProfitPerTrade = MinRequiredProfitPerTrade();
|
|
||||||
double minRequiredProfitPerVolumeFactor = MinRequiredProfitPerVolumeFactor();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Try To Force Hedging ...
|
|
||||||
bool canForceHedge =
|
|
||||||
(positionsForce <= 0
|
|
||||||
? true
|
|
||||||
: positionsCount > positionsForce)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(forceDrawdown > 0 &&
|
|
||||||
drawdown >= forceDrawdown);
|
|
||||||
if (canForceHedge)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Check Required Profit ...
|
|
||||||
|
|
||||||
//
|
|
||||||
double profit = SpecifiedCalculatePositionsProfit(positions);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Force Close Profit ...
|
|
||||||
if (forceCloseProfit > 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
canForceHedge = profit >= forceCloseProfit;
|
|
||||||
if (canForceHedge)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isHedged = DoEQMForceClose();
|
|
||||||
if (isHedged)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Calculate Required Profit ...
|
|
||||||
double requiredProfit = SpecifiedCalculateRequiredProfitForHedge(
|
|
||||||
positions,
|
|
||||||
minRequiredProfitPerTrade,
|
|
||||||
minRequiredProfitPerVolumeFactor //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
canForceHedge =
|
|
||||||
requiredProfit <= 0
|
|
||||||
? profit > 0
|
|
||||||
: profit >= (requiredProfit / 2);
|
|
||||||
if (canForceHedge)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isHedged = DoEQMForceClose();
|
|
||||||
if (isHedged)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// At Least Hedgeing ...
|
|
||||||
// Minimal Hedge ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Symbol Hedging ...
|
|
||||||
bool allowSymbolHedge = AllowSymbolHedgeOnForce();
|
|
||||||
if (allowSymbolHedge)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < setupsCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string iSymbol = mSetups[i].GetSymbol();
|
|
||||||
|
|
||||||
//
|
|
||||||
XPosition iSymbolPositions[];
|
|
||||||
int iSymbolPositionsCount = mTrader.GetPositions(
|
|
||||||
iSymbolPositions,
|
|
||||||
//
|
|
||||||
iSymbol,
|
|
||||||
NULL, // All Providers ...
|
|
||||||
NULL, // All Periods ...
|
|
||||||
NULL, // All Types ...
|
|
||||||
true // Filter By Magic ...
|
|
||||||
);
|
|
||||||
if (!IsValidSize(iSymbolPositionsCount))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double profit = SpecifiedCalculatePositionsProfit(iSymbolPositions);
|
|
||||||
|
|
||||||
//
|
|
||||||
double requiredProfit = SpecifiedCalculateRequiredProfitForHedge(
|
|
||||||
iSymbolPositions,
|
|
||||||
minRequiredProfitPerTrade,
|
|
||||||
minRequiredProfitPerVolumeFactor //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool canHedge =
|
|
||||||
requiredProfit <= 0
|
|
||||||
? profit > 0
|
|
||||||
: profit >= requiredProfit;
|
|
||||||
if (canHedge)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string comment = XEQMSupportToken + " Hedge Symbol ...";
|
|
||||||
|
|
||||||
//
|
|
||||||
int closed = mTrader.Close(
|
|
||||||
iSymbolPositions,
|
|
||||||
comment //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (closed == iSymbolPositionsCount)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
mSetups[i].ForceState(false);
|
|
||||||
|
|
||||||
//
|
|
||||||
string message = XEQMSupportToken + " Hedge Symbol (" + iSymbol + "): " + ToString(profit);
|
|
||||||
Alert(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Implement Other Senarios ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isMarginPassed = IsMarginPassed();
|
|
||||||
bool isMaxNumberPassed = IsNumberOfPositionsPassed();
|
|
||||||
bool canProtect = !isMarginPassed || !isMaxNumberPassed;
|
|
||||||
if (canProtect)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int maxInDIDX = FindMaxDrawdownIndex(
|
|
||||||
positions //
|
|
||||||
);
|
|
||||||
int setupIDX = FindSetupIndex(positions[maxInDIDX].symbol);
|
|
||||||
if (IsValidIndex(maxInDIDX) && IsValidIndex(setupIDX))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string iSymbol = positions[maxInDIDX].symbol;
|
|
||||||
ENUM_TIMEFRAMES iPeriod = mSetups[setupIDX].GetPeriod();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Position Age ...
|
|
||||||
int age = GetAge(
|
|
||||||
positions[maxInDIDX],
|
|
||||||
iPeriod //
|
|
||||||
);
|
|
||||||
if (age >= 700)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Calculate Trend ...
|
|
||||||
XSCTrend *trend = new XSCTrend(
|
|
||||||
iSymbol,
|
|
||||||
iPeriod //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
XSCTrendInput tInputs;
|
|
||||||
tInputs.Default();
|
|
||||||
bool canUseTrend = trend.Init(tInputs);
|
|
||||||
if (canUseTrend)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
trend.Draw();
|
|
||||||
Print("UseTrend");
|
|
||||||
trend.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// string comment = XEQMSupportToken + " Close Max In D ...";
|
|
||||||
// bool isClosed = mTrader.Close(
|
|
||||||
// positions[maxInDIDX].ticket,
|
|
||||||
// comment //
|
|
||||||
// );
|
|
||||||
// if (isClosed)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// string message = XEQMSupportToken + " Close Position (" + ToString(positions[maxInDIDX].ticket) + ") Due Max In Drawdown ...";
|
|
||||||
// Alert(message);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Find Max In Profit ...
|
|
||||||
// and Min In Profit ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -323,6 +323,15 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Sleeping State ...
|
||||||
|
bool isSlept = IsSlept();
|
||||||
|
if (isSlept)
|
||||||
|
{
|
||||||
|
Print("Slept");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Second Check For Signals ...
|
// Second Check For Signals ...
|
||||||
// then Execute Signals if Provided ...
|
// then Execute Signals if Provided ...
|
||||||
@@ -1657,6 +1666,83 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sleeping Context ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sleeping Mode ...
|
||||||
|
int mSleepingDuration;
|
||||||
|
datetime mSleepingStartAt;
|
||||||
|
bool Sleeping(int seconds = -1)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
mSleepingDuration =
|
||||||
|
seconds > 0
|
||||||
|
? seconds
|
||||||
|
: mRestingAfterHedge > 0
|
||||||
|
? mRestingAfterHedge
|
||||||
|
: 0;
|
||||||
|
result = mSleepingDuration > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ResetSleeping();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Doesnt Sleep Before ...
|
||||||
|
result = mSleepingStartAt == NULL;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ResetSleeping();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
mSleepingStartAt = cTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
bool IsSlept()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mSleepingDuration > 0 &&
|
||||||
|
mSleepingStartAt != NULL;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ResetSleeping();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
result = (int)cTime < (int)mSleepingStartAt + mSleepingDuration;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
ResetSleeping();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
void ResetSleeping()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mSleepingDuration = 0;
|
||||||
|
mSleepingStartAt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -4567,3 +4567,302 @@ int pivotsCount = ArraySize(pivots);
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// input double x121EAForceCloseProfit = 5; // Close All Positions Regardless of Policies when Profit Reached
|
||||||
|
// input double x121EAMaxDrawdownForce = 5; // Max Drawdown Force State for Handling Guards
|
||||||
|
// input int x121EAMaxPositionsForce = 10; // Max Number of Positions Force State for Handling Guards
|
||||||
|
// input double x121EAMinFreeMargingForHandleForce = 800; // Min Free Margin for Force States
|
||||||
|
// input bool x121EAAllowSymbolHedgeOnForce = false; // Allow Symbol Hedging on Force States
|
||||||
|
|
||||||
|
// x121EA.ForceCloseProfit(x121EAForceCloseProfit);
|
||||||
|
// x121EA.MaxDrawdownForce(x121EAMaxDrawdownForce);
|
||||||
|
// x121EA.MaxPositionsForce(x121EAMaxPositionsForce);
|
||||||
|
// x121EA.AllowSymbolHedgeOnForce(x121EAAllowSymbolHedgeOnForce);
|
||||||
|
// x121EA.MinFreeMargingForHandleForce(x121EAMinFreeMargingForHandleForce);
|
||||||
|
|
||||||
|
double mForceCloseProfit; // Close All Positions Regardless of Policies when Profit Reached
|
||||||
|
|
||||||
|
//
|
||||||
|
double ForceCloseProfit()
|
||||||
|
{
|
||||||
|
return mForceCloseProfit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ForceCloseProfit(double value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mForceCloseProfit = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double MaxDrawdownForce()
|
||||||
|
{
|
||||||
|
return mMaxDrawdownForce;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void MaxDrawdownForce(double value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mMaxDrawdownForce = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int MaxPositionsForce()
|
||||||
|
{
|
||||||
|
return mMaxPositionsForce;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void MaxPositionsForce(int value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mMaxPositionsForce = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool AllowSymbolHedgeOnForce()
|
||||||
|
{
|
||||||
|
return mAllowSymbolHedgeOnForce;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void AllowSymbolHedgeOnForce(bool value)
|
||||||
|
{
|
||||||
|
mAllowSymbolHedgeOnForce = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValidSize(setupsCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Here i Can Check what to do In Force State ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Hedging Based On Positions ...
|
||||||
|
double drawdown = GetDrawdownPercent();
|
||||||
|
double forceDrawdown = MaxDrawdownForce();
|
||||||
|
int positionsForce = MaxPositionsForce();
|
||||||
|
double forceCloseProfit = ForceCloseProfit();
|
||||||
|
double minRequiredProfitPerTrade = MinRequiredProfitPerTrade();
|
||||||
|
double minRequiredProfitPerVolumeFactor = MinRequiredProfitPerVolumeFactor();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try To Force Hedging ...
|
||||||
|
bool canForceHedge =
|
||||||
|
(positionsForce <= 0
|
||||||
|
? true
|
||||||
|
: positionsCount > positionsForce)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(forceDrawdown > 0 &&
|
||||||
|
drawdown >= forceDrawdown);
|
||||||
|
if (canForceHedge)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Required Profit ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double profit = SpecifiedCalculatePositionsProfit(positions);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Force Close Profit ...
|
||||||
|
if (forceCloseProfit > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
canForceHedge = profit >= forceCloseProfit;
|
||||||
|
if (canForceHedge)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isHedged = DoEQMForceClose();
|
||||||
|
if (isHedged)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Required Profit ...
|
||||||
|
double requiredProfit = SpecifiedCalculateRequiredProfitForHedge(
|
||||||
|
positions,
|
||||||
|
minRequiredProfitPerTrade,
|
||||||
|
minRequiredProfitPerVolumeFactor //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
canForceHedge =
|
||||||
|
requiredProfit <= 0
|
||||||
|
? profit > 0
|
||||||
|
: profit >= (requiredProfit / 2);
|
||||||
|
if (canForceHedge)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isHedged = DoEQMForceClose();
|
||||||
|
if (isHedged)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// At Least Hedgeing ...
|
||||||
|
// Minimal Hedge ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Symbol Hedging ...
|
||||||
|
bool allowSymbolHedge = AllowSymbolHedgeOnForce();
|
||||||
|
if (allowSymbolHedge)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < setupsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string iSymbol = mSetups[i].GetSymbol();
|
||||||
|
|
||||||
|
//
|
||||||
|
XPosition iSymbolPositions[];
|
||||||
|
int iSymbolPositionsCount = mTrader.GetPositions(
|
||||||
|
iSymbolPositions,
|
||||||
|
//
|
||||||
|
iSymbol,
|
||||||
|
NULL, // All Providers ...
|
||||||
|
NULL, // All Periods ...
|
||||||
|
NULL, // All Types ...
|
||||||
|
true // Filter By Magic ...
|
||||||
|
);
|
||||||
|
if (!IsValidSize(iSymbolPositionsCount))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double profit = SpecifiedCalculatePositionsProfit(iSymbolPositions);
|
||||||
|
|
||||||
|
//
|
||||||
|
double requiredProfit = SpecifiedCalculateRequiredProfitForHedge(
|
||||||
|
iSymbolPositions,
|
||||||
|
minRequiredProfitPerTrade,
|
||||||
|
minRequiredProfitPerVolumeFactor //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canHedge =
|
||||||
|
requiredProfit <= 0
|
||||||
|
? profit > 0
|
||||||
|
: profit >= requiredProfit;
|
||||||
|
if (canHedge)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string comment = XEQMSupportToken + " Hedge Symbol ...";
|
||||||
|
|
||||||
|
//
|
||||||
|
int closed = mTrader.Close(
|
||||||
|
iSymbolPositions,
|
||||||
|
comment //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (closed == iSymbolPositionsCount)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mSetups[i].ForceState(false);
|
||||||
|
|
||||||
|
//
|
||||||
|
string message = XEQMSupportToken + " Hedge Symbol (" + iSymbol + "): " + ToString(profit);
|
||||||
|
Alert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Implement Other Senarios ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isMarginPassed = IsMarginPassed();
|
||||||
|
bool isMaxNumberPassed = IsNumberOfPositionsPassed();
|
||||||
|
bool canProtect = !isMarginPassed || !isMaxNumberPassed;
|
||||||
|
if (canProtect)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int maxInDIDX = FindMaxDrawdownIndex(
|
||||||
|
positions //
|
||||||
|
);
|
||||||
|
int setupIDX = FindSetupIndex(positions[maxInDIDX].symbol);
|
||||||
|
if (IsValidIndex(maxInDIDX) && IsValidIndex(setupIDX))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string iSymbol = positions[maxInDIDX].symbol;
|
||||||
|
ENUM_TIMEFRAMES iPeriod = mSetups[setupIDX].GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Position Age ...
|
||||||
|
int age = GetAge(
|
||||||
|
positions[maxInDIDX],
|
||||||
|
iPeriod //
|
||||||
|
);
|
||||||
|
if (age >= 700)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Calculate Trend ...
|
||||||
|
XSCTrend *trend = new XSCTrend(
|
||||||
|
iSymbol,
|
||||||
|
iPeriod //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
XSCTrendInput tInputs;
|
||||||
|
tInputs.Default();
|
||||||
|
bool canUseTrend = trend.Init(tInputs);
|
||||||
|
if (canUseTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
trend.Draw();
|
||||||
|
Print("UseTrend");
|
||||||
|
trend.Remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
// string comment = XEQMSupportToken + " Close Max In D ...";
|
||||||
|
// bool isClosed = mTrader.Close(
|
||||||
|
// positions[maxInDIDX].ticket,
|
||||||
|
// comment //
|
||||||
|
// );
|
||||||
|
// if (isClosed)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// string message = XEQMSupportToken + " Close Position (" + ToString(positions[maxInDIDX].ticket) + ") Due Max In Drawdown ...";
|
||||||
|
// Alert(message);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -44,14 +44,15 @@ input group "Signals";
|
|||||||
//,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb
|
//,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb
|
||||||
// EURUSDb,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb
|
// EURUSDb,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb
|
||||||
// EURUSDb,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb,XAUUSDb,NZDUSDb,AUDUSDb,USDCADb,BTCUSD,ETHUSD
|
// EURUSDb,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb,XAUUSDb,NZDUSDb,AUDUSDb,USDCADb,BTCUSD,ETHUSD
|
||||||
input string x121EASymbols = "EURUSDb,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb"; // Symbols
|
input string x121EASymbols = "EURUSDb"; // Symbols
|
||||||
input bool x121EAUseAllSymbols = false; // Use All Available Symbols
|
input bool x121EAUseAllSymbols = false; // Use All Available Symbols
|
||||||
input bool x121EAUseAllWatchListSymbols = false; // Use All WatchList Symbols
|
input bool x121EAUseAllWatchListSymbols = false; // Use All WatchList Symbols
|
||||||
input bool x121EAAllowLong = true; // Allow Long Trades
|
input bool x121EAAllowLong = true; // Allow Long Trades
|
||||||
input bool x121EAAllowShort = true; // Allow Short Trades
|
input bool x121EAAllowShort = true; // Allow Short Trades
|
||||||
input int x121EADelayBetweenTwoSignal = 5; // Delay Between two Same Signals
|
input bool x121EAExecuteSignalsOnBreakout = false; // Execute Signals On Breakouts
|
||||||
input int x121EAReuiredSignalVerifications = 4; // Required Verifications for Signals
|
input int x121EADelayBetweenTwoSignal = 5; // Delay Between two Same Signals
|
||||||
input bool x121EAGetVerificationFromOtherTimeFrames = true; // Get Verifications from Other Time Frames
|
input int x121EAReuiredSignalVerifications = 3; // Required Verifications for Signals
|
||||||
|
input bool x121EAGetVerificationFromOtherTimeFrames = false; // Get Verifications from Other Time Frames
|
||||||
|
|
||||||
//
|
//
|
||||||
// Risk Management ...
|
// Risk Management ...
|
||||||
@@ -101,8 +102,8 @@ input double x121EAMaxAllowedGridVolume = 0.04; // Max Allowed Grid Signals Volu
|
|||||||
|
|
||||||
//
|
//
|
||||||
input group "Recovery";
|
input group "Recovery";
|
||||||
input bool x121EAAllowRecovery = true; // Allow Recovery Signals
|
input bool x121EAAllowRecovery = false; // Allow Recovery Signals
|
||||||
input bool x121EARecoverOnlyForces = true; // Recover Only Force Signals
|
input bool x121EARecoverOnlyForces = true; // Recover Only Force Signals
|
||||||
input int x121EAMaxNumberOfRecoveries = 2; // Max Number of Recovery Signals
|
input int x121EAMaxNumberOfRecoveries = 2; // Max Number of Recovery Signals
|
||||||
input double x121EARecoveryDistance = 100; // Recovery Distance
|
input double x121EARecoveryDistance = 100; // Recovery Distance
|
||||||
input double x121EARecoveryVolumeMultiplier = 2; // Recovery Volume Multiplier
|
input double x121EARecoveryVolumeMultiplier = 2; // Recovery Volume Multiplier
|
||||||
@@ -110,12 +111,7 @@ input double x121EAMaxAllowedRecoveryVolume = 0.08; // Max Allowed Recovery Sign
|
|||||||
|
|
||||||
//
|
//
|
||||||
input group "Hedging";
|
input group "Hedging";
|
||||||
input int x121EARestingAfterHedge = 3000; // Resting Seconds After Hedge
|
input int x121EARestingAfterHedge = 0; // Resting Seconds After Hedge
|
||||||
input double x121EAForceCloseProfit = 5; // Close All Positions Regardless of Policies when Profit Reached
|
|
||||||
input double x121EAMaxDrawdownForce = 5; // Max Drawdown Force State for Handling Guards
|
|
||||||
input int x121EAMaxPositionsForce = 10; // Max Number of Positions Force State for Handling Guards
|
|
||||||
input double x121EAMinFreeMargingForHandleForce = 800; // Min Free Margin for Force States
|
|
||||||
input bool x121EAAllowSymbolHedgeOnForce = false; // Allow Symbol Hedging on Force States
|
|
||||||
input double x121EAMinRequiredProfitPerTrade = 0.2; // Minimum Required Profit for Hedging
|
input double x121EAMinRequiredProfitPerTrade = 0.2; // Minimum Required Profit for Hedging
|
||||||
input double x121EAMinRequiredProfitPerVolumeFactor = 0.01; // Minimum Required Profit for Hedging Per Volume
|
input double x121EAMinRequiredProfitPerVolumeFactor = 0.01; // Minimum Required Profit for Hedging Per Volume
|
||||||
|
|
||||||
@@ -316,6 +312,7 @@ bool InitialEA()
|
|||||||
x121EA.AllowLong(x121EAAllowLong);
|
x121EA.AllowLong(x121EAAllowLong);
|
||||||
x121EA.AllowShort(x121EAAllowShort);
|
x121EA.AllowShort(x121EAAllowShort);
|
||||||
x121EA.DelayBetweenTwoSignal(x121EADelayBetweenTwoSignal);
|
x121EA.DelayBetweenTwoSignal(x121EADelayBetweenTwoSignal);
|
||||||
|
x121EA.ExecuteSignalsOnBreakout(x121EAExecuteSignalsOnBreakout);
|
||||||
x121EA.ReuiredSignalVerifications(x121EAReuiredSignalVerifications);
|
x121EA.ReuiredSignalVerifications(x121EAReuiredSignalVerifications);
|
||||||
x121EA.GetVerificationFromOtherTimeFrames(x121EAGetVerificationFromOtherTimeFrames);
|
x121EA.GetVerificationFromOtherTimeFrames(x121EAGetVerificationFromOtherTimeFrames);
|
||||||
|
|
||||||
@@ -377,13 +374,8 @@ bool InitialEA()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Hedging ...
|
// Hedging ...
|
||||||
x121EA.ForceCloseProfit(x121EAForceCloseProfit);
|
|
||||||
x121EA.RestingAfterHedge(x121EARestingAfterHedge);
|
x121EA.RestingAfterHedge(x121EARestingAfterHedge);
|
||||||
x121EA.MaxDrawdownForce(x121EAMaxDrawdownForce);
|
|
||||||
x121EA.MaxPositionsForce(x121EAMaxPositionsForce);
|
|
||||||
x121EA.AllowSymbolHedgeOnForce(x121EAAllowSymbolHedgeOnForce);
|
|
||||||
x121EA.MinRequiredProfitPerTrade(x121EAMinRequiredProfitPerTrade);
|
x121EA.MinRequiredProfitPerTrade(x121EAMinRequiredProfitPerTrade);
|
||||||
x121EA.MinFreeMargingForHandleForce(x121EAMinFreeMargingForHandleForce);
|
|
||||||
x121EA.MinRequiredProfitPerVolumeFactor(x121EAMinRequiredProfitPerVolumeFactor);
|
x121EA.MinRequiredProfitPerVolumeFactor(x121EAMinRequiredProfitPerVolumeFactor);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user