save last ...
This commit is contained in:
@@ -374,7 +374,20 @@ struct XTradeInfo
|
|||||||
ToString("Type", ToString(type)) +
|
ToString("Type", ToString(type)) +
|
||||||
ToString("Time", time) +
|
ToString("Time", time) +
|
||||||
ToString("Pushers", pushers) +
|
ToString("Pushers", pushers) +
|
||||||
(onlySignals ? "" : "-------------" + "\n" + ToString("Volume", volume) + ToString("Profit", profit) + ToString("Commission", commission) + ToString("Swap", swap) + ToString("End Time", endTime) + ToString("Age", age) + ToString("Message", message)) +
|
(onlySignals
|
||||||
|
? ""
|
||||||
|
:
|
||||||
|
//
|
||||||
|
"-------------" + "\n" +
|
||||||
|
ToString("Volume", volume) +
|
||||||
|
ToString("Profit", profit) +
|
||||||
|
ToString("Commission", commission) +
|
||||||
|
ToString("Swap", swap) +
|
||||||
|
ToString("End Time", endTime) +
|
||||||
|
ToString("Age", age) +
|
||||||
|
ToString("Message", message)
|
||||||
|
//
|
||||||
|
) +
|
||||||
"-------------" + "\n" +
|
"-------------" + "\n" +
|
||||||
"Conditions" + "\n" +
|
"Conditions" + "\n" +
|
||||||
"-------------" + "\n" +
|
"-------------" + "\n" +
|
||||||
@@ -495,13 +508,19 @@ struct XTradeInfo
|
|||||||
|
|
||||||
//
|
//
|
||||||
double selectedEntry =
|
double selectedEntry =
|
||||||
gEntry <= 0 ? entry : gEntry;
|
gEntry <= 0
|
||||||
|
? entry
|
||||||
|
: gEntry;
|
||||||
double selectedVolume =
|
double selectedVolume =
|
||||||
gVolume <= 0 ? volume : gVolume;
|
gVolume <= 0
|
||||||
|
? volume
|
||||||
|
: gVolume;
|
||||||
|
|
||||||
//
|
//
|
||||||
double nextEntry =
|
double nextEntry =
|
||||||
isLong ? selectedEntry - distancePrice : selectedEntry + distancePrice;
|
isLong
|
||||||
|
? selectedEntry - distancePrice
|
||||||
|
: selectedEntry + distancePrice;
|
||||||
double nextVolume = selectedVolume * volumeMultiplier;
|
double nextVolume = selectedVolume * volumeMultiplier;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -550,7 +569,9 @@ struct XTradeInfo
|
|||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
isLong ? cEntry <= gEntry : cEntry >= gEntry;
|
isLong
|
||||||
|
? cEntry <= gEntry
|
||||||
|
: cEntry >= gEntry;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -665,16 +686,27 @@ struct XTradeInfo
|
|||||||
|
|
||||||
//
|
//
|
||||||
double selectedEntry =
|
double selectedEntry =
|
||||||
isLong ? rLongEntry <= 0 ? entry : rLongEntry : rShortEntry <= 0 ? entry
|
isLong
|
||||||
: rShortEntry;
|
? rLongEntry <= 0
|
||||||
|
? entry
|
||||||
|
: rLongEntry
|
||||||
|
: rShortEntry <= 0
|
||||||
|
? entry
|
||||||
|
: rShortEntry;
|
||||||
double selectedVolume =
|
double selectedVolume =
|
||||||
rVolume <= 0 ? volume : rVolume;
|
rVolume <= 0
|
||||||
|
? volume
|
||||||
|
: rVolume;
|
||||||
|
|
||||||
//
|
//
|
||||||
double nextLongEntry =
|
double nextLongEntry =
|
||||||
isLong ? selectedEntry : selectedEntry + distancePrice;
|
isLong
|
||||||
|
? selectedEntry
|
||||||
|
: selectedEntry + distancePrice;
|
||||||
double nextShortEntry =
|
double nextShortEntry =
|
||||||
isLong ? selectedEntry - distancePrice : selectedEntry;
|
isLong
|
||||||
|
? selectedEntry - distancePrice
|
||||||
|
: selectedEntry;
|
||||||
|
|
||||||
//
|
//
|
||||||
double nextVolume = selectedVolume * volumeMultiplier;
|
double nextVolume = selectedVolume * volumeMultiplier;
|
||||||
@@ -684,11 +716,17 @@ struct XTradeInfo
|
|||||||
|
|
||||||
//
|
//
|
||||||
double zoneUpper =
|
double zoneUpper =
|
||||||
rZoneUpper > 0 ? rZoneUpper : isLong ? entry + distancePrice
|
rZoneUpper > 0
|
||||||
: entry + (distancePrice * 2);
|
? rZoneUpper
|
||||||
|
: isLong
|
||||||
|
? entry + distancePrice
|
||||||
|
: entry + (distancePrice * 2);
|
||||||
double zoneLower =
|
double zoneLower =
|
||||||
rZoneLower > 0 ? rZoneLower : isLong ? entry + (distancePrice * 2)
|
rZoneLower > 0
|
||||||
: entry - distancePrice;
|
? rZoneLower
|
||||||
|
: isLong
|
||||||
|
? entry + (distancePrice * 2)
|
||||||
|
: entry - distancePrice;
|
||||||
|
|
||||||
//
|
//
|
||||||
SetRecovery(
|
SetRecovery(
|
||||||
@@ -773,19 +811,27 @@ struct XTradeInfo
|
|||||||
|
|
||||||
//
|
//
|
||||||
ENUM_POSITION_TYPE rType =
|
ENUM_POSITION_TYPE rType =
|
||||||
hasLongRecovery ? POSITION_TYPE_BUY : POSITION_TYPE_SELL;
|
hasLongRecovery
|
||||||
|
? POSITION_TYPE_BUY
|
||||||
|
: POSITION_TYPE_SELL;
|
||||||
|
|
||||||
//
|
//
|
||||||
double rEntry =
|
double rEntry =
|
||||||
hasLongRecovery ? cLongEntry : cShortEntry;
|
hasLongRecovery
|
||||||
|
? cLongEntry
|
||||||
|
: cShortEntry;
|
||||||
|
|
||||||
//
|
//
|
||||||
double rTP =
|
double rTP =
|
||||||
hasLongRecovery ? rZoneUpper : rZoneLower;
|
hasLongRecovery
|
||||||
|
? rZoneUpper
|
||||||
|
: rZoneLower;
|
||||||
|
|
||||||
//
|
//
|
||||||
double rSL =
|
double rSL =
|
||||||
hasLongRecovery ? rZoneLower : rZoneUpper;
|
hasLongRecovery
|
||||||
|
? rZoneLower
|
||||||
|
: rZoneUpper;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = signal.Prepare(
|
result = signal.Prepare(
|
||||||
@@ -2139,7 +2185,10 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isLong = IsLong(iType);
|
bool isLong = IsLong(iType);
|
||||||
ENUM_POSITION_TYPE iPType = isLong ? POSITION_TYPE_BUY : POSITION_TYPE_SELL;
|
ENUM_POSITION_TYPE iPType =
|
||||||
|
isLong
|
||||||
|
? POSITION_TYPE_BUY
|
||||||
|
: POSITION_TYPE_SELL;
|
||||||
|
|
||||||
//
|
//
|
||||||
double cEntry = GetEntry(
|
double cEntry = GetEntry(
|
||||||
@@ -2169,7 +2218,13 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isBreaked =
|
bool isBreaked =
|
||||||
isLong ? isBullish && isBreakUp && cEntry > iEntry : isBearish && isBreakDown && cEntry < iEntry;
|
isLong
|
||||||
|
? isBullish &&
|
||||||
|
isBreakUp &&
|
||||||
|
cEntry > iEntry
|
||||||
|
: isBearish &&
|
||||||
|
isBreakDown &&
|
||||||
|
cEntry < iEntry;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isBreaked)
|
if (isBreaked)
|
||||||
@@ -2497,7 +2552,9 @@ protected:
|
|||||||
|
|
||||||
//
|
//
|
||||||
double usedTrailDiff =
|
double usedTrailDiff =
|
||||||
isFirstTrail ? MathMax(firstTrailPoint, firstTrailDistance) : MathMax(nextTrailPoint, nextTrailDistance);
|
isFirstTrail
|
||||||
|
? MathMax(firstTrailPoint, firstTrailDistance)
|
||||||
|
: MathMax(nextTrailPoint, nextTrailDistance);
|
||||||
|
|
||||||
//
|
//
|
||||||
double iExit = GetExit(
|
double iExit = GetExit(
|
||||||
@@ -2551,7 +2608,9 @@ protected:
|
|||||||
|
|
||||||
//
|
//
|
||||||
usedTrailDiff =
|
usedTrailDiff =
|
||||||
isFirstTrail ? MathMin(firstTrailPoint, firstTrailDistance) : MathMin(nextTrailPoint, nextTrailDistance);
|
isFirstTrail
|
||||||
|
? MathMin(firstTrailPoint, firstTrailDistance)
|
||||||
|
: MathMin(nextTrailPoint, nextTrailDistance);
|
||||||
double usedTrailDiffPrice = PointToPrice(
|
double usedTrailDiffPrice = PointToPrice(
|
||||||
usedTrailDiff,
|
usedTrailDiff,
|
||||||
iPosition.symbol //
|
iPosition.symbol //
|
||||||
@@ -2559,7 +2618,9 @@ protected:
|
|||||||
|
|
||||||
//
|
//
|
||||||
double sl =
|
double sl =
|
||||||
isLong ? usedPrice + usedTrailDiffPrice : usedPrice - usedTrailDiffPrice;
|
isLong
|
||||||
|
? usedPrice + usedTrailDiffPrice
|
||||||
|
: usedPrice - usedTrailDiffPrice;
|
||||||
string comment = PrepareSLTrailTag(iPosition.comment);
|
string comment = PrepareSLTrailTag(iPosition.comment);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2769,7 +2830,9 @@ protected:
|
|||||||
//
|
//
|
||||||
// Check Count ...
|
// Check Count ...
|
||||||
bool isMaxPassed =
|
bool isMaxPassed =
|
||||||
maxAllowed <= 0 ? true : data[i].gLevel < maxAllowed;
|
maxAllowed <= 0
|
||||||
|
? true
|
||||||
|
: data[i].gLevel < maxAllowed;
|
||||||
if (!isMaxPassed)
|
if (!isMaxPassed)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -2789,7 +2852,9 @@ protected:
|
|||||||
//
|
//
|
||||||
// Check Max Volume ...
|
// Check Max Volume ...
|
||||||
iSignal.volume =
|
iSignal.volume =
|
||||||
maxAllowedVolume <= 0 ? iSignal.volume : MathMin(iSignal.volume, maxAllowedVolume);
|
maxAllowedVolume <= 0
|
||||||
|
? iSignal.volume
|
||||||
|
: MathMin(iSignal.volume, maxAllowedVolume);
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
AddRef(
|
||||||
@@ -2838,7 +2903,9 @@ protected:
|
|||||||
//
|
//
|
||||||
// Check Count ...
|
// Check Count ...
|
||||||
bool isMaxPassed =
|
bool isMaxPassed =
|
||||||
maxAllowed <= 0 ? true : data[i].rLevel < maxAllowed;
|
maxAllowed <= 0
|
||||||
|
? true
|
||||||
|
: data[i].rLevel < maxAllowed;
|
||||||
if (!isMaxPassed)
|
if (!isMaxPassed)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -2858,7 +2925,9 @@ protected:
|
|||||||
//
|
//
|
||||||
// Check Max Volume ...
|
// Check Max Volume ...
|
||||||
iSignal.volume =
|
iSignal.volume =
|
||||||
maxAllowedVolume <= 0 ? iSignal.volume : MathMin(iSignal.volume, maxAllowedVolume);
|
maxAllowedVolume <= 0
|
||||||
|
? iSignal.volume
|
||||||
|
: MathMin(iSignal.volume, maxAllowedVolume);
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
AddRef(
|
||||||
@@ -3700,6 +3769,27 @@ public:
|
|||||||
mMinFreeMargingForOpenTrades = value;
|
mMinFreeMargingForOpenTrades = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double MaxAllowedDrawdownPercent() {
|
||||||
|
return mMaxAllowedDrawdownPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void MaxAllowedDrawdownPercent(double value) {
|
||||||
|
//
|
||||||
|
if (value < 0) {
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (value > 50) {
|
||||||
|
value = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mMaxAllowedDrawdownPercent = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hedging ...
|
// Hedging ...
|
||||||
|
|
||||||
@@ -3891,9 +3981,28 @@ public:
|
|||||||
cConditions.Clean();
|
cConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
cHasSignal = !useCMarket ? false : mSetups[i].ProcessMarket(cSignal, cConditions, cPusher, cProvider, cTP, cSL, X_MARKET_CYCLE_UNKNOWN, canSupport, allowLong, allowShort, volume, slPoint, ignoreSL, tpPoint, ignoreTP, 0,
|
cHasSignal =
|
||||||
5 //
|
!useCMarket
|
||||||
);
|
? false
|
||||||
|
: mSetups[i].ProcessMarket(
|
||||||
|
cSignal,
|
||||||
|
cConditions,
|
||||||
|
cPusher,
|
||||||
|
cProvider,
|
||||||
|
cTP,
|
||||||
|
cSL,
|
||||||
|
X_MARKET_CYCLE_UNKNOWN,
|
||||||
|
canSupport,
|
||||||
|
allowLong,
|
||||||
|
allowShort,
|
||||||
|
volume,
|
||||||
|
slPoint,
|
||||||
|
ignoreSL,
|
||||||
|
tpPoint,
|
||||||
|
ignoreTP,
|
||||||
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Short Market ...
|
// Short Market ...
|
||||||
@@ -3906,9 +4015,28 @@ public:
|
|||||||
sConditions.Clean();
|
sConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
sHasSignal = !useSMarket ? false : mSetups[i].ProcessMarket(sSignal, sConditions, sPusher, sProvider, sTP, sSL, X_MARKET_CYCLE_SHORT, canSupport, allowLong, allowShort, volume, slPoint, ignoreSL, tpPoint, ignoreTP, 0,
|
sHasSignal =
|
||||||
5 //
|
!useSMarket
|
||||||
);
|
? false
|
||||||
|
: mSetups[i].ProcessMarket(
|
||||||
|
sSignal,
|
||||||
|
sConditions,
|
||||||
|
sPusher,
|
||||||
|
sProvider,
|
||||||
|
sTP,
|
||||||
|
sSL,
|
||||||
|
X_MARKET_CYCLE_SHORT,
|
||||||
|
canSupport,
|
||||||
|
allowLong,
|
||||||
|
allowShort,
|
||||||
|
volume,
|
||||||
|
slPoint,
|
||||||
|
ignoreSL,
|
||||||
|
tpPoint,
|
||||||
|
ignoreTP,
|
||||||
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Medium Market ...
|
// Medium Market ...
|
||||||
@@ -3921,9 +4049,27 @@ public:
|
|||||||
mConditions.Clean();
|
mConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
mHasSignal = !useMMarket ? false : mSetups[i].ProcessMarket(mSignal, mConditions, mPusher, mProvider, mTP, mSL, X_MARKET_CYCLE_MEDIUM, canSupport, allowLong, allowShort, volume, slPoint, ignoreSL, tpPoint, ignoreTP, 0,
|
mHasSignal = !useMMarket
|
||||||
5 //
|
? false
|
||||||
);
|
: mSetups[i].ProcessMarket(
|
||||||
|
mSignal,
|
||||||
|
mConditions,
|
||||||
|
mPusher,
|
||||||
|
mProvider,
|
||||||
|
mTP,
|
||||||
|
mSL,
|
||||||
|
X_MARKET_CYCLE_MEDIUM,
|
||||||
|
canSupport,
|
||||||
|
allowLong,
|
||||||
|
allowShort,
|
||||||
|
volume,
|
||||||
|
slPoint,
|
||||||
|
ignoreSL,
|
||||||
|
tpPoint,
|
||||||
|
ignoreTP,
|
||||||
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Long Market ...
|
// Long Market ...
|
||||||
@@ -3936,9 +4082,27 @@ public:
|
|||||||
lConditions.Clean();
|
lConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
lHasSignal = !useLMarket ? false : mSetups[i].ProcessMarket(lSignal, lConditions, lPusher, lProvider, lTP, lSL, X_MARKET_CYCLE_LONG, canSupport, allowLong, allowShort, volume, slPoint, ignoreSL, tpPoint, ignoreTP, 0,
|
lHasSignal = !useLMarket
|
||||||
5 //
|
? false
|
||||||
);
|
: mSetups[i].ProcessMarket(
|
||||||
|
lSignal,
|
||||||
|
lConditions,
|
||||||
|
lPusher,
|
||||||
|
lProvider,
|
||||||
|
lTP,
|
||||||
|
lSL,
|
||||||
|
X_MARKET_CYCLE_LONG,
|
||||||
|
canSupport,
|
||||||
|
allowLong,
|
||||||
|
allowShort,
|
||||||
|
volume,
|
||||||
|
slPoint,
|
||||||
|
ignoreSL,
|
||||||
|
tpPoint,
|
||||||
|
ignoreTP,
|
||||||
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hind Market ...
|
// Hind Market ...
|
||||||
@@ -3951,9 +4115,27 @@ public:
|
|||||||
hConditions.Clean();
|
hConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
hHasSignal = !useHMarket ? false : mSetups[i].ProcessMarket(hSignal, hConditions, hPusher, hProvider, hTP, hSL, X_MARKET_CYCLE_HIND, canSupport, allowLong, allowShort, volume, slPoint, ignoreSL, tpPoint, ignoreTP, 0,
|
hHasSignal = !useHMarket
|
||||||
5 //
|
? false
|
||||||
);
|
: mSetups[i].ProcessMarket(
|
||||||
|
hSignal,
|
||||||
|
hConditions,
|
||||||
|
hPusher,
|
||||||
|
hProvider,
|
||||||
|
hTP,
|
||||||
|
hSL,
|
||||||
|
X_MARKET_CYCLE_HIND,
|
||||||
|
canSupport,
|
||||||
|
allowLong,
|
||||||
|
allowShort,
|
||||||
|
volume,
|
||||||
|
slPoint,
|
||||||
|
ignoreSL,
|
||||||
|
tpPoint,
|
||||||
|
ignoreTP,
|
||||||
|
0,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse Signals and Add them for Executing ...
|
// Parse Signals and Add them for Executing ...
|
||||||
@@ -3982,14 +4164,6 @@ public:
|
|||||||
mConditions,
|
mConditions,
|
||||||
otherConditions //
|
otherConditions //
|
||||||
);
|
);
|
||||||
// AddRef(
|
|
||||||
// lConditions,
|
|
||||||
// otherConditions //
|
|
||||||
// );
|
|
||||||
// AddRef(
|
|
||||||
// hConditions,
|
|
||||||
// otherConditions //
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4007,14 +4181,6 @@ public:
|
|||||||
mConditions,
|
mConditions,
|
||||||
otherConditions //
|
otherConditions //
|
||||||
);
|
);
|
||||||
// AddRef(
|
|
||||||
// lConditions,
|
|
||||||
// otherConditions //
|
|
||||||
// );
|
|
||||||
// AddRef(
|
|
||||||
// hConditions,
|
|
||||||
// otherConditions //
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4041,10 +4207,6 @@ public:
|
|||||||
signal = lSignal;
|
signal = lSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
// AddRef(
|
|
||||||
// cConditions,
|
|
||||||
// otherConditions //
|
|
||||||
// );
|
|
||||||
AddRef(
|
AddRef(
|
||||||
mConditions,
|
mConditions,
|
||||||
otherConditions //
|
otherConditions //
|
||||||
@@ -4095,13 +4257,18 @@ public:
|
|||||||
bool isValid =
|
bool isValid =
|
||||||
//
|
//
|
||||||
// Handle Pusher Validations ...
|
// Handle Pusher Validations ...
|
||||||
(mReuiredSignalVerifications <= 0 ? true : pushers >= mReuiredSignalVerifications)
|
(mReuiredSignalVerifications <= 0
|
||||||
|
? true
|
||||||
|
: pushers >= mReuiredSignalVerifications)
|
||||||
//
|
//
|
||||||
&&
|
&&
|
||||||
//
|
//
|
||||||
// Handle Other Conditions Validations ...
|
// Handle Other Conditions Validations ...
|
||||||
(!mGetVerificationFromOtherTimeFrames ? true : isLong ? signalGenerator.HasLongVerifications(otherConditions)
|
(!mGetVerificationFromOtherTimeFrames
|
||||||
: signalGenerator.HasShortVerifications(otherConditions))
|
? true
|
||||||
|
: isLong
|
||||||
|
? signalGenerator.HasLongVerifications(otherConditions)
|
||||||
|
: signalGenerator.HasShortVerifications(otherConditions))
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -4110,7 +4277,7 @@ public:
|
|||||||
bool forceState = mForce;
|
bool forceState = mForce;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!forceState)
|
if (isValid && !forceState)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Add Signal to Execution Result ...
|
// Add Signal to Execution Result ...
|
||||||
@@ -4272,16 +4439,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// TODO: Remove this ...
|
|
||||||
// isSignalValid = !AllowSupport()
|
|
||||||
// ? true
|
|
||||||
// : IsValidSize(ArraySize(iSignal.supports));
|
|
||||||
// if (!isSignalValid)
|
|
||||||
// {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Filter Signals Based On Max Allowed ...
|
// Filter Signals Based On Max Allowed ...
|
||||||
if (maxAllowed > 0)
|
if (maxAllowed > 0)
|
||||||
@@ -4289,7 +4446,9 @@ public:
|
|||||||
//
|
//
|
||||||
// Here we Get Opposite Signals of Same Symbol Valid ...
|
// Here we Get Opposite Signals of Same Symbol Valid ...
|
||||||
ENUM_X_POSITION_TYPES iType =
|
ENUM_X_POSITION_TYPES iType =
|
||||||
perDirection ? ToPositionType(iSignal.type) : X_POSITION_TYPE_ALL;
|
perDirection
|
||||||
|
? ToPositionType(iSignal.type)
|
||||||
|
: X_POSITION_TYPE_ALL;
|
||||||
XPosition iSymbolsPositions[];
|
XPosition iSymbolsPositions[];
|
||||||
int iSymbolsPositionsCount = mTrader.GetPositions(
|
int iSymbolsPositionsCount = mTrader.GetPositions(
|
||||||
iSymbolsPositions,
|
iSymbolsPositions,
|
||||||
@@ -4315,7 +4474,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
isSignalValid =
|
isSignalValid =
|
||||||
iSupportsCount <= 0 ? iSymbolsPositionsCount < maxAllowed : iSymbolsPositionsCount - iSupportsCount < maxAllowed;
|
iSupportsCount <= 0
|
||||||
|
? iSymbolsPositionsCount < maxAllowed
|
||||||
|
: iSymbolsPositionsCount - iSupportsCount < maxAllowed;
|
||||||
if (!isSignalValid)
|
if (!isSignalValid)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -4448,7 +4609,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
int multiplier =
|
int multiplier =
|
||||||
iSupportsCount <= 0 ? iSymbolsPositionsCount : iSymbolsPositionsCount - iSupportsCount;
|
iSupportsCount <= 0
|
||||||
|
? iSymbolsPositionsCount
|
||||||
|
: iSymbolsPositionsCount - iSupportsCount;
|
||||||
if (multiplier <= 0)
|
if (multiplier <= 0)
|
||||||
{
|
{
|
||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
@@ -4493,6 +4656,9 @@ public:
|
|||||||
signals //
|
signals //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(eSignals);
|
||||||
|
|
||||||
//
|
//
|
||||||
HandleSignals(signals);
|
HandleSignals(signals);
|
||||||
}
|
}
|
||||||
@@ -4646,13 +4812,22 @@ protected:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isStartHourPassed =
|
bool isStartHourPassed =
|
||||||
startHour <= -1 ? true : cTime.hour >= startHour;
|
startHour <= -1
|
||||||
|
? true
|
||||||
|
: cTime.hour >= startHour;
|
||||||
bool isEndHourPassed =
|
bool isEndHourPassed =
|
||||||
endHour <= -1 ? true : cTime.hour < endHour;
|
endHour <= -1
|
||||||
bool isTimePassed = isTimeRecieved && isStartHourPassed && isEndHourPassed;
|
? true
|
||||||
|
: cTime.hour < endHour;
|
||||||
|
bool isTimePassed =
|
||||||
|
isTimeRecieved &&
|
||||||
|
isStartHourPassed &&
|
||||||
|
isEndHourPassed;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isTypePassed && isTimePassed;
|
result =
|
||||||
|
isTypePassed &&
|
||||||
|
isTimePassed;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -4665,7 +4840,9 @@ protected:
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = mCloseOnSpecificTime >= 0 && mCloseOnSpecificTime <= 23;
|
result =
|
||||||
|
mCloseOnSpecificTime >= 0 &&
|
||||||
|
mCloseOnSpecificTime <= 23;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -4814,7 +4991,9 @@ protected:
|
|||||||
double minFreeMargingForHandleForce = MinFreeMargingForOpenTrades();
|
double minFreeMargingForHandleForce = MinFreeMargingForOpenTrades();
|
||||||
|
|
||||||
//
|
//
|
||||||
bool result = minFreeMargingForHandleForce <= 0 ? true : freeMargin >= minFreeMargingForHandleForce;
|
bool result = minFreeMargingForHandleForce <= 0
|
||||||
|
? true
|
||||||
|
: freeMargin >= minFreeMargingForHandleForce;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -4827,11 +5006,13 @@ protected:
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
double maxAllowedDrawdownPercent = 5; // MaxAllowedDrawdownPercent();
|
double maxAllowedDrawdownPercent = MaxAllowedDrawdownPercent();
|
||||||
double drawdownPercent = GetDrawdownPercent();
|
double drawdownPercent = GetDrawdownPercent();
|
||||||
|
|
||||||
//
|
//
|
||||||
result = maxAllowedDrawdownPercent <= 0 ? true : drawdownPercent <= maxAllowedDrawdownPercent;
|
result = maxAllowedDrawdownPercent <= 0
|
||||||
|
? true
|
||||||
|
: drawdownPercent <= maxAllowedDrawdownPercent;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -5251,6 +5432,7 @@ private:
|
|||||||
bool mForce; // Determine in Force State or not
|
bool mForce; // Determine in Force State or not
|
||||||
int mDelayBetweenTwoSignal; // Delay between two same signal
|
int mDelayBetweenTwoSignal; // Delay between two same signal
|
||||||
double mMinFreeMargingForOpenTrades; // Min Free Margin for Open Trades
|
double mMinFreeMargingForOpenTrades; // Min Free Margin for Open Trades
|
||||||
|
double mMaxAllowedDrawdownPercent; // Max Allowed Drawdown for Open Trades
|
||||||
|
|
||||||
//
|
//
|
||||||
XSCX121SetupCycles *mSetups[]; // Number of Setups
|
XSCX121SetupCycles *mSetups[]; // Number of Setups
|
||||||
@@ -5321,6 +5503,10 @@ private:
|
|||||||
RecoveryVolumeMultiplier(0.01);
|
RecoveryVolumeMultiplier(0.01);
|
||||||
MaxAllowedRecoveryVolume(0.08);
|
MaxAllowedRecoveryVolume(0.08);
|
||||||
|
|
||||||
|
//
|
||||||
|
MaxAllowedDrawdownPercent(5);
|
||||||
|
MinFreeMargingForOpenTrades(0);
|
||||||
|
|
||||||
//
|
//
|
||||||
SaveResults(false);
|
SaveResults(false);
|
||||||
SaveSignalsOnly(true);
|
SaveSignalsOnly(true);
|
||||||
@@ -5360,7 +5546,9 @@ private:
|
|||||||
X121SetupInputs iInputs = iSetup.GetInputs();
|
X121SetupInputs iInputs = iSetup.GetInputs();
|
||||||
|
|
||||||
//
|
//
|
||||||
if (iInputs.symbol == symbol && iInputs.period == period)
|
if (
|
||||||
|
iInputs.symbol == symbol &&
|
||||||
|
iInputs.period == period)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
result = i;
|
result = i;
|
||||||
|
|||||||
@@ -47,15 +47,15 @@ input bool x121EAUseAllWatchListSymbols = false;
|
|||||||
//
|
//
|
||||||
// Signals ...
|
// Signals ...
|
||||||
input group "Signals";
|
input group "Signals";
|
||||||
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 x121EAStartSignallingHoure = 3; // Start Signalling at Specific Time
|
input int x121EAStartSignallingHoure = 3; // Start Signalling at Specific Time
|
||||||
input int x121EAEndSignallingHoure = 22; // End Signalling at Specific Time
|
input int x121EAEndSignallingHoure = 22; // End Signalling at Specific Time
|
||||||
input int x121EACloseOnSpecificTime = -1; // Close All Trades in Specific Time
|
input int x121EACloseOnSpecificTime = -1; // Close All Trades in Specific Time
|
||||||
input int x121EADelayBetweenTwoSignal = 10; // Delay Between two Same Signals
|
input int x121EADelayBetweenTwoSignal = 5; // Delay Between two Same Signals
|
||||||
input int x121EAReuiredSignalVerifications = 4; // Required Verifications for Signals
|
input int x121EAReuiredSignalVerifications = 10; // Required Verifications for Signals
|
||||||
input bool x121EAExecuteSignalsOnBreakout = false; // Execute Signals On Breakouts
|
input bool x121EAExecuteSignalsOnBreakout = false; // Execute Signals On Breakouts
|
||||||
input bool x121EAGetVerificationFromOtherTimeFrames = true; // Get Verifications from Other Time Frames
|
input bool x121EAGetVerificationFromOtherTimeFrames = true; // Get Verifications from Other Time Frames
|
||||||
|
|
||||||
//
|
//
|
||||||
// Risk Management ...
|
// Risk Management ...
|
||||||
@@ -63,19 +63,19 @@ input group "Risk Management";
|
|||||||
input double x121EAVolume = 0.01; // Static Volume
|
input double x121EAVolume = 0.01; // Static Volume
|
||||||
input double x121EATPPoint = 1000; // TP Point
|
input double x121EATPPoint = 1000; // TP Point
|
||||||
input double x121EASLPoint = 1000; // SL Point
|
input double x121EASLPoint = 1000; // SL Point
|
||||||
input bool x121EAIgnoreSL = false; // Ignore Calculated SL
|
input bool x121EAIgnoreSL = true; // Ignore Calculated SL
|
||||||
input bool x121EAIgnoreTP = false; // Ignore Calculated TP
|
input bool x121EAIgnoreTP = true; // Ignore Calculated TP
|
||||||
input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
|
input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
|
||||||
input int x121EAMaxAllowedTrades = 2; // Max Allowed Positions Per Symbol
|
input int x121EAMaxAllowedTrades = 0; // Max Allowed Positions Per Symbol
|
||||||
input bool x121EAUseMaxAllowedPerDirection = true; // Use Max Allowed Positions Per Direction
|
input bool x121EAUseMaxAllowedPerDirection = true; // Use Max Allowed Positions Per Direction
|
||||||
input int x121EAMinFreeMargingForOpenTrades = 900; // Min Margin For Opening Trades
|
input int x121EAMaxAllowedDrawdownPercent = 5; // Max Allowed Drawdown for Open Trades
|
||||||
input bool x121EAIncreaseNextSignalsVolume = true; // Increase Next Signals Volume
|
input bool x121EAIncreaseNextSignalsVolume = true; // Increase Next Signals Volume
|
||||||
input double x121EAIncreaseNextSignalsVolumeMultiplier = 1; // Increase Next Signals Volume Multiplier
|
input double x121EAIncreaseNextSignalsVolumeMultiplier = 1; // Increase Next Signals Volume Multiplier
|
||||||
input bool x121EAAcceptNextDirectionalSignalsWhenFirstInProfit = true; // Accept Same Symbol/Type Signal when Last in Profit
|
input bool x121EAAcceptNextDirectionalSignalsWhenFirstInProfit = true; // Accept Same Symbol/Type Signal when Last in Profit
|
||||||
|
|
||||||
//
|
//
|
||||||
input group "Trailling";
|
input group "Trailling";
|
||||||
input bool x121EAAllowTrailStop = true; // Enable Trailling Stop Losses
|
input bool x121EAAllowTrailStop = false; // Enable Trailling Stop Losses
|
||||||
input bool x121EADisableTrailingWhenOpposit = true; // Disable Trailling When has Opposite In Drawdown
|
input bool x121EADisableTrailingWhenOpposit = true; // Disable Trailling When has Opposite In Drawdown
|
||||||
input double x121EAFirstTrailDistance = 100; // Start Trailling Distance
|
input double x121EAFirstTrailDistance = 100; // Start Trailling Distance
|
||||||
input double x121EAFirstTrailPoint = 60; // First Stop Trail
|
input double x121EAFirstTrailPoint = 60; // First Stop Trail
|
||||||
@@ -112,7 +112,7 @@ input double x121EAMaxAllowedRecoveryVolume = 0; // Max Allowed Recovery Signals
|
|||||||
//
|
//
|
||||||
input group "Hedging";
|
input group "Hedging";
|
||||||
input int x121EARestingAfterHedge = 1000; // Resting Seconds After Hedge
|
input int x121EARestingAfterHedge = 1000; // Resting Seconds After Hedge
|
||||||
input double x121EAMinRequiredProfitPerTrade = 0.3; // Minimum Required Profit for Hedging
|
input double x121EAMinRequiredProfitPerTrade = 2.5; // 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
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -326,7 +326,7 @@ bool InitialEA()
|
|||||||
x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades);
|
x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades);
|
||||||
x121EA.IncreaseNextSignalsVolume(x121EAIncreaseNextSignalsVolume);
|
x121EA.IncreaseNextSignalsVolume(x121EAIncreaseNextSignalsVolume);
|
||||||
x121EA.UseMaxAllowedPerDirection(x121EAUseMaxAllowedPerDirection);
|
x121EA.UseMaxAllowedPerDirection(x121EAUseMaxAllowedPerDirection);
|
||||||
x121EA.MinFreeMargingForOpenTrades(x121EAMinFreeMargingForOpenTrades);
|
x121EA.MaxAllowedDrawdownPercent(x121EAMaxAllowedDrawdownPercent);
|
||||||
x121EA.IncreaseNextSignalsVolumeMultiplier(x121EAIncreaseNextSignalsVolumeMultiplier);
|
x121EA.IncreaseNextSignalsVolumeMultiplier(x121EAIncreaseNextSignalsVolumeMultiplier);
|
||||||
x121EA.AcceptNextDirectionalSignalsWhenFirstInProfit(x121EAAcceptNextDirectionalSignalsWhenFirstInProfit);
|
x121EA.AcceptNextDirectionalSignalsWhenFirstInProfit(x121EAAcceptNextDirectionalSignalsWhenFirstInProfit);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user