last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -671,11 +671,11 @@ protected:
|
|||||||
//
|
//
|
||||||
OnSignalExecutionFailed(signal, state);
|
OnSignalExecutionFailed(signal, state);
|
||||||
|
|
||||||
//
|
// //
|
||||||
string message = "Signal Execution Failed: " + ToString(state) + " ...";
|
// string message = "Signal Execution Failed: " + ToString(state) + " ...";
|
||||||
|
|
||||||
//
|
// //
|
||||||
Alert(message);
|
// Alert(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -473,3 +473,672 @@
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Long Support ...
|
||||||
|
bool canLongSupport =
|
||||||
|
//
|
||||||
|
volumeOSC > 5 &&
|
||||||
|
bullishScore > bearishScore &&
|
||||||
|
ArraySize(longProviders) >= 2 &&
|
||||||
|
bearishScore < bullishScore / 3.5 &&
|
||||||
|
longVerifications > reqValidation * 3
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (canLongSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isPrepared = tmpSignal.Prepare(
|
||||||
|
iPosition.symbol,
|
||||||
|
iPosition.provider,
|
||||||
|
iPosition.period,
|
||||||
|
POSITION_TYPE_BUY,
|
||||||
|
X_ORDER_MODE_MARKET,
|
||||||
|
longEntry,
|
||||||
|
mVolume //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmpSignal.positionId = iPosition.ticket;
|
||||||
|
string comment = GenerateSupportTag(iPosition.ticket);
|
||||||
|
tmpSignal.comment = comment;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
tmpSignal,
|
||||||
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpSignal.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isPrepared = tmpSignal.Prepare(
|
||||||
|
iPosition.symbol,
|
||||||
|
iPosition.provider,
|
||||||
|
iPosition.period,
|
||||||
|
POSITION_TYPE_SELL,
|
||||||
|
X_ORDER_MODE_MARKET,
|
||||||
|
shortEntry,
|
||||||
|
mVolume //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmpSignal.positionId = iPosition.ticket;
|
||||||
|
string comment = GenerateSupportTag(iPosition.ticket);
|
||||||
|
tmpSignal.comment = comment;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
tmpSignal,
|
||||||
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpSignal.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Short Support ...
|
||||||
|
bool canShortSupport =
|
||||||
|
//
|
||||||
|
volumeOSC < -5 &&
|
||||||
|
bearishScore > bullishScore &&
|
||||||
|
ArraySize(shortProviders) >= 2 &&
|
||||||
|
bullishScore < bearishScore / 3.5 &&
|
||||||
|
shortVerifications > reqValidation * 3
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (canShortSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isPrepared = tmpSignal.Prepare(
|
||||||
|
iPosition.symbol,
|
||||||
|
iPosition.provider,
|
||||||
|
iPosition.period,
|
||||||
|
POSITION_TYPE_SELL,
|
||||||
|
X_ORDER_MODE_MARKET,
|
||||||
|
shortEntry,
|
||||||
|
mVolume //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmpSignal.positionId = iPosition.ticket;
|
||||||
|
string comment = GenerateSupportTag(iPosition.ticket);
|
||||||
|
tmpSignal.comment = comment;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
tmpSignal,
|
||||||
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpSignal.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isPrepared = tmpSignal.Prepare(
|
||||||
|
iPosition.symbol,
|
||||||
|
iPosition.provider,
|
||||||
|
iPosition.period,
|
||||||
|
POSITION_TYPE_BUY,
|
||||||
|
X_ORDER_MODE_MARKET,
|
||||||
|
longEntry,
|
||||||
|
mVolume //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmpSignal.positionId = iPosition.ticket;
|
||||||
|
string comment = GenerateSupportTag(iPosition.ticket);
|
||||||
|
tmpSignal.comment = comment;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
tmpSignal,
|
||||||
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpSignal.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If no Support Presents ...
|
||||||
|
if (!canLongSupport && !canShortSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// RemoveDraws("MED");
|
||||||
|
// RemoveDraws("LON");
|
||||||
|
// RemoveDraws("HND");
|
||||||
|
AddHotLevelsToZones(mZones);
|
||||||
|
AddHotLevelsToZones(lZones);
|
||||||
|
AddHotLevelsToZones(hZones);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPrepared = tmpSignal.Prepare(
|
||||||
|
iPosition.symbol,
|
||||||
|
iPosition.provider,
|
||||||
|
iPosition.period,
|
||||||
|
POSITION_TYPE_BUY,
|
||||||
|
X_ORDER_MODE_MARKET,
|
||||||
|
longEntry,
|
||||||
|
iPosition.volume //
|
||||||
|
);
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmpSignal.positionId = iPosition.ticket;
|
||||||
|
string comment = GenerateSupportTag(iPosition.ticket);
|
||||||
|
tmpSignal.comment = comment;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
tmpSignal,
|
||||||
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpSignal.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isPrepared = tmpSignal.Prepare(
|
||||||
|
iPosition.symbol,
|
||||||
|
iPosition.provider,
|
||||||
|
iPosition.period,
|
||||||
|
POSITION_TYPE_SELL,
|
||||||
|
X_ORDER_MODE_MARKET,
|
||||||
|
shortEntry,
|
||||||
|
iPosition.volume //
|
||||||
|
);
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmpSignal.positionId = iPosition.ticket;
|
||||||
|
string comment = GenerateSupportTag(iPosition.ticket);
|
||||||
|
tmpSignal.comment = comment;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
tmpSignal,
|
||||||
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpSignal.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// bool isDrawn = mZones.DrawZones(0, "MED");
|
||||||
|
// if (isDrawn)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// isDrawn = false;
|
||||||
|
// RemoveDraws("MED");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// isDrawn = lZones.DrawZones(0, "LON");
|
||||||
|
// if (isDrawn)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// isDrawn = false;
|
||||||
|
// RemoveDraws("LON");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// isDrawn = hZones.DrawZones(0, "HND");
|
||||||
|
// if (isDrawn)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// isDrawn = false;
|
||||||
|
// RemoveDraws("HND");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// isDrawn = mZones.DrawZones(0, "MED");
|
||||||
|
// isDrawn = lZones.DrawZones(0, "LON");
|
||||||
|
// isDrawn = hZones.DrawZones(0, "HND");
|
||||||
|
// if (isDrawn)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// isDrawn = false;
|
||||||
|
// // RemoveDraws("MED");
|
||||||
|
// // RemoveDraws("LON");
|
||||||
|
// // RemoveDraws("HND");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Now Check Position SUpports ...
|
||||||
|
XPosition iSupports[];
|
||||||
|
int iSupportsCount = mTrader.GetSupports(
|
||||||
|
iPosition.ticket,
|
||||||
|
iSupports //
|
||||||
|
);
|
||||||
|
bool isFirst = !IsValidSize(iSupportsCount);
|
||||||
|
bool canSupport = isFirst || iSupportsCount < 3;
|
||||||
|
if (!canSupport)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Now Check Signals For not Exists ...
|
||||||
|
int signalsCount = ArraySize(signals);
|
||||||
|
if (IsValidSize(signalsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isInserted = false;
|
||||||
|
for (int j = 0; j < signalsCount; j++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isInserted = signals[j].positionId == iPosition.ticket;
|
||||||
|
if (isInserted)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInserted)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// First Try to Get Market State ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double bullishScore = 0;
|
||||||
|
double bearishScore = 0;
|
||||||
|
double tmpBullishScore = 0;
|
||||||
|
double tmpBearishScore = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Max Verifications is 11 ...
|
||||||
|
int reqValidation = 6;
|
||||||
|
int longVerifications = 0;
|
||||||
|
int shortVerifications = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Pushers ...
|
||||||
|
int longPushers = 0;
|
||||||
|
int shortPushers = 0;
|
||||||
|
int tmpLongPushers = 0;
|
||||||
|
int tmpShortPushers = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
string tmpProvider;
|
||||||
|
string longProviders[];
|
||||||
|
string shortProviders[];
|
||||||
|
|
||||||
|
//
|
||||||
|
double volumeOSC = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Current ...
|
||||||
|
X121SetupConditions cConditions;
|
||||||
|
bool cHasConditions = setups[idx].GetConditions(
|
||||||
|
cConditions,
|
||||||
|
X_MARKET_CYCLE_UNKNOWN //
|
||||||
|
);
|
||||||
|
if (!cHasConditions)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bool isCValidForLong = signalGenerator.IsConditionsValidForLong(
|
||||||
|
cConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isCValidForLong)
|
||||||
|
{
|
||||||
|
longVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool isCValidForShort = signalGenerator.IsConditionsValidForShort(
|
||||||
|
cConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isCValidForShort)
|
||||||
|
{
|
||||||
|
shortVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool cHasLongConditions = signalGenerator.HasLongConditions(
|
||||||
|
cConditions,
|
||||||
|
tmpLongPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (cHasLongConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
longProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
longPushers += tmpLongPushers;
|
||||||
|
}
|
||||||
|
bool cHasShortConditions = signalGenerator.HasShortConditions(
|
||||||
|
cConditions,
|
||||||
|
tmpShortPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (cHasShortConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
shortProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
shortPushers += tmpShortPushers;
|
||||||
|
}
|
||||||
|
volumeOSC += cConditions.vlmConditions.volume[1];
|
||||||
|
cConditions.GenerateScore(
|
||||||
|
tmpBullishScore,
|
||||||
|
tmpBearishScore //
|
||||||
|
);
|
||||||
|
bullishScore += tmpBullishScore;
|
||||||
|
bearishScore += tmpBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Short ...
|
||||||
|
X121SetupConditions sConditions;
|
||||||
|
bool sHasConditions = setups[idx].GetConditions(
|
||||||
|
sConditions,
|
||||||
|
X_MARKET_CYCLE_SHORT //
|
||||||
|
);
|
||||||
|
if (!sHasConditions)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bool isSValidForLong = signalGenerator.IsConditionsValidForLong(
|
||||||
|
sConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isSValidForLong)
|
||||||
|
{
|
||||||
|
longVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool isSValidForShort = signalGenerator.IsConditionsValidForShort(
|
||||||
|
sConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isSValidForShort)
|
||||||
|
{
|
||||||
|
shortVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool sHasLongConditions = signalGenerator.HasLongConditions(
|
||||||
|
sConditions,
|
||||||
|
tmpLongPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (sHasLongConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
longProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
longPushers += tmpLongPushers;
|
||||||
|
}
|
||||||
|
bool sHasShortConditions = signalGenerator.HasShortConditions(
|
||||||
|
sConditions,
|
||||||
|
tmpShortPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (sHasShortConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
shortProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
shortPushers += tmpShortPushers;
|
||||||
|
}
|
||||||
|
volumeOSC += sConditions.vlmConditions.volume[1];
|
||||||
|
sConditions.GenerateScore(
|
||||||
|
tmpBullishScore,
|
||||||
|
tmpBearishScore //
|
||||||
|
);
|
||||||
|
bullishScore += tmpBullishScore;
|
||||||
|
bearishScore += tmpBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Medium ...
|
||||||
|
X121SetupConditions mConditions;
|
||||||
|
bool mHasConditions = setups[idx].GetConditions(
|
||||||
|
mConditions,
|
||||||
|
X_MARKET_CYCLE_MEDIUM //
|
||||||
|
);
|
||||||
|
if (!mHasConditions)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
XSCZones *mZones = setups[idx].GetZones(
|
||||||
|
X_MARKET_CYCLE_MEDIUM //
|
||||||
|
);
|
||||||
|
bool isMValidForLong = signalGenerator.IsConditionsValidForLong(
|
||||||
|
mConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isMValidForLong)
|
||||||
|
{
|
||||||
|
longVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool isMValidForShort = signalGenerator.IsConditionsValidForShort(
|
||||||
|
mConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isMValidForShort)
|
||||||
|
{
|
||||||
|
shortVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool mHasLongConditions = signalGenerator.HasLongConditions(
|
||||||
|
mConditions,
|
||||||
|
tmpLongPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (mHasLongConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
longProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
longPushers += tmpLongPushers;
|
||||||
|
}
|
||||||
|
bool mHasShortConditions = signalGenerator.HasShortConditions(
|
||||||
|
mConditions,
|
||||||
|
tmpShortPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (mHasShortConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
shortProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
shortPushers += tmpShortPushers;
|
||||||
|
}
|
||||||
|
volumeOSC += mConditions.vlmConditions.volume[1];
|
||||||
|
mConditions.GenerateScore(
|
||||||
|
tmpBullishScore,
|
||||||
|
tmpBearishScore //
|
||||||
|
);
|
||||||
|
bullishScore += tmpBullishScore;
|
||||||
|
bearishScore += tmpBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Long ...
|
||||||
|
X121SetupConditions lConditions;
|
||||||
|
bool lHasConditions = setups[idx].GetConditions(
|
||||||
|
lConditions,
|
||||||
|
X_MARKET_CYCLE_LONG //
|
||||||
|
);
|
||||||
|
if (!lHasConditions)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
XSCZones *lZones = setups[idx].GetZones(
|
||||||
|
X_MARKET_CYCLE_LONG //
|
||||||
|
);
|
||||||
|
bool isLValidForLong = signalGenerator.IsConditionsValidForLong(
|
||||||
|
lConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isLValidForLong)
|
||||||
|
{
|
||||||
|
longVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool isLValidForShort = signalGenerator.IsConditionsValidForShort(
|
||||||
|
lConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isLValidForShort)
|
||||||
|
{
|
||||||
|
shortVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool lHasLongConditions = signalGenerator.HasLongConditions(
|
||||||
|
lConditions,
|
||||||
|
tmpLongPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (lHasLongConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
longProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
longPushers += tmpLongPushers;
|
||||||
|
}
|
||||||
|
bool lHasShortConditions = signalGenerator.HasShortConditions(
|
||||||
|
lConditions,
|
||||||
|
tmpShortPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (lHasShortConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
shortProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
shortPushers += tmpShortPushers;
|
||||||
|
}
|
||||||
|
volumeOSC += lConditions.vlmConditions.volume[1];
|
||||||
|
lConditions.GenerateScore(
|
||||||
|
tmpBullishScore,
|
||||||
|
tmpBearishScore //
|
||||||
|
);
|
||||||
|
bullishScore += tmpBullishScore;
|
||||||
|
bearishScore += tmpBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hind ...
|
||||||
|
X121SetupConditions hConditions;
|
||||||
|
bool hHasConditions = setups[idx].GetConditions(
|
||||||
|
hConditions,
|
||||||
|
X_MARKET_CYCLE_HIND //
|
||||||
|
);
|
||||||
|
if (!hHasConditions)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
XSCZones *hZones = setups[idx].GetZones(
|
||||||
|
X_MARKET_CYCLE_HIND //
|
||||||
|
);
|
||||||
|
bool isHValidForLong = signalGenerator.IsConditionsValidForLong(
|
||||||
|
hConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isHValidForLong)
|
||||||
|
{
|
||||||
|
longVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool isHValidForShort = signalGenerator.IsConditionsValidForShort(
|
||||||
|
hConditions,
|
||||||
|
reqValidation //
|
||||||
|
);
|
||||||
|
if (isHValidForShort)
|
||||||
|
{
|
||||||
|
shortVerifications += reqValidation;
|
||||||
|
}
|
||||||
|
bool hHasLongConditions = signalGenerator.HasLongConditions(
|
||||||
|
hConditions,
|
||||||
|
tmpLongPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (hHasLongConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
longProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
longPushers += tmpLongPushers;
|
||||||
|
}
|
||||||
|
bool hHasShortConditions = signalGenerator.HasShortConditions(
|
||||||
|
hConditions,
|
||||||
|
tmpShortPushers,
|
||||||
|
tmpProvider //
|
||||||
|
);
|
||||||
|
if (hHasShortConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddSpecific(
|
||||||
|
tmpProvider,
|
||||||
|
shortProviders //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
shortPushers += tmpShortPushers;
|
||||||
|
}
|
||||||
|
volumeOSC += hConditions.vlmConditions.volume[1];
|
||||||
|
hConditions.GenerateScore(
|
||||||
|
tmpBullishScore,
|
||||||
|
tmpBearishScore //
|
||||||
|
);
|
||||||
|
bullishScore += tmpBullishScore;
|
||||||
|
bearishScore += tmpBearishScore;
|
||||||
|
|||||||
@@ -54,23 +54,51 @@ input double x121EASLPoint = 500; // SL Point
|
|||||||
input int x121EAMaxAllowedTrades = 1; // Max Allowed Positions
|
input int x121EAMaxAllowedTrades = 1; // Max Allowed Positions
|
||||||
input bool x121EAIgnoreSL = false; // Ignore Calculated SL
|
input bool x121EAIgnoreSL = false; // Ignore Calculated SL
|
||||||
input bool x121EAIgnoreTP = false; // Ignore Calculated TP
|
input bool x121EAIgnoreTP = false; // Ignore Calculated TP
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protection ...
|
||||||
|
input group "Signalling";
|
||||||
|
input int x121EAStartSignallingHoure = -1; // Start Signalling at Specific Time
|
||||||
|
input int x121EAEndSignallingHoure = -1; // End Signalling at Specific Time
|
||||||
|
input int x121EACloseOnSpecificTime = -1; // Close All Trades in Specific Time
|
||||||
|
input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Trailling";
|
||||||
input bool x121EAAllowTrailStop = true; // Enable Trailling Stop Losses
|
input bool x121EAAllowTrailStop = true; // Enable Trailling Stop Losses
|
||||||
input double x121EAFirstTrailDistance = 60; // Start Trailling Distance
|
input double x121EAFirstTrailDistance = 60; // Start Trailling Distance
|
||||||
input double x121EAFirstTrailPoint = 50; // First Stop Trail
|
input double x121EAFirstTrailPoint = 50; // First Stop Trail
|
||||||
input double x121EANextTrailDistance = 25; // Next Trailling Distance
|
input double x121EANextTrailDistance = 25; // Next Trailling Distance
|
||||||
input double x121EANextTrailPoint = 10; // Next Trailling Step
|
input double x121EANextTrailPoint = 10; // Next Trailling Step
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Supporting";
|
||||||
input bool x121EAAllowSupport = false; // Allow Support Signals
|
input bool x121EAAllowSupport = false; // Allow Support Signals
|
||||||
|
input int x121EAMaxNumberOfSupports = 1; // Max Number of Support Signals
|
||||||
|
input double x121EASupportVolumeMultiplier = 2.0; // Support Signals Volume Multiplier
|
||||||
|
input double x121EAMaxAllowedSupportVolume = 0.8; // Max Allowed Support Signals Volume
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Grid";
|
||||||
input bool x121EAAllowGrid = false; // Allow Grid Signals
|
input bool x121EAAllowGrid = false; // Allow Grid Signals
|
||||||
|
input int x121EAMaxNumberOfGrids = 5; // Max Number of Grid Signals
|
||||||
input double x121EAGridDistance = 100; // Grid Distance
|
input double x121EAGridDistance = 100; // Grid Distance
|
||||||
input double x121EAGridVolumeMultiplier = 2; // Grid Volume Multiplier
|
input double x121EAGridVolumeMultiplier = 2.0; // Grid Volume Multiplier
|
||||||
|
input double x121EAMaxAllowedGridVolume = 0.8; // Max Allowed Grid Signals Volume
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Recovery";
|
||||||
input bool x121EAAllowRecovery = false; // Allow Recovery Signals
|
input bool x121EAAllowRecovery = false; // Allow 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
|
||||||
|
input double x121EAMaxAllowedRecoveryVolume = 0.8; // Max Allowed Recovery Signals Volume
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Hedging";
|
||||||
|
input int x121EARestingAfterHedge = 1000; // Resting Seconds After Hedge
|
||||||
input double x121EAMinRequiredProfitPerTrade = 0.5; // Minimum Required Profit for Hedging
|
input double x121EAMinRequiredProfitPerTrade = 0.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
|
||||||
input int x121EARestingAfterHedge = 300; // Resting Seconds After Hedge
|
|
||||||
input int x121EACloseOnSpecificTime = -1; // Close All Trades in Specific Time
|
|
||||||
input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Alert ...
|
// Alert ...
|
||||||
@@ -177,40 +205,36 @@ bool InitialEA()
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configure EA ...
|
// Configure EA Class Instance ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Signals ...
|
||||||
|
x121EA.AllowLong(x121EAAllowLong);
|
||||||
|
x121EA.AllowShort(x121EAAllowShort);
|
||||||
|
x121EA.ReuiredSignalVerifications(x121EAReuiredSignalVerifications);
|
||||||
|
x121EA.GetVerificationFromOtherTimeFrames(x121EAGetVerificationFromOtherTimeFrames);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Risk Management ...
|
||||||
x121EA.Volume(x121EAVolume);
|
x121EA.Volume(x121EAVolume);
|
||||||
x121EA.TPPoint(x121EATPPoint);
|
x121EA.TPPoint(x121EATPPoint);
|
||||||
x121EA.SLPoint(x121EASLPoint);
|
x121EA.SLPoint(x121EASLPoint);
|
||||||
x121EA.IgnoreSL(x121EAIgnoreSL);
|
x121EA.IgnoreSL(x121EAIgnoreSL);
|
||||||
x121EA.IgnoreTP(x121EAIgnoreTP);
|
x121EA.IgnoreTP(x121EAIgnoreTP);
|
||||||
x121EA.AllowLong(x121EAAllowLong);
|
|
||||||
x121EA.AllowShort(x121EAAllowShort);
|
|
||||||
x121EA.CloseOnOpposit(x121EACloseOnOpposit);
|
|
||||||
x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades);
|
x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades);
|
||||||
x121EA.RestingAfterHedge(x121EARestingAfterHedge);
|
|
||||||
|
//
|
||||||
|
// Protection ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Signalling ...
|
||||||
|
x121EA.CloseOnOpposit(x121EACloseOnOpposit);
|
||||||
|
x121EA.EndSignallingHoure(x121EAEndSignallingHoure);
|
||||||
x121EA.CloseOnSpecificTime(x121EACloseOnSpecificTime);
|
x121EA.CloseOnSpecificTime(x121EACloseOnSpecificTime);
|
||||||
x121EA.MinRequiredProfitPerTrade(x121EAMinRequiredProfitPerTrade);
|
x121EA.StartSignallingHoure(x121EAStartSignallingHoure);
|
||||||
x121EA.ReuiredSignalVerifications(x121EAReuiredSignalVerifications);
|
|
||||||
x121EA.MinRequiredProfitPerVolumeFactor(x121EAMinRequiredProfitPerVolumeFactor);
|
|
||||||
x121EA.GetVerificationFromOtherTimeFrames(x121EAGetVerificationFromOtherTimeFrames);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
x121EA.AllowSupport(x121EAAllowSupport);
|
// Trailling ...
|
||||||
|
|
||||||
//
|
|
||||||
// Grid System ...
|
|
||||||
x121EA.AllowGrid(x121EAAllowGrid);
|
|
||||||
x121EA.GridDistance(x121EAGridDistance);
|
|
||||||
x121EA.GridVolumeMultiplier(x121EAGridVolumeMultiplier);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Recovery System ...
|
|
||||||
x121EA.AllowRecovery(x121EAAllowRecovery);
|
|
||||||
x121EA.RecoveryDistance(x121EARecoveryDistance);
|
|
||||||
x121EA.RecoveryVolumeMultiplier(x121EARecoveryVolumeMultiplier);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Stop Loss Trailing ...
|
|
||||||
x121EA.AllowTrailStop(x121EAAllowTrailStop);
|
x121EA.AllowTrailStop(x121EAAllowTrailStop);
|
||||||
x121EA.NextTrailPoint(x121EANextTrailPoint);
|
x121EA.NextTrailPoint(x121EANextTrailPoint);
|
||||||
x121EA.FirstTrailPoint(x121EAFirstTrailPoint);
|
x121EA.FirstTrailPoint(x121EAFirstTrailPoint);
|
||||||
@@ -218,7 +242,36 @@ bool InitialEA()
|
|||||||
x121EA.FirstTrailDistance(x121EAFirstTrailDistance);
|
x121EA.FirstTrailDistance(x121EAFirstTrailDistance);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configure Alert ...
|
// Supporting ...
|
||||||
|
x121EA.AllowSupport(x121EAAllowSupport);
|
||||||
|
x121EA.MaxNumberOfSupports(x121EAMaxNumberOfSupports);
|
||||||
|
x121EA.SupportVolumeMultiplier(x121EASupportVolumeMultiplier);
|
||||||
|
x121EA.MaxAllowedSupportVolume(x121EAMaxAllowedSupportVolume);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Grid ...
|
||||||
|
x121EA.AllowGrid(x121EAAllowGrid);
|
||||||
|
x121EA.GridDistance(x121EAGridDistance);
|
||||||
|
x121EA.MaxNumberOfGrids(x121EAMaxNumberOfGrids);
|
||||||
|
x121EA.GridVolumeMultiplier(x121EAGridVolumeMultiplier);
|
||||||
|
x121EA.MaxAllowedGridVolume(x121EAMaxAllowedGridVolume);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Recovery ...
|
||||||
|
x121EA.AllowRecovery(x121EAAllowRecovery);
|
||||||
|
x121EA.RecoveryDistance(x121EARecoveryDistance);
|
||||||
|
x121EA.MaxNumberOfRecoveries(x121EAMaxNumberOfRecoveries);
|
||||||
|
x121EA.RecoveryVolumeMultiplier(x121EARecoveryVolumeMultiplier);
|
||||||
|
x121EA.MaxAllowedRecoveryVolume(x121EAMaxAllowedRecoveryVolume);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hedging ...
|
||||||
|
x121EA.RestingAfterHedge(x121EARestingAfterHedge);
|
||||||
|
x121EA.MinRequiredProfitPerTrade(x121EAMinRequiredProfitPerTrade);
|
||||||
|
x121EA.MinRequiredProfitPerVolumeFactor(x121EAMinRequiredProfitPerVolumeFactor);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Alert ...
|
||||||
x121EA.SetAlertPrefix(ShortName);
|
x121EA.SetAlertPrefix(ShortName);
|
||||||
x121EA.SetAlertEnableAlerts(x121EAEnableAlerts);
|
x121EA.SetAlertEnableAlerts(x121EAEnableAlerts);
|
||||||
x121EA.SetAlertLogAlerts(x121EALogAlerts);
|
x121EA.SetAlertLogAlerts(x121EALogAlerts);
|
||||||
@@ -227,6 +280,7 @@ bool InitialEA()
|
|||||||
x121EA.SetAlertTerminalAlerts(x121EATerminalAlerts);
|
x121EA.SetAlertTerminalAlerts(x121EATerminalAlerts);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Configure Indicators ...
|
||||||
X121SetupInputs setupInputsDefault;
|
X121SetupInputs setupInputsDefault;
|
||||||
setupInputsDefault.Default();
|
setupInputsDefault.Default();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user