last ...
This commit is contained in:
@@ -1070,13 +1070,17 @@ struct X121SignalGenerator
|
||||
bool HasLongConditions(
|
||||
X121SetupConditions &conditions, // Conditions
|
||||
int &pusher, // Pushers
|
||||
string &provider // Provider
|
||||
string &provider, // Provider
|
||||
double &tp, // Provided TP
|
||||
double &sl // Provided SL
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
tp = 0;
|
||||
sl = 0;
|
||||
pusher = 0;
|
||||
|
||||
//
|
||||
@@ -1669,8 +1673,6 @@ struct X121SignalGenerator
|
||||
result =
|
||||
//
|
||||
pusher >= 1 &&
|
||||
// !isOSCShortVerified &&
|
||||
// bullishScore > bearishScore * 2 &&
|
||||
(
|
||||
//
|
||||
long1
|
||||
@@ -1764,13 +1766,17 @@ struct X121SignalGenerator
|
||||
bool HasShortConditions(
|
||||
X121SetupConditions &conditions, // Conditions
|
||||
int &pusher, // Pushers
|
||||
string &provider // Provider
|
||||
string &provider, // Provider
|
||||
double &tp, // Provided TP
|
||||
double &sl // Provided SL
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
tp = 0;
|
||||
sl = 0;
|
||||
pusher = 0;
|
||||
|
||||
//
|
||||
@@ -2363,8 +2369,6 @@ struct X121SignalGenerator
|
||||
result =
|
||||
//
|
||||
pusher >= 1 &&
|
||||
// !isOSCLongVerified &&
|
||||
// bearishScore > bullishScore * 2 &&
|
||||
(
|
||||
//
|
||||
short1
|
||||
@@ -2688,7 +2692,7 @@ struct X121SignalGenerator
|
||||
//
|
||||
bool IsConditionsValidForLong(
|
||||
X121SetupConditions &conditions, // Conditions
|
||||
int verifications = 4 // Number of Verifications
|
||||
int verifications = 2 // Number of Verifications
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -2944,7 +2948,7 @@ struct X121SignalGenerator
|
||||
//
|
||||
bool IsConditionsValidForShort(
|
||||
X121SetupConditions &conditions, // Conditions
|
||||
int verifications = 4 // Number of Verifications
|
||||
int verifications = 2 // Number of Verifications
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -3011,6 +3015,8 @@ struct X121SignalGenerator
|
||||
XSignal &signal, // Signal if Exists
|
||||
int &pusher, // Pushers
|
||||
string &provider, // Signal Provider Name
|
||||
double &tp, // Provided TP
|
||||
double &sl, // Provided SL
|
||||
bool _useSupport, // Generate Support Signals
|
||||
bool _allowLong, // Allow Long Signals
|
||||
bool _allowShort, // Allow Short Signals
|
||||
@@ -3046,7 +3052,9 @@ struct X121SignalGenerator
|
||||
HasLongConditions(
|
||||
conditions,
|
||||
pusher,
|
||||
provider //
|
||||
provider,
|
||||
tp,
|
||||
sl //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -3069,7 +3077,9 @@ struct X121SignalGenerator
|
||||
HasShortConditions(
|
||||
conditions,
|
||||
pusher,
|
||||
provider //
|
||||
provider,
|
||||
tp,
|
||||
sl //
|
||||
);
|
||||
|
||||
//
|
||||
|
||||
@@ -709,6 +709,8 @@ public:
|
||||
X121SetupConditions &conditions,
|
||||
int &pushers,
|
||||
string &provider,
|
||||
double &tp,
|
||||
double &sl,
|
||||
ENUM_X_MARKET_CYCLES cycle = X_MARKET_CYCLE_UNKNOWN,
|
||||
bool allowSupports = false, // Allow Support Signal Generating ...
|
||||
bool allowLong = false,
|
||||
@@ -753,6 +755,8 @@ public:
|
||||
signal,
|
||||
pushers,
|
||||
provider,
|
||||
tp,
|
||||
sl,
|
||||
allowSupports,
|
||||
allowLong,
|
||||
allowShort,
|
||||
|
||||
@@ -3578,6 +3578,8 @@ public:
|
||||
|
||||
//
|
||||
// Current ...
|
||||
double cTP = 0;
|
||||
double cSL = 0;
|
||||
XSignal cSignal;
|
||||
int cPusher = 0;
|
||||
bool cHasSignal = false;
|
||||
@@ -3586,6 +3588,8 @@ public:
|
||||
|
||||
//
|
||||
// Short ...
|
||||
double sTP = 0;
|
||||
double sSL = 0;
|
||||
XSignal sSignal;
|
||||
int sPusher = 0;
|
||||
bool sHasSignal = false;
|
||||
@@ -3594,6 +3598,8 @@ public:
|
||||
|
||||
//
|
||||
// Medium ...
|
||||
double mTP = 0;
|
||||
double mSL = 0;
|
||||
XSignal mSignal;
|
||||
int mPusher = 0;
|
||||
bool mHasSignal = false;
|
||||
@@ -3602,6 +3608,8 @@ public:
|
||||
|
||||
//
|
||||
// Long ...
|
||||
double lTP = 0;
|
||||
double lSL = 0;
|
||||
XSignal lSignal;
|
||||
int lPusher = 0;
|
||||
bool lHasSignal = false;
|
||||
@@ -3610,6 +3618,8 @@ public:
|
||||
|
||||
//
|
||||
// Hind ...
|
||||
double hTP = 0;
|
||||
double hSL = 0;
|
||||
XSignal hSignal;
|
||||
int hPusher = 0;
|
||||
bool hHasSignal = false;
|
||||
@@ -3647,10 +3657,10 @@ public:
|
||||
|
||||
//
|
||||
bool useCMarket = true;
|
||||
bool useSMarket = false;
|
||||
bool useMMarket = false;
|
||||
bool useLMarket = false;
|
||||
bool useHMarket = false;
|
||||
bool useSMarket = true;
|
||||
bool useMMarket = true;
|
||||
bool useLMarket = true;
|
||||
bool useHMarket = true;
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -3674,6 +3684,8 @@ public:
|
||||
cConditions,
|
||||
cPusher,
|
||||
cProvider,
|
||||
cTP,
|
||||
cSL,
|
||||
X_MARKET_CYCLE_UNKNOWN,
|
||||
canSupport,
|
||||
allowLong,
|
||||
@@ -3706,6 +3718,8 @@ public:
|
||||
sConditions,
|
||||
sPusher,
|
||||
sProvider,
|
||||
sTP,
|
||||
sSL,
|
||||
X_MARKET_CYCLE_SHORT,
|
||||
canSupport,
|
||||
allowLong,
|
||||
@@ -3738,6 +3752,8 @@ public:
|
||||
mConditions,
|
||||
mPusher,
|
||||
mProvider,
|
||||
mTP,
|
||||
mSL,
|
||||
X_MARKET_CYCLE_MEDIUM,
|
||||
canSupport,
|
||||
allowLong,
|
||||
@@ -3770,6 +3786,8 @@ public:
|
||||
lConditions,
|
||||
lPusher,
|
||||
lProvider,
|
||||
lTP,
|
||||
lSL,
|
||||
X_MARKET_CYCLE_LONG,
|
||||
canSupport,
|
||||
allowLong,
|
||||
@@ -3802,6 +3820,8 @@ public:
|
||||
hConditions,
|
||||
hPusher,
|
||||
hProvider,
|
||||
hTP,
|
||||
hSL,
|
||||
X_MARKET_CYCLE_HIND,
|
||||
canSupport,
|
||||
allowLong,
|
||||
@@ -4089,6 +4109,13 @@ public:
|
||||
//
|
||||
bool isSignalValid = false;
|
||||
|
||||
//
|
||||
isSignalValid = IsSignalDelayPassed(iSignal);
|
||||
if (!isSignalValid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Close All Positions when Opposit Signal Recieved ...
|
||||
if (mCloseOnOpposit)
|
||||
@@ -4188,21 +4215,149 @@ public:
|
||||
}
|
||||
|
||||
//
|
||||
// Only Accept Next Same Type when Previous in Profit ...
|
||||
if (isSignalValid)
|
||||
{
|
||||
//
|
||||
// Check Delay Between Two Signals ...
|
||||
bool isDelayPassed = IsSignalDelayPassed(iSignal);
|
||||
ENUM_X_POSITION_TYPES iType =
|
||||
ToPositionType(iSignal.type);
|
||||
XPosition iSymbolsPositions[];
|
||||
int iSymbolsPositionsCount = mTrader.GetPositions(
|
||||
iSymbolsPositions,
|
||||
iSignal.symbol,
|
||||
NULL, // Provider
|
||||
NULL, // Period
|
||||
iType, // Type
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
if (isDelayPassed)
|
||||
int iSupportsCount = 0;
|
||||
if (IsValidSize(iSymbolsPositionsCount))
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iSignal,
|
||||
eSignals //
|
||||
// Filter Support Positions ...
|
||||
XPosition iSupports[];
|
||||
iSupportsCount = ExtractSupports(
|
||||
iSymbolsPositions,
|
||||
iSupports //
|
||||
);
|
||||
|
||||
//
|
||||
// Filter Support Positions ...
|
||||
if (IsValidSize(iSupportsCount))
|
||||
{
|
||||
//
|
||||
XPosition tmpPositions[];
|
||||
Copy(
|
||||
iSymbolsPositions,
|
||||
tmpPositions //
|
||||
);
|
||||
|
||||
//
|
||||
Clean(iSymbolsPositions);
|
||||
|
||||
//
|
||||
for (int i = 0; i < iSymbolsPositionsCount; i++)
|
||||
{
|
||||
//
|
||||
XPosition iPosition = tmpPositions[i];
|
||||
|
||||
//
|
||||
bool isSupport = IsSupport(iPosition.comment);
|
||||
if (isSupport)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iPosition,
|
||||
iSymbolsPositions //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iSymbolsPositionsCount = ArraySize(iSymbolsPositions);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (IsValidSize(iSymbolsPositionsCount))
|
||||
{
|
||||
//
|
||||
XPosition youngest;
|
||||
int youngestAge = GetYoungest(
|
||||
youngest,
|
||||
iSymbolsPositions //
|
||||
);
|
||||
|
||||
//
|
||||
isSignalValid = youngest.profit > 0.1;
|
||||
}
|
||||
|
||||
//
|
||||
if (!isSignalValid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Multiply Signal Volume ...
|
||||
if (isSignalValid)
|
||||
{
|
||||
//
|
||||
XPosition iSymbolsPositions[];
|
||||
int iSymbolsPositionsCount = mTrader.GetPositions(
|
||||
iSymbolsPositions,
|
||||
iSignal.symbol,
|
||||
NULL, // Provider
|
||||
NULL, // Period
|
||||
NULL, // Type
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
int iSupportsCount = 0;
|
||||
if (IsValidSize(iSymbolsPositionsCount))
|
||||
{
|
||||
//
|
||||
// Filter Support Positions ...
|
||||
XPosition iSupports[];
|
||||
iSupportsCount = ExtractSupports(
|
||||
iSymbolsPositions,
|
||||
iSupports //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
int multiplier =
|
||||
iSupportsCount <= 0
|
||||
? iSymbolsPositionsCount
|
||||
: iSymbolsPositionsCount - iSupportsCount;
|
||||
if (multiplier <= 0)
|
||||
{
|
||||
multiplier = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
multiplier++;
|
||||
}
|
||||
|
||||
//
|
||||
iSignal.volume = iSignal.volume * multiplier;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Signal ...
|
||||
if (isSignalValid)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iSignal,
|
||||
eSignals //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4885,6 +5040,9 @@ private:
|
||||
// Handle Force State Management ...
|
||||
void EQMHandleForceState()
|
||||
{
|
||||
//
|
||||
return;
|
||||
|
||||
//
|
||||
XPosition positions[];
|
||||
int positionsCount = mTrader.GetPositions(positions);
|
||||
|
||||
@@ -328,7 +328,6 @@ public:
|
||||
bool isSlept = IsSlept();
|
||||
if (isSlept)
|
||||
{
|
||||
Print("Slept");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1166,7 +1165,7 @@ protected:
|
||||
//
|
||||
if (mRestingAfterHedge > 0)
|
||||
{
|
||||
Sleep(mRestingAfterHedge * 1000);
|
||||
Sleeping(mRestingAfterHedge);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user