last works on GUI and also Comment Freezing and Supporting Properties and Functionality ...
This commit is contained in:
@@ -1194,176 +1194,176 @@ class X121SCTradeHandler : public XSCBaseAlert
|
|||||||
//
|
//
|
||||||
// In Drawdown Positions Protecting ...
|
// In Drawdown Positions Protecting ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Freeze ...
|
// // Freeze ...
|
||||||
bool AllowFreeze()
|
// bool AllowFreeze()
|
||||||
{
|
// {
|
||||||
return mAllowFreeze;
|
// return mAllowFreeze;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void AllowFreeze(bool value)
|
// void AllowFreeze(bool value)
|
||||||
{
|
// {
|
||||||
mAllowFreeze = value;
|
// mAllowFreeze = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
double FreezeDistance()
|
// double FreezeDistance()
|
||||||
{
|
// {
|
||||||
return mFreezeDistance;
|
// return mFreezeDistance;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void FreezeDistance(double value)
|
// void FreezeDistance(double value)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
if (value < 0)
|
// if (value < 0)
|
||||||
{
|
// {
|
||||||
value = 0;
|
// value = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
mFreezeDistance = value;
|
// mFreezeDistance = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool RemoveFreezedPositionTPSL()
|
// bool RemoveFreezedPositionTPSL()
|
||||||
{
|
// {
|
||||||
return mRemoveFreezedPositionTPSL;
|
// return mRemoveFreezedPositionTPSL;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void RemoveFreezedPositionTPSL(bool value)
|
// void RemoveFreezedPositionTPSL(bool value)
|
||||||
{
|
// {
|
||||||
mRemoveFreezedPositionTPSL = value;
|
// mRemoveFreezedPositionTPSL = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool DisableTrailWhenFreezedPosition()
|
// bool DisableTrailWhenFreezedPosition()
|
||||||
{
|
// {
|
||||||
return mDisableTrailWhenFreezedPosition;
|
// return mDisableTrailWhenFreezedPosition;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void DisableTrailWhenFreezedPosition(bool value)
|
// void DisableTrailWhenFreezedPosition(bool value)
|
||||||
{
|
// {
|
||||||
mDisableTrailWhenFreezedPosition = value;
|
// mDisableTrailWhenFreezedPosition = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support ...
|
// Support ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool AllowSupport()
|
// bool AllowSupport()
|
||||||
{
|
// {
|
||||||
return mAllowSupport;
|
// return mAllowSupport;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void AllowSupport(bool value)
|
// void AllowSupport(bool value)
|
||||||
{
|
// {
|
||||||
mAllowSupport = value;
|
// mAllowSupport = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
double SupportStartDistance()
|
// double SupportStartDistance()
|
||||||
{
|
// {
|
||||||
return mSupportStartDistance;
|
// return mSupportStartDistance;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void SupportStartDistance(double value)
|
// void SupportStartDistance(double value)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
if (value < 0)
|
// if (value < 0)
|
||||||
{
|
// {
|
||||||
value = 0;
|
// value = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
mSupportStartDistance = value;
|
// mSupportStartDistance = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
int MaxAllowedSupport()
|
// int MaxAllowedSupport()
|
||||||
{
|
// {
|
||||||
return mMaxAllowedSupport;
|
// return mMaxAllowedSupport;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void MaxAllowedSupport(int value)
|
// void MaxAllowedSupport(int value)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
if (value < 0)
|
// if (value < 0)
|
||||||
{
|
// {
|
||||||
value = 0;
|
// value = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
mMaxAllowedSupport = value;
|
// mMaxAllowedSupport = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
double SupportVolumeMultiplier()
|
// double SupportVolumeMultiplier()
|
||||||
{
|
// {
|
||||||
return mSupportVolumeMultiplier;
|
// return mSupportVolumeMultiplier;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void SupportVolumeMultiplier(double value)
|
// void SupportVolumeMultiplier(double value)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
if (value < 0)
|
// if (value < 0)
|
||||||
{
|
// {
|
||||||
value = 0;
|
// value = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
mSupportVolumeMultiplier = value;
|
// mSupportVolumeMultiplier = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool MultiplySupportLevelOnVolume()
|
// bool MultiplySupportLevelOnVolume()
|
||||||
{
|
// {
|
||||||
return mMultiplySupportLevelOnVolume;
|
// return mMultiplySupportLevelOnVolume;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void MultiplySupportLevelOnVolume(bool value)
|
// void MultiplySupportLevelOnVolume(bool value)
|
||||||
{
|
// {
|
||||||
mMultiplySupportLevelOnVolume = value;
|
// mMultiplySupportLevelOnVolume = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool DoSupportOnConditions()
|
// bool DoSupportOnConditions()
|
||||||
{
|
// {
|
||||||
return mDoSupportOnConditions;
|
// return mDoSupportOnConditions;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void DoSupportOnConditions(bool value)
|
// void DoSupportOnConditions(bool value)
|
||||||
{
|
// {
|
||||||
mDoSupportOnConditions = value;
|
// mDoSupportOnConditions = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
int DelayBetweenTwoSupport()
|
// int DelayBetweenTwoSupport()
|
||||||
{
|
// {
|
||||||
return mDelayBetweenTwoSupport;
|
// return mDelayBetweenTwoSupport;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
void DelayBetweenTwoSupport(int value)
|
// void DelayBetweenTwoSupport(int value)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
if (value < 0)
|
// if (value < 0)
|
||||||
{
|
// {
|
||||||
value = 0;
|
// value = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
mDelayBetweenTwoSupport = value;
|
// mDelayBetweenTwoSupport = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Partial Close (In Drawdown) ...
|
// Partial Close (In Drawdown) ...
|
||||||
@@ -2649,42 +2649,44 @@ class X121SCTradeHandler : public XSCBaseAlert
|
|||||||
// Reading Requirement for Freezing Positions ...
|
// Reading Requirement for Freezing Positions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool allowFreeze = AllowFreeze();
|
// bool allowFreeze = AllowFreeze();
|
||||||
double freezeDistance = FreezeDistance();
|
// double freezeDistance = FreezeDistance();
|
||||||
bool removeFreezedPositionTPSL = RemoveFreezedPositionTPSL();
|
// bool removeFreezedPositionTPSL = RemoveFreezedPositionTPSL();
|
||||||
bool canFreeze = allowFreeze &&
|
// bool canFreeze = allowFreeze &&
|
||||||
!isInProfit &&
|
// !isInProfit &&
|
||||||
profitInPoint < 0 &&
|
// profitInPoint < 0 &&
|
||||||
freezeDistance > 0 &&
|
// freezeDistance > 0 &&
|
||||||
!mData[iDX].freezed &&
|
// !mData[iDX].freezed &&
|
||||||
MathAbs(profitInPoint) >= freezeDistance;
|
// MathAbs(profitInPoint) >= freezeDistance;
|
||||||
|
bool canFreeze = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reading Requirement for Support Positions ...
|
// Reading Requirement for Support Positions ...
|
||||||
bool allowSupport = AllowSupport();
|
// bool allowSupport = AllowSupport();
|
||||||
double supportStartDistance = SupportStartDistance();
|
// double supportStartDistance = SupportStartDistance();
|
||||||
int maxAllowedSupport = MaxAllowedSupport();
|
// int maxAllowedSupport = MaxAllowedSupport();
|
||||||
int delayBetweenTwoSupport = DelayBetweenTwoSupport();
|
// int delayBetweenTwoSupport = DelayBetweenTwoSupport();
|
||||||
double supportVolumeMultiplier = SupportVolumeMultiplier();
|
// double supportVolumeMultiplier = SupportVolumeMultiplier();
|
||||||
bool multiplySupportLevelOnVolume = MultiplySupportLevelOnVolume();
|
// bool multiplySupportLevelOnVolume = MultiplySupportLevelOnVolume();
|
||||||
bool doSupportOnConditions = DoSupportOnConditions();
|
// bool doSupportOnConditions = DoSupportOnConditions();
|
||||||
bool canSupport = allowSupport &&
|
// bool canSupport = allowSupport &&
|
||||||
(!isInProfit ||
|
// (!isInProfit ||
|
||||||
(isInProfit && supportsCount > 0)) &&
|
// (isInProfit && supportsCount > 0)) &&
|
||||||
maxAllowedSupport >= 0 &&
|
// maxAllowedSupport >= 0 &&
|
||||||
supportStartDistance >= 0 &&
|
// supportStartDistance >= 0 &&
|
||||||
supportVolumeMultiplier > 0 &&
|
// supportVolumeMultiplier > 0 &&
|
||||||
MathAbs(profitInPoint) >= supportStartDistance &&
|
// MathAbs(profitInPoint) >= supportStartDistance &&
|
||||||
//
|
// //
|
||||||
// Check Max Allowed Support ...
|
// // Check Max Allowed Support ...
|
||||||
(maxAllowedSupport == 0
|
// (maxAllowedSupport == 0
|
||||||
? true
|
// ? true
|
||||||
: supportsCount < maxAllowedSupport) &&
|
// : supportsCount < maxAllowedSupport) &&
|
||||||
//
|
// //
|
||||||
// Check Delay ...
|
// // Check Delay ...
|
||||||
(!IsValid(mData[iDX].lastSupportedOn)
|
// (!IsValid(mData[iDX].lastSupportedOn)
|
||||||
? true
|
// ? true
|
||||||
: (TimeToSeconds(currentTime) - TimeToSeconds(mData[iDX].lastSupportedOn)) >= ulong(delayBetweenTwoSupport));
|
// : (TimeToSeconds(currentTime) - TimeToSeconds(mData[iDX].lastSupportedOn)) >= ulong(delayBetweenTwoSupport));
|
||||||
|
bool canSupport = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
@@ -2988,204 +2990,204 @@ class X121SCTradeHandler : public XSCBaseAlert
|
|||||||
//
|
//
|
||||||
// Freeze ...
|
// Freeze ...
|
||||||
bool isFreezed = false;
|
bool isFreezed = false;
|
||||||
if (canFreeze)
|
// if (canFreeze)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
// Temparory Requirement for Recover Signal ...
|
// // Temparory Requirement for Recover Signal ...
|
||||||
double sl = removeFreezedPositionTPSL ? 0 : position.tp;
|
// double sl = removeFreezedPositionTPSL ? 0 : position.tp;
|
||||||
double tp = removeFreezedPositionTPSL ? 0 : position.sl;
|
// double tp = removeFreezedPositionTPSL ? 0 : position.sl;
|
||||||
ENUM_POSITION_TYPE type = isLong
|
// ENUM_POSITION_TYPE type = isLong
|
||||||
? POSITION_TYPE_SELL
|
// ? POSITION_TYPE_SELL
|
||||||
: POSITION_TYPE_BUY;
|
// : POSITION_TYPE_BUY;
|
||||||
double entry = GetEntry(
|
// double entry = GetEntry(
|
||||||
position.symbol,
|
// position.symbol,
|
||||||
type //
|
// type //
|
||||||
);
|
// );
|
||||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
// ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Prepare Signal ...
|
// // Prepare Signal ...
|
||||||
XSignal signal;
|
// XSignal signal;
|
||||||
bool isPrepared = signal.Prepare(
|
// bool isPrepared = signal.Prepare(
|
||||||
position.symbol,
|
// position.symbol,
|
||||||
position.provider,
|
// position.provider,
|
||||||
position.period,
|
// position.period,
|
||||||
type,
|
// type,
|
||||||
mode,
|
// mode,
|
||||||
entry,
|
// entry,
|
||||||
position.volume,
|
// position.volume,
|
||||||
sl,
|
// sl,
|
||||||
tp //
|
// tp //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (isPrepared)
|
// if (isPrepared)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
// Generate Comment for Recover and Support ...
|
// // Generate Comment for Recover and Support ...
|
||||||
string comment = GenerateSupportTag(position.ticket);
|
// string comment = GenerateSupportTag(position.ticket);
|
||||||
|
|
||||||
//
|
// //
|
||||||
signal.comment = comment;
|
// signal.comment = comment;
|
||||||
|
|
||||||
//
|
// //
|
||||||
ENUM_X_SIGNAL_EXECUTION_RESULT state;
|
// ENUM_X_SIGNAL_EXECUTION_RESULT state;
|
||||||
bool isFreezed = ExecuteSignal(
|
// bool isFreezed = ExecuteSignal(
|
||||||
signal,
|
// signal,
|
||||||
state,
|
// state,
|
||||||
true // Support Signal need to Ignore Policies ...
|
// true // Support Signal need to Ignore Policies ...
|
||||||
);
|
// );
|
||||||
if (isFreezed)
|
// if (isFreezed)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
mData[iDX].freezed = true;
|
// mData[iDX].freezed = true;
|
||||||
|
|
||||||
//
|
// //
|
||||||
string message = "EQM Open " + (IsLong(type) ? "Long" : "Short") + " Freeze Position for (" + ToString(position.ticket) + ") ...";
|
// string message = "EQM Open " + (IsLong(type) ? "Long" : "Short") + " Freeze Position for (" + ToString(position.ticket) + ") ...";
|
||||||
Alert(message);
|
// Alert(message);
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (removeFreezedPositionTPSL)
|
// if (removeFreezedPositionTPSL)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
string comment = "EQM Removes Freezed TP/SL ...";
|
// string comment = "EQM Removes Freezed TP/SL ...";
|
||||||
bool isModified = mTrader.Modify(
|
// bool isModified = mTrader.Modify(
|
||||||
position.ticket,
|
// position.ticket,
|
||||||
0,
|
// 0,
|
||||||
0,
|
// 0,
|
||||||
comment //
|
// comment //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (isModified)
|
// if (isModified)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
string message = "EQM Remove Freezed Position (" + ToString(position.ticket) + ") TP/SL ...";
|
// string message = "EQM Remove Freezed Position (" + ToString(position.ticket) + ") TP/SL ...";
|
||||||
Alert(message);
|
// Alert(message);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support ...
|
// Support ...
|
||||||
bool isSupported = false;
|
bool isSupported = false;
|
||||||
if (canSupport)
|
// if (canSupport)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
// supportsCount
|
// // supportsCount
|
||||||
// bool isDistancePassed =
|
// // bool isDistancePassed =
|
||||||
// supportStartDistance <= 0
|
// // supportStartDistance <= 0
|
||||||
// ? true
|
// // ? true
|
||||||
// : mData[iDX].lastSupportDistance < 0
|
// // : mData[iDX].lastSupportDistance < 0
|
||||||
// ? profitInPoint < 0 && (true)
|
// // ? profitInPoint < 0 && (true)
|
||||||
// : profitInPoint > 0 && (true);
|
// // : profitInPoint > 0 && (true);
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasLongSupportCondition = !doSupportOnConditions
|
// bool hasLongSupportCondition = !doSupportOnConditions
|
||||||
? true
|
// ? true
|
||||||
: (isTicksBullishForLong &&
|
// : (isTicksBullishForLong &&
|
||||||
hasBullishConditions);
|
// hasBullishConditions);
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasShortSupportConditions = !doSupportOnConditions
|
// bool hasShortSupportConditions = !doSupportOnConditions
|
||||||
? true
|
// ? true
|
||||||
: (isTicksBearishForShort &&
|
// : (isTicksBearishForShort &&
|
||||||
hasBearishConditions);
|
// hasBearishConditions);
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasSupportConditions =
|
// bool hasSupportConditions =
|
||||||
!doSupportOnConditions
|
// !doSupportOnConditions
|
||||||
? true
|
// ? true
|
||||||
: (hasLongSupportCondition ||
|
// : (hasLongSupportCondition ||
|
||||||
hasShortSupportConditions);
|
// hasShortSupportConditions);
|
||||||
if (hasSupportConditions)
|
// if (hasSupportConditions)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
// Temparory Requirement for Recover Signal ...
|
// // Temparory Requirement for Recover Signal ...
|
||||||
double sl =
|
// double sl =
|
||||||
isLong
|
// isLong
|
||||||
? hasLongSupportCondition
|
// ? hasLongSupportCondition
|
||||||
? position.sl
|
// ? position.sl
|
||||||
: position.tp
|
// : position.tp
|
||||||
: hasLongSupportCondition
|
// : hasLongSupportCondition
|
||||||
? position.tp
|
// ? position.tp
|
||||||
: position.sl;
|
// : position.sl;
|
||||||
double tp =
|
// double tp =
|
||||||
isLong
|
// isLong
|
||||||
? hasLongSupportCondition
|
// ? hasLongSupportCondition
|
||||||
? position.tp
|
// ? position.tp
|
||||||
: position.sl
|
// : position.sl
|
||||||
: hasLongSupportCondition
|
// : hasLongSupportCondition
|
||||||
? position.sl
|
// ? position.sl
|
||||||
: position.tp;
|
// : position.tp;
|
||||||
ENUM_POSITION_TYPE type =
|
// ENUM_POSITION_TYPE type =
|
||||||
hasLongSupportCondition
|
// hasLongSupportCondition
|
||||||
? POSITION_TYPE_BUY
|
// ? POSITION_TYPE_BUY
|
||||||
: POSITION_TYPE_SELL;
|
// : POSITION_TYPE_SELL;
|
||||||
double entry = GetEntry(
|
// double entry = GetEntry(
|
||||||
position.symbol,
|
// position.symbol,
|
||||||
type //
|
// type //
|
||||||
);
|
// );
|
||||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
// ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||||
double volume = position.volume * supportVolumeMultiplier;
|
// double volume = position.volume * supportVolumeMultiplier;
|
||||||
if (multiplySupportLevelOnVolume)
|
// if (multiplySupportLevelOnVolume)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
volume = supportsCount <= 0
|
// volume = supportsCount <= 0
|
||||||
? position.volume * supportVolumeMultiplier
|
// ? position.volume * supportVolumeMultiplier
|
||||||
: position.volume * ((supportsCount + 1) * supportVolumeMultiplier);
|
// : position.volume * ((supportsCount + 1) * supportVolumeMultiplier);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Prepare Signal ...
|
// // Prepare Signal ...
|
||||||
XSignal signal;
|
// XSignal signal;
|
||||||
bool isPrepared = signal.Prepare(
|
// bool isPrepared = signal.Prepare(
|
||||||
position.symbol,
|
// position.symbol,
|
||||||
position.provider,
|
// position.provider,
|
||||||
position.period,
|
// position.period,
|
||||||
type,
|
// type,
|
||||||
mode,
|
// mode,
|
||||||
entry,
|
// entry,
|
||||||
volume,
|
// volume,
|
||||||
sl,
|
// sl,
|
||||||
tp //
|
// tp //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (isPrepared)
|
// if (isPrepared)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
// Generate Comment for Recover and Support ...
|
// // Generate Comment for Recover and Support ...
|
||||||
string comment = GenerateSupportTag(position.ticket);
|
// string comment = GenerateSupportTag(position.ticket);
|
||||||
|
|
||||||
//
|
// //
|
||||||
signal.comment = comment;
|
// signal.comment = comment;
|
||||||
|
|
||||||
//
|
// //
|
||||||
ENUM_X_SIGNAL_EXECUTION_RESULT state;
|
// ENUM_X_SIGNAL_EXECUTION_RESULT state;
|
||||||
bool isSupported = ExecuteSignal(
|
// bool isSupported = ExecuteSignal(
|
||||||
signal,
|
// signal,
|
||||||
state,
|
// state,
|
||||||
true // Support Signal need to Ignore Policies ...
|
// true // Support Signal need to Ignore Policies ...
|
||||||
);
|
// );
|
||||||
if (isSupported)
|
// if (isSupported)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
mData[iDX].supportLevel++;
|
// mData[iDX].supportLevel++;
|
||||||
mData[iDX].lastSupportedOn = currentTime;
|
// mData[iDX].lastSupportedOn = currentTime;
|
||||||
mData[iDX].lastSupportDistance = profitInPoint;
|
// mData[iDX].lastSupportDistance = profitInPoint;
|
||||||
|
|
||||||
//
|
// //
|
||||||
string message = "EQM Open " + (IsLong(type) ? "Long" : "Short") + " Support Position in Level: " +
|
// string message = "EQM Open " + (IsLong(type) ? "Long" : "Short") + " Support Position in Level: " +
|
||||||
ToString(mData[iDX].supportLevel) +
|
// ToString(mData[iDX].supportLevel) +
|
||||||
" for (" + ToString(position.ticket) + ") ...";
|
// " for (" + ToString(position.ticket) + ") ...";
|
||||||
Alert(message);
|
// Alert(message);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
@@ -3248,20 +3250,20 @@ class X121SCTradeHandler : public XSCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Freeze ...
|
// Freeze ...
|
||||||
bool mAllowFreeze; // Allow Freezing
|
// bool mAllowFreeze; // Allow Freezing
|
||||||
double mFreezeDistance; // Specify Freeze Start Drawdown in Point
|
// double mFreezeDistance; // Specify Freeze Start Drawdown in Point
|
||||||
bool mRemoveFreezedPositionTPSL; // Remove Freezed Positions TPSL
|
// bool mRemoveFreezedPositionTPSL; // Remove Freezed Positions TPSL
|
||||||
bool mDisableTrailWhenFreezedPosition; // Disable Trail when has Freezed Position
|
// bool mDisableTrailWhenFreezedPosition; // Disable Trail when has Freezed Position
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support ...
|
// Support ...
|
||||||
bool mAllowSupport; // Allow Support
|
// bool mAllowSupport; // Allow Support
|
||||||
double mSupportStartDistance; // Specify Start Support Drawdown in Point
|
// double mSupportStartDistance; // Specify Start Support Drawdown in Point
|
||||||
int mMaxAllowedSupport; // Max Allowed Number of Support Position
|
// int mMaxAllowedSupport; // Max Allowed Number of Support Position
|
||||||
double mSupportVolumeMultiplier; // Specify Support Volume Multiplier
|
// double mSupportVolumeMultiplier; // Specify Support Volume Multiplier
|
||||||
bool mMultiplySupportLevelOnVolume; // Multiply Support Level on Volume Multiplier
|
// bool mMultiplySupportLevelOnVolume; // Multiply Support Level on Volume Multiplier
|
||||||
bool mDoSupportOnConditions; // Do Support on Conditions
|
// bool mDoSupportOnConditions; // Do Support on Conditions
|
||||||
int mDelayBetweenTwoSupport; // Delay Between To Support in Second
|
// int mDelayBetweenTwoSupport; // Delay Between To Support in Second
|
||||||
|
|
||||||
//
|
//
|
||||||
// Partial Close (In Drawdown) ...
|
// Partial Close (In Drawdown) ...
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ CTrade trade;
|
|||||||
string mTag;
|
string mTag;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// SIGNALLING GUI ...
|
||||||
XCPanel eaSignallingPanel;
|
XCPanel eaSignallingPanel;
|
||||||
string eaSignallingPanelName;
|
string eaSignallingPanelName;
|
||||||
XCButton eaSignallingBtn;
|
XCButton eaSignallingBtn;
|
||||||
@@ -25,10 +26,45 @@ string eaSignallingLongBtnName;
|
|||||||
XCButton eaSignallingShortBtn;
|
XCButton eaSignallingShortBtn;
|
||||||
string eaSignallingShortBtnName;
|
string eaSignallingShortBtnName;
|
||||||
|
|
||||||
|
//
|
||||||
|
// PROTECTOR GUI ...
|
||||||
|
XCPanel eaProtectorPanel;
|
||||||
|
string eaProtectorPanelName;
|
||||||
|
XCButton eaHedgingBtn;
|
||||||
|
string eaHedgingBtnName;
|
||||||
|
XCButton eaTraillingBtn;
|
||||||
|
string eaTraillingBtnName;
|
||||||
|
XCButton eaFreezingBtn;
|
||||||
|
string eaFreezingBtnName;
|
||||||
|
XCButton eaSupportingBtn;
|
||||||
|
string eaSupportingBtnName;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool eaEnableLongs = true;
|
bool eaEnableLongs = true;
|
||||||
bool eaEnableShorts = true;
|
bool eaEnableShorts = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mAllowHedge = true; // Allow Protector to Hedge Positions
|
||||||
|
double eaHedgeMinVolumeStep = 0.01; // Minimum Volume Step For Hedge
|
||||||
|
int eaMinimumOpenPositionsForHEHedge = 2; // Minimum Open Positions For HE Hedge
|
||||||
|
double eaHedgeHEMinProfitPerVolumeStep = 1; // Minimum Required Profit For HE Hedge Per Volume Step
|
||||||
|
double eaHedgeBEMinProfitPerVolumeStep = 0.5; // Minimum Required Profit For BE Hedge Per Volume Step
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mAllowTrail = true; // Allow Trail Stop for Positions
|
||||||
|
double eaTrailStartDistance = 35; // Specify Trail Start in Point
|
||||||
|
double eaTrailStep = 10; // Trail Step in Point
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mllowFreeze = false; // Allow Freezing
|
||||||
|
double eaFreezeVolumeMultiplier = 3; // Specify Freeze Volume Multiplier
|
||||||
|
double eaFreezeDistance = 100; // Specify Freeze Start Drawdown in Point
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mAllowSupport = false; // Allow Support
|
||||||
|
double eaSupportStartDistance = 0; // Specify Start Support Drawdown in Point
|
||||||
|
double eaSupportVolumeMultiplier = 1; // Specify Support Volume Multiplier
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
//| Expert initialization function |
|
//| Expert initialization function |
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
@@ -69,6 +105,7 @@ void OnChartEvent(const int id, const long &lparam, const double &dparam, const
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Handle Object Movement ...
|
// Handle Object Movement ...
|
||||||
|
eaProtectorPanel.OnEvent(id, lparam, dparam, sparam);
|
||||||
eaSignallingPanel.OnEvent(id, lparam, dparam, sparam);
|
eaSignallingPanel.OnEvent(id, lparam, dparam, sparam);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -97,6 +134,13 @@ bool InitialGUI()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = InitialProtectorGUI();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
ChartRedraw(0);
|
ChartRedraw(0);
|
||||||
|
|
||||||
@@ -111,8 +155,116 @@ void UpdateGUI()
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
UpdateSignallingGUI();
|
UpdateSignallingGUI();
|
||||||
|
UpdateProtectorGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy GUI ...
|
||||||
|
*/
|
||||||
|
void DestroyGUI()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
DestroySignallingGUI();
|
||||||
|
DestroyProtectorGUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle Object's Click Events ...
|
||||||
|
*
|
||||||
|
* @param name: Clicked Object Name
|
||||||
|
*/
|
||||||
|
void HandleOnClickEvent(string name)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!IsValid(name))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isClicked = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Signalling State Button ...
|
||||||
|
if (name == eaSignallingBtnName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isClicked = true;
|
||||||
|
HandleChangeState();
|
||||||
|
eaSignallingBtn.SetState(false);
|
||||||
|
Print("State Button Clicked ...");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Long Signalling State ...
|
||||||
|
else if (name == eaSignallingLongBtnName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isClicked = true;
|
||||||
|
HandleChangeLongsState();
|
||||||
|
eaSignallingLongBtn.SetState(false);
|
||||||
|
Print("Long State Button Clicked ...");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Short Signalling State ...
|
||||||
|
else if (name == eaSignallingShortBtnName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isClicked = true;
|
||||||
|
HandleChangeShortsState();
|
||||||
|
eaSignallingShortBtn.SetState(false);
|
||||||
|
Print("Short State Button Clicked ...");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Hedging State Button ...
|
||||||
|
else if (name == eaHedgingBtnName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isClicked = true;
|
||||||
|
HandleChangeHedgingState();
|
||||||
|
eaHedgingBtn.SetState(false);
|
||||||
|
Print("Hedging State Button Clicked ...");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Trailling State Button ...
|
||||||
|
else if (name == eaTraillingBtnName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isClicked = true;
|
||||||
|
HandleChangeTraillingState();
|
||||||
|
eaTraillingBtn.SetState(false);
|
||||||
|
Print("Trailling State Button Clicked ...");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Freezing State Button ...
|
||||||
|
else if (name == eaFreezingBtnName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isClicked = true;
|
||||||
|
HandleChangeFreezingState();
|
||||||
|
eaFreezingBtn.SetState(false);
|
||||||
|
Print("Freezing State Button Clicked ...");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Supporting State Button ...
|
||||||
|
else if (name == eaSupportingBtnName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isClicked = true;
|
||||||
|
HandleChangeSupportingState();
|
||||||
|
eaSupportingBtn.SetState(false);
|
||||||
|
Print("Supporting State Button Clicked ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isClicked)
|
||||||
|
{
|
||||||
|
UpdateGUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SIGNALLING GUI ...
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize State and Signalling GUI ...
|
* Initialize State and Signalling GUI ...
|
||||||
*
|
*
|
||||||
@@ -143,7 +295,7 @@ bool InitSignallingGUI()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Create Activation Button ...
|
// Create Activation Button ...
|
||||||
string eaSignallingPrefix = eaSignallingPanelName + "_State_";
|
string eaSignallingPrefix = eaSignallingPanelName + "_";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Signalling ...
|
// Signalling ...
|
||||||
@@ -248,9 +400,9 @@ void UpdateSignallingGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy GUI ...
|
* Destroy Signalling GUI ...
|
||||||
*/
|
*/
|
||||||
void DestroyGUI()
|
void DestroySignallingGUI()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
eaSignallingBtnName = NULL;
|
eaSignallingBtnName = NULL;
|
||||||
@@ -264,54 +416,210 @@ void DestroyGUI()
|
|||||||
eaSignallingShortBtn.Destroy();
|
eaSignallingShortBtn.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// PROTECTOR GUI ...
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle Object's Click Events ...
|
* Initial Protector GUI ...
|
||||||
*
|
*
|
||||||
* @param name: Clicked Object Name
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
void HandleOnClickEvent(string name)
|
bool InitialProtectorGUI()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (!IsValid(name))
|
bool result = false;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// State Button ...
|
eaProtectorPanelName = mTag + "PROTECTOR";
|
||||||
bool isClicked = false;
|
|
||||||
if (name == eaSignallingBtnName)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isClicked = true;
|
|
||||||
HandleChangeState();
|
|
||||||
eaSignallingBtn.SetState(false);
|
|
||||||
Print("State Button Clicked ...");
|
|
||||||
}
|
|
||||||
//
|
|
||||||
else if (name == eaSignallingLongBtnName)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isClicked = true;
|
|
||||||
HandleChangeLongsState();
|
|
||||||
eaSignallingLongBtn.SetState(false);
|
|
||||||
Print("Long State Button Clicked ...");
|
|
||||||
}
|
|
||||||
//
|
|
||||||
else if (name == eaSignallingShortBtnName)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isClicked = true;
|
|
||||||
HandleChangeShortsState();
|
|
||||||
eaSignallingShortBtn.SetState(false);
|
|
||||||
Print("Short State Button Clicked ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isClicked)
|
// Create a Panel ...
|
||||||
|
result = eaProtectorPanel.Create(
|
||||||
|
eaProtectorPanelName,
|
||||||
|
10,
|
||||||
|
110,
|
||||||
|
300,
|
||||||
|
100 //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
{
|
{
|
||||||
UpdateGUI();
|
return result;
|
||||||
}
|
}
|
||||||
|
eaProtectorPanel.Caption("Protector");
|
||||||
|
|
||||||
|
//
|
||||||
|
string eaProtectorPrefix = eaProtectorPanelName + "_";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hedging ...
|
||||||
|
eaHedgingBtnName = eaProtectorPrefix + "HEDGING_btn";
|
||||||
|
result = eaHedgingBtn.Create(
|
||||||
|
eaHedgingBtnName,
|
||||||
|
10,
|
||||||
|
130,
|
||||||
|
300,
|
||||||
|
25 //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
eaHedgingBtn.SetText("");
|
||||||
|
eaProtectorPanel.Add(eaHedgingBtnName);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trailling ...
|
||||||
|
eaTraillingBtnName = eaProtectorPrefix + "TRAILLING_btn";
|
||||||
|
result = eaTraillingBtn.Create(
|
||||||
|
eaTraillingBtnName,
|
||||||
|
10,
|
||||||
|
155,
|
||||||
|
300,
|
||||||
|
25 //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
eaTraillingBtn.SetText("");
|
||||||
|
eaProtectorPanel.Add(eaTraillingBtnName);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Freezing ...
|
||||||
|
eaFreezingBtnName = eaProtectorPrefix + "FREEZING_btn";
|
||||||
|
result = eaFreezingBtn.Create(
|
||||||
|
eaFreezingBtnName,
|
||||||
|
10,
|
||||||
|
180,
|
||||||
|
300,
|
||||||
|
25 //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
eaFreezingBtn.SetText("");
|
||||||
|
eaProtectorPanel.Add(eaFreezingBtnName);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supporting ...
|
||||||
|
eaSupportingBtnName = eaProtectorPrefix + "SUPPORTING_btn";
|
||||||
|
result = eaSupportingBtn.Create(
|
||||||
|
eaSupportingBtnName,
|
||||||
|
10,
|
||||||
|
205,
|
||||||
|
300,
|
||||||
|
25 //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
eaSupportingBtn.SetText("");
|
||||||
|
eaProtectorPanel.Add(eaSupportingBtnName);
|
||||||
|
|
||||||
|
//
|
||||||
|
UpdateProtectorGUI();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Signalling GUI Content ...
|
||||||
|
*/
|
||||||
|
void UpdateProtectorGUI()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Hedging ...
|
||||||
|
bool isHedgingEnabled =
|
||||||
|
mAllowHedge &&
|
||||||
|
eaHedgeMinVolumeStep > 0 &&
|
||||||
|
(eaHedgeHEMinProfitPerVolumeStep > 0 ||
|
||||||
|
eaHedgeBEMinProfitPerVolumeStep > 0) &&
|
||||||
|
eaMinimumOpenPositionsForHEHedge >= 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
color eaHedgingBtnTextColor = isHedgingEnabled
|
||||||
|
? clrRed
|
||||||
|
: clrGreen;
|
||||||
|
string eaHedgingBtnText = isHedgingEnabled
|
||||||
|
? "Deactive Hedging"
|
||||||
|
: "Active Hedging";
|
||||||
|
eaHedgingBtn.SetText(eaHedgingBtnText);
|
||||||
|
eaHedgingBtn.SetColor(eaHedgingBtnTextColor);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trailling ...
|
||||||
|
bool isTraillingEnabled =
|
||||||
|
mAllowTrail &&
|
||||||
|
eaTrailStep > 0 &&
|
||||||
|
eaTrailStartDistance >= 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
color eaTraillingBtnColor = isTraillingEnabled
|
||||||
|
? clrRed
|
||||||
|
: clrGreen;
|
||||||
|
string eaTraillingBtnText = isTraillingEnabled
|
||||||
|
? "Deactive Trailling"
|
||||||
|
: "Active Trailling";
|
||||||
|
eaTraillingBtn.SetText(eaTraillingBtnText);
|
||||||
|
eaTraillingBtn.SetColor(eaTraillingBtnColor);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Freezing ...
|
||||||
|
bool isFreezingEnabled =
|
||||||
|
mllowFreeze &&
|
||||||
|
eaFreezeDistance > 0 &&
|
||||||
|
eaFreezeVolumeMultiplier > 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
color eaFreezingBtnColor = isFreezingEnabled
|
||||||
|
? clrRed
|
||||||
|
: clrGreen;
|
||||||
|
string eaFreezingBtnText = isFreezingEnabled
|
||||||
|
? "Deactive Freezing"
|
||||||
|
: "Active Freezing";
|
||||||
|
eaFreezingBtn.SetText(eaFreezingBtnText);
|
||||||
|
eaFreezingBtn.SetColor(eaFreezingBtnColor);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supporting ...
|
||||||
|
bool isSupportingEnabled =
|
||||||
|
!isFreezingEnabled &&
|
||||||
|
mAllowSupport &&
|
||||||
|
eaSupportStartDistance > 0 &&
|
||||||
|
eaSupportVolumeMultiplier > 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
color eaSupportingBtnColor = isSupportingEnabled
|
||||||
|
? clrRed
|
||||||
|
: clrGreen;
|
||||||
|
string eaSupportingBtnText = isSupportingEnabled
|
||||||
|
? "Deactive Supporting"
|
||||||
|
: "Active Supporting";
|
||||||
|
eaSupportingBtn.SetText(eaSupportingBtnText);
|
||||||
|
eaSupportingBtn.SetColor(eaSupportingBtnColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy Protector GUI ...
|
||||||
|
*/
|
||||||
|
void DestroyProtectorGUI()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
eaHedgingBtnName = NULL;
|
||||||
|
eaFreezingBtnName = NULL;
|
||||||
|
eaTraillingBtnName = NULL;
|
||||||
|
eaSupportingBtnName = NULL;
|
||||||
|
eaProtectorPanelName = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
eaHedgingBtn.Destroy();
|
||||||
|
eaFreezingBtn.Destroy();
|
||||||
|
eaTraillingBtn.Destroy();
|
||||||
|
eaSupportingBtn.Destroy();
|
||||||
|
eaProtectorPanel.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -357,4 +665,32 @@ void HandleChangeShortsState()
|
|||||||
eaEnableShorts = !eaEnableShorts;
|
eaEnableShorts = !eaEnableShorts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle Hedging State ...
|
||||||
|
*/
|
||||||
|
void HandleChangeHedgingState()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle Trailling State ...
|
||||||
|
*/
|
||||||
|
void HandleChangeTraillingState()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toogle Freezing State ...
|
||||||
|
*/
|
||||||
|
void HandleChangeFreezingState()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toogle Supporting State ...
|
||||||
|
*/
|
||||||
|
void HandleChangeSupportingState()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -123,22 +123,22 @@ input group "In Drawdown Positions Protecting";
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Freeze ...
|
// Freeze ...
|
||||||
input group "Freeze";
|
// input group "Freeze";
|
||||||
input bool eaAllowFreeze = false; // Allow Freezing
|
// input bool eaAllowFreeze = false; // Allow Freezing
|
||||||
input double eaFreezeDistance = 100; // Specify Freeze Start Drawdown in Point
|
// input double eaFreezeDistance = 100; // Specify Freeze Start Drawdown in Point
|
||||||
input bool eaRemoveFreezedPositionTPSL = true; // Remove Freezed Positions TPSL
|
// input bool eaRemoveFreezedPositionTPSL = true; // Remove Freezed Positions TPSL
|
||||||
input bool eaDisableTrailWhenFreezedPosition = true; // Disable Trail when has Freezed Position
|
// input bool eaDisableTrailWhenFreezedPosition = true; // Disable Trail when has Freezed Position
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support ...
|
// Support ...
|
||||||
input group "Support";
|
// input group "Support";
|
||||||
input bool eaAllowSupport = false; // Allow Support
|
// input bool eaAllowSupport = false; // Allow Support
|
||||||
input double eaSupportStartDistance = 0; // Specify Start Support Drawdown in Point
|
// input double eaSupportStartDistance = 0; // Specify Start Support Drawdown in Point
|
||||||
input int eaMaxAllowedSupport = 2; // Max Allowed Number of Support Position
|
// input int eaMaxAllowedSupport = 2; // Max Allowed Number of Support Position
|
||||||
input double eaSupportVolumeMultiplier = 1; // Specify Support Volume Multiplier
|
// input double eaSupportVolumeMultiplier = 1; // Specify Support Volume Multiplier
|
||||||
input bool eaMultiplySupportLevelOnVolume = false; // Multiply Support Level on Volume Multiplier
|
// input bool eaMultiplySupportLevelOnVolume = false; // Multiply Support Level on Volume Multiplier
|
||||||
input bool eaDoSupportOnConditions = true; // Do Support on Conditions
|
// input bool eaDoSupportOnConditions = true; // Do Support on Conditions
|
||||||
input int eaDelayBetweenTwoSupport = 60; // Delay Between To Support in Second
|
// input int eaDelayBetweenTwoSupport = 60; // Delay Between To Support in Second
|
||||||
|
|
||||||
//
|
//
|
||||||
// Partial Close (In Drawdown) ...
|
// Partial Close (In Drawdown) ...
|
||||||
@@ -610,20 +610,20 @@ bool InitialEA()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Freeze ...
|
// Freeze ...
|
||||||
eaTradeHandler.AllowFreeze(eaAllowFreeze);
|
// eaTradeHandler.AllowFreeze(eaAllowFreeze);
|
||||||
eaTradeHandler.FreezeDistance(eaFreezeDistance);
|
// eaTradeHandler.FreezeDistance(eaFreezeDistance);
|
||||||
eaTradeHandler.RemoveFreezedPositionTPSL(eaRemoveFreezedPositionTPSL);
|
// eaTradeHandler.RemoveFreezedPositionTPSL(eaRemoveFreezedPositionTPSL);
|
||||||
eaTradeHandler.DisableTrailWhenFreezedPosition(eaDisableTrailWhenFreezedPosition);
|
// eaTradeHandler.DisableTrailWhenFreezedPosition(eaDisableTrailWhenFreezedPosition);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support ...
|
// Support ...
|
||||||
eaTradeHandler.AllowSupport(eaAllowSupport);
|
// eaTradeHandler.AllowSupport(eaAllowSupport);
|
||||||
eaTradeHandler.SupportStartDistance(eaSupportStartDistance);
|
// eaTradeHandler.SupportStartDistance(eaSupportStartDistance);
|
||||||
eaTradeHandler.MaxAllowedSupport(eaMaxAllowedSupport);
|
// eaTradeHandler.MaxAllowedSupport(eaMaxAllowedSupport);
|
||||||
eaTradeHandler.SupportVolumeMultiplier(eaSupportVolumeMultiplier);
|
// eaTradeHandler.SupportVolumeMultiplier(eaSupportVolumeMultiplier);
|
||||||
eaTradeHandler.MultiplySupportLevelOnVolume(eaMultiplySupportLevelOnVolume);
|
// eaTradeHandler.MultiplySupportLevelOnVolume(eaMultiplySupportLevelOnVolume);
|
||||||
eaTradeHandler.DoSupportOnConditions(eaDoSupportOnConditions);
|
// eaTradeHandler.DoSupportOnConditions(eaDoSupportOnConditions);
|
||||||
eaTradeHandler.DelayBetweenTwoSupport(eaDelayBetweenTwoSupport);
|
// eaTradeHandler.DelayBetweenTwoSupport(eaDelayBetweenTwoSupport);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Partial Close (In Profit) ...
|
// Partial Close (In Profit) ...
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ public:
|
|||||||
double entry = 0;
|
double entry = 0;
|
||||||
double reward = 0;
|
double reward = 0;
|
||||||
double r2r = R2R();
|
double r2r = R2R();
|
||||||
|
double volume = Volume();
|
||||||
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
||||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||||
|
|
||||||
@@ -623,7 +624,7 @@ public:
|
|||||||
type,
|
type,
|
||||||
mode,
|
mode,
|
||||||
entry,
|
entry,
|
||||||
mVolume,
|
volume,
|
||||||
sl,
|
sl,
|
||||||
tp //
|
tp //
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -559,6 +559,7 @@ public:
|
|||||||
double entry = 0;
|
double entry = 0;
|
||||||
double reward = 0;
|
double reward = 0;
|
||||||
double r2r = R2R();
|
double r2r = R2R();
|
||||||
|
double volume = Volume();
|
||||||
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
||||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||||
|
|
||||||
@@ -1292,7 +1293,7 @@ public:
|
|||||||
type,
|
type,
|
||||||
mode,
|
mode,
|
||||||
entry,
|
entry,
|
||||||
mVolume,
|
volume,
|
||||||
sl,
|
sl,
|
||||||
tp //
|
tp //
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user