fix x786 ...
This commit is contained in:
@@ -7602,46 +7602,26 @@ private:
|
|||||||
// Current Market ...
|
// Current Market ...
|
||||||
double cLowerHigh = cMarket.don.GetLowerH(cIndex);
|
double cLowerHigh = cMarket.don.GetLowerH(cIndex);
|
||||||
bool cHasX786 = cMarket.HasX786LongConditions();
|
bool cHasX786 = cMarket.HasX786LongConditions();
|
||||||
if (cHasX786)
|
|
||||||
{
|
|
||||||
sl = cLowerHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Short Market ...
|
// Short Market ...
|
||||||
double sLowerHigh = sMarket.don.GetLowerH(cIndex);
|
double sLowerHigh = sMarket.don.GetLowerH(cIndex);
|
||||||
bool sHasX786 = sMarket.HasX786LongConditions();
|
bool sHasX786 = sMarket.HasX786LongConditions();
|
||||||
if (sHasX786)
|
|
||||||
{
|
|
||||||
sl = sLowerHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Medium Market ...
|
// Medium Market ...
|
||||||
double mLowerHigh = mMarket.don.GetLowerH(cIndex);
|
double mLowerHigh = mMarket.don.GetLowerH(cIndex);
|
||||||
bool mHasX786 = mMarket.HasX786LongConditions();
|
bool mHasX786 = mMarket.HasX786LongConditions();
|
||||||
if (mHasX786)
|
|
||||||
{
|
|
||||||
sl = mLowerHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Long Market ...
|
// Long Market ...
|
||||||
double lLowerHigh = lMarket.don.GetLowerH(cIndex);
|
double lLowerHigh = lMarket.don.GetLowerH(cIndex);
|
||||||
bool lHasX786 = lMarket.HasX786LongConditions();
|
bool lHasX786 = lMarket.HasX786LongConditions();
|
||||||
if (lHasX786)
|
|
||||||
{
|
|
||||||
sl = lLowerHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hind Market ...
|
// Hind Market ...
|
||||||
double hLowerHigh = hMarket.don.GetLowerH(cIndex);
|
double hLowerHigh = hMarket.don.GetLowerH(cIndex);
|
||||||
bool hHasX786 = hMarket.HasX786LongConditions();
|
bool hHasX786 = hMarket.HasX786LongConditions();
|
||||||
if (hHasX786)
|
|
||||||
{
|
|
||||||
sl = hLowerHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
@@ -7669,6 +7649,28 @@ private:
|
|||||||
//
|
//
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
if (cHasX786)
|
||||||
|
{
|
||||||
|
sl = cLowerHigh;
|
||||||
|
}
|
||||||
|
else if (sHasX786)
|
||||||
|
{
|
||||||
|
sl = sLowerHigh;
|
||||||
|
}
|
||||||
|
else if (mHasX786)
|
||||||
|
{
|
||||||
|
sl = mLowerHigh;
|
||||||
|
}
|
||||||
|
else if (lHasX786)
|
||||||
|
{
|
||||||
|
sl = lLowerHigh;
|
||||||
|
}
|
||||||
|
else if (hHasX786)
|
||||||
|
{
|
||||||
|
sl = hLowerHigh;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
r2r = 2;
|
r2r = 2;
|
||||||
}
|
}
|
||||||
@@ -8753,46 +8755,26 @@ private:
|
|||||||
// Current Market ...
|
// Current Market ...
|
||||||
double cUpperLow = cMarket.don.GetUpperL(cIndex);
|
double cUpperLow = cMarket.don.GetUpperL(cIndex);
|
||||||
bool cHasX786 = cMarket.HasX786ShortConditions();
|
bool cHasX786 = cMarket.HasX786ShortConditions();
|
||||||
if (cHasX786)
|
|
||||||
{
|
|
||||||
sl = cUpperLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Short Market ...
|
// Short Market ...
|
||||||
double sUpperLow = sMarket.don.GetUpperL(cIndex);
|
double sUpperLow = sMarket.don.GetUpperL(cIndex);
|
||||||
bool sHasX786 = sMarket.HasX786ShortConditions();
|
bool sHasX786 = sMarket.HasX786ShortConditions();
|
||||||
if (sHasX786)
|
|
||||||
{
|
|
||||||
sl = sUpperLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Medium Market ...
|
// Medium Market ...
|
||||||
double mUpperLow = mMarket.don.GetUpperL(cIndex);
|
double mUpperLow = mMarket.don.GetUpperL(cIndex);
|
||||||
bool mHasX786 = mMarket.HasX786ShortConditions();
|
bool mHasX786 = mMarket.HasX786ShortConditions();
|
||||||
if (mHasX786)
|
|
||||||
{
|
|
||||||
sl = mUpperLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Long Market ...
|
// Long Market ...
|
||||||
double lUpperLow = lMarket.don.GetUpperL(cIndex);
|
double lUpperLow = lMarket.don.GetUpperL(cIndex);
|
||||||
bool lHasX786 = lMarket.HasX786ShortConditions();
|
bool lHasX786 = lMarket.HasX786ShortConditions();
|
||||||
if (lHasX786)
|
|
||||||
{
|
|
||||||
sl = lUpperLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hind Market ...
|
// Hind Market ...
|
||||||
double hUpperLow = hMarket.don.GetUpperL(cIndex);
|
double hUpperLow = hMarket.don.GetUpperL(cIndex);
|
||||||
bool hHasX786 = hMarket.HasX786ShortConditions();
|
bool hHasX786 = hMarket.HasX786ShortConditions();
|
||||||
if (hHasX786)
|
|
||||||
{
|
|
||||||
sl = hUpperLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
@@ -8820,6 +8802,28 @@ private:
|
|||||||
//
|
//
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
if (cHasX786)
|
||||||
|
{
|
||||||
|
sl = cUpperLow;
|
||||||
|
}
|
||||||
|
else if (sHasX786)
|
||||||
|
{
|
||||||
|
sl = sUpperLow;
|
||||||
|
}
|
||||||
|
else if (mHasX786)
|
||||||
|
{
|
||||||
|
sl = mUpperLow;
|
||||||
|
}
|
||||||
|
else if (lHasX786)
|
||||||
|
{
|
||||||
|
sl = lUpperLow;
|
||||||
|
}
|
||||||
|
else if (hHasX786)
|
||||||
|
{
|
||||||
|
sl = hUpperLow;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
r2r = 2;
|
r2r = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,54 +418,106 @@ public:
|
|||||||
void HandleEQMState(XSignal &signals[])
|
void HandleEQMState(XSignal &signals[])
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
XSignal accepted[];
|
||||||
bool equityReached = !mTrader.CheckEquityForTrade();
|
bool equityReached = !mTrader.CheckEquityForTrade();
|
||||||
bool maxAllowedReached = !mTrader.CheckPositionsForTrade();
|
bool maxAllowedReached = !mTrader.CheckPositionsForTrade();
|
||||||
bool enableEQM = equityReached || maxAllowedReached;
|
bool enableEQM = equityReached || maxAllowedReached;
|
||||||
// if (!enableEQM)
|
if (!enableEQM)
|
||||||
// {
|
{
|
||||||
// //
|
return;
|
||||||
// return;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
int signalsCount = ArraySize(signals);
|
int signalsCount = ArraySize(signals);
|
||||||
if (IsValidSize(signalsCount))
|
if (IsValidSize(signalsCount))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Print("Cnverts " + ToString(signalsCount) + " Signal using SupRes ...");
|
// Extract required Data ...
|
||||||
|
XPosition positions[];
|
||||||
|
int positionsCount = mTrader.GetPositions(
|
||||||
|
positions);
|
||||||
|
if (!IsValidSize(positionsCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int longs = 0;
|
||||||
|
double longProfits = 0;
|
||||||
|
double longVolumes = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
int shorts = 0;
|
||||||
|
double shortProfits = 0;
|
||||||
|
double shortVolumes = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
CountPositions(
|
||||||
|
positions,
|
||||||
|
longs,
|
||||||
|
longProfits,
|
||||||
|
longVolumes,
|
||||||
|
shorts,
|
||||||
|
shortProfits,
|
||||||
|
shortVolumes //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < signalsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSignal iSignal = signals[i];
|
||||||
|
bool isLong = IsLong(iSignal.type);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canAccept =
|
||||||
|
//
|
||||||
|
isLong
|
||||||
|
? longs == 0
|
||||||
|
: shorts == 0
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!canAccept)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iSignal.provider = XEQMSupportToken;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iSignal,
|
||||||
|
accepted //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int acceptedCount = ArraySize(accepted);
|
||||||
|
if (!IsValidSize(acceptedCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Execute EQM Signals ...
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT reasons[];
|
||||||
|
int executed = mTrader.ExecuteSignals(
|
||||||
|
accepted,
|
||||||
|
reasons,
|
||||||
|
ORDER_TIME_GTC,
|
||||||
|
NULL,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
if (executed > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string message = "EQM Execute " + ToString(executed) + " Signals ...";
|
||||||
|
|
||||||
|
//
|
||||||
|
mAlert.Alert(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //
|
|
||||||
// string mSymbols[];
|
|
||||||
// XSCPositionHolder *mHolders[];
|
|
||||||
// int symbolsCount = FilterSymbolBasedPositions(
|
|
||||||
// mSymbols,
|
|
||||||
// mHolders //
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// for (int i = 0; i < symbolsCount; i++)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// string iSymbol = mSymbols[i];
|
|
||||||
// XSCPositionHolder *iHolder = mHolders[i];
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // We Can Select Multiple Positions for Place EQM Supports ...
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Select Max In Drawdown Position and Protect it ...
|
|
||||||
// XPosition iSelectedPosition;
|
|
||||||
// bool iHasPosition = iHolder.GetMaxInDrawdown(iSelectedPosition);
|
|
||||||
// if (iHasPosition)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // Try to Protect Max In Drawdown Positions Position ...
|
|
||||||
// PlaceEQMOrders(iSelectedPosition);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -730,7 +782,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void HandleTrailManagement(XPosition &positions[])
|
void HandleTrailManagement(XPosition &positions[])
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
@@ -761,7 +813,8 @@ public:
|
|||||||
//
|
//
|
||||||
bool canManageState =
|
bool canManageState =
|
||||||
//
|
//
|
||||||
iPosition.provider != XEQMSupportToken
|
true
|
||||||
|
// iPosition.provider != XEQMSupportToken
|
||||||
// &&
|
// &&
|
||||||
// iPosition.provider != "WSC"
|
// iPosition.provider != "WSC"
|
||||||
//
|
//
|
||||||
@@ -818,7 +871,7 @@ public:
|
|||||||
// IsLong(iPosition.type)
|
// IsLong(iPosition.type)
|
||||||
// ? iPosition.sl + appliedSL
|
// ? iPosition.sl + appliedSL
|
||||||
// : iPosition.sl - appliedSL;
|
// : iPosition.sl - appliedSL;
|
||||||
|
|
||||||
//
|
//
|
||||||
double sl =
|
double sl =
|
||||||
IsLong(iPosition.type)
|
IsLong(iPosition.type)
|
||||||
@@ -1130,6 +1183,9 @@ public:
|
|||||||
// Cleaning Source ...
|
// Cleaning Source ...
|
||||||
Clean(signals);
|
Clean(signals);
|
||||||
|
|
||||||
|
//
|
||||||
|
XSignal mEQMManaged[];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Loop through Signals for Management ...
|
// Loop through Signals for Management ...
|
||||||
for (int i = 0; i < tmpsCount; i++)
|
for (int i = 0; i < tmpsCount; i++)
|
||||||
@@ -1186,38 +1242,31 @@ public:
|
|||||||
//
|
//
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (positionsCount < 4)
|
//
|
||||||
|
else if (positionsCount < GetMaxAllowedPositions())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Next Signal in a While of Specific Provider ...
|
// Next Signal in a While of Specific Provider ...
|
||||||
|
|
||||||
//
|
|
||||||
// Find Longest Position and Check it's Age ...
|
|
||||||
// Compare it by min age for same provider signals ...
|
|
||||||
XPosition youngest;
|
|
||||||
int youngestAge = GetYoungest(
|
|
||||||
youngest,
|
|
||||||
positions //
|
|
||||||
);
|
|
||||||
if (youngestAge == -1 || youngestAge < minDistanceBetweenTwoSameProviderSignal)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
AddRef(
|
||||||
iSignal,
|
iSignal,
|
||||||
signals //
|
signals //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// if (youngest.profit > 0)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iSignal,
|
||||||
|
mEQMManaged //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// else if (profit > 0 && symbolProfit > 0)
|
// else if (profit > 0 && symbolProfit > 0)
|
||||||
// {
|
// {
|
||||||
// //
|
// //
|
||||||
@@ -1228,6 +1277,12 @@ public:
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidSize(ArraySize(mEQMManaged)))
|
||||||
|
{
|
||||||
|
HandleEQMState(mEQMManaged);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(signals);
|
result = ArraySize(signals);
|
||||||
|
|
||||||
@@ -1352,6 +1407,56 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ManageUnExecutedSignals(
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT &states[],
|
||||||
|
XSignal &unExecutedSignals[] //
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSignal filteredSignals[];
|
||||||
|
|
||||||
|
//
|
||||||
|
int unExecutedSignalsCount = ArraySize(unExecutedSignals);
|
||||||
|
if (!IsValidSize(unExecutedSignalsCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < unExecutedSignalsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT iState = states[i];
|
||||||
|
bool isStateValid =
|
||||||
|
//
|
||||||
|
iState == X_SIGNAL_EXECUTION_FAILED_NO_EQUITY ||
|
||||||
|
iState == X_SIGNAL_EXECUTION_FAILED_MAX_REACHED
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!isStateValid)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
unExecutedSignals[i],
|
||||||
|
filteredSignals //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int filteredSignalsCount = ArraySize(filteredSignals);
|
||||||
|
if (!IsValidSize(filteredSignalsCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
HandleEQMState(filteredSignals);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protected ...
|
// Protected ...
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -2746,6 +2746,15 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// When Some Errors happens in Executing Signals ...
|
||||||
|
virtual void ManageUnExecutedSignals(
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT &states[],
|
||||||
|
XSignal &unExecutedSignals[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Execute Provided Signals ...
|
// Execute Provided Signals ...
|
||||||
virtual void HandleSignalsExecution(XSignal &signals[])
|
virtual void HandleSignalsExecution(XSignal &signals[])
|
||||||
@@ -2800,9 +2809,11 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Try to Execute Signals ...
|
// Try to Execute Signals ...
|
||||||
|
XSignal notExecuteds[];
|
||||||
ENUM_X_SIGNAL_EXECUTION_RESULT reasons[];
|
ENUM_X_SIGNAL_EXECUTION_RESULT reasons[];
|
||||||
int executedSignalsCount = mTrader.ExecuteSignals(
|
int executedSignalsCount = mTrader.ExecuteSpecifiedSignals(
|
||||||
filteredSignals,
|
filteredSignals,
|
||||||
|
notExecuteds, // Not Executed Signals
|
||||||
reasons
|
reasons
|
||||||
//
|
//
|
||||||
);
|
);
|
||||||
@@ -2837,6 +2848,16 @@ public:
|
|||||||
message = "(" + ToString(executedSignalsCount) + ") Signals Executed Successfully ...";
|
message = "(" + ToString(executedSignalsCount) + ") Signals Executed Successfully ...";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (ArraySize(notExecuteds) > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ManageUnExecutedSignals(
|
||||||
|
reasons,
|
||||||
|
notExecuteds //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (IsValid(message))
|
if (IsValid(message))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1390,6 +1390,63 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int ExecuteSpecifiedSignals(
|
||||||
|
XSignal &signals[], // Collection of Signal for Execution
|
||||||
|
XSignal ¬Executeds[], // Not Executed Signal
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT &states[], // Signal Execution Result
|
||||||
|
ENUM_ORDER_TYPE_TIME lifetime = ORDER_TIME_GTC, // Order LifeTime
|
||||||
|
datetime expiration = NULL, // order expiration time
|
||||||
|
bool checkPolicies = true // Check Account Policies
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(states);
|
||||||
|
Clean(notExecuteds);
|
||||||
|
|
||||||
|
//
|
||||||
|
int signalsCount = ArraySize(signals);
|
||||||
|
if (signalsCount <= 0)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayResize(states, signalsCount);
|
||||||
|
ArrayInitialize(states, X_SIGNAL_EXECUTION_UNKNOWN);
|
||||||
|
for (int i = 0; i < signalsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isExecuted = ExecuteSignal(
|
||||||
|
signals[i],
|
||||||
|
states[i],
|
||||||
|
lifetime,
|
||||||
|
expiration
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isExecuted)
|
||||||
|
{
|
||||||
|
result++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
signals[i],
|
||||||
|
notExecuteds //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Regular Trade Actions ...
|
// Regular Trade Actions ...
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
long x121EAMagicNumber = 78692110; // Magic Number
|
long x121EAMagicNumber = 78692110; // Magic Number
|
||||||
int x121EASlippage = 10; // Slippgae
|
int x121EASlippage = 10; // Slippgae
|
||||||
string x121EASymbols = "EURUSDb"; // Symbols
|
string x121EASymbols = "XAUUSDb"; // Symbols
|
||||||
//
|
//
|
||||||
bool x121EAAllowLong = true; // Allow Long Trades
|
bool x121EAAllowLong = true; // Allow Long Trades
|
||||||
bool x121EAAllowShort = true; // Allow Short Trades
|
bool x121EAAllowShort = true; // Allow Short Trades
|
||||||
@@ -41,7 +41,7 @@ int x121EAManageInterval = 0; // Manager Check Intervals Second
|
|||||||
int x121EAMaxAllowedPositions = 5; // Max Allowed Positions
|
int x121EAMaxAllowedPositions = 5; // Max Allowed Positions
|
||||||
double x121EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades
|
double x121EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades
|
||||||
double x121EAMinProfitPerTrade = 0; // Min Profit Per Trade based On Volume Factor (Hedge)
|
double x121EAMinProfitPerTrade = 0; // Min Profit Per Trade based On Volume Factor (Hedge)
|
||||||
double x121EAMinProfitPerVolumeFactor = 0.0; // Min Volume Factor for Calculating Profit (Hedge)
|
double x121EAMinProfitPerVolumeFactor = 0.0; // Min Volume Factor for Calculating Profit (Hedge)
|
||||||
double x121EAMaxAllowedDrawdownFactor = 0.002; // Max Allowed Drawdown Factor
|
double x121EAMaxAllowedDrawdownFactor = 0.002; // Max Allowed Drawdown Factor
|
||||||
//
|
//
|
||||||
double x121EAVolume = 0.01; // Static Volume
|
double x121EAVolume = 0.01; // Static Volume
|
||||||
@@ -317,8 +317,8 @@ void ConfigureDescriptor(
|
|||||||
//
|
//
|
||||||
// XICH ...
|
// XICH ...
|
||||||
iDescriptor.inputs.ichInputs.showKumo = false;
|
iDescriptor.inputs.ichInputs.showKumo = false;
|
||||||
iDescriptor.inputs.ichInputs.showKijunSen = false;
|
iDescriptor.inputs.ichInputs.showKijunSen = true;
|
||||||
iDescriptor.inputs.ichInputs.showTenkanSen = false;
|
iDescriptor.inputs.ichInputs.showTenkanSen = true;
|
||||||
iDescriptor.inputs.ichInputs.showChikouSpan = false;
|
iDescriptor.inputs.ichInputs.showChikouSpan = false;
|
||||||
iDescriptor.inputs.ichInputs.showSenkouSpanA = false;
|
iDescriptor.inputs.ichInputs.showSenkouSpanA = false;
|
||||||
iDescriptor.inputs.ichInputs.showSenkouSpanB = false;
|
iDescriptor.inputs.ichInputs.showSenkouSpanB = false;
|
||||||
@@ -337,11 +337,11 @@ void ConfigureDescriptor(
|
|||||||
iDescriptor.inputs.pvInputs.showPeaksAndVales = true;
|
iDescriptor.inputs.pvInputs.showPeaksAndVales = true;
|
||||||
iDescriptor.inputs.pvInputs.showLevels = false;
|
iDescriptor.inputs.pvInputs.showLevels = false;
|
||||||
iDescriptor.inputs.pvInputs.showConsolidations = false;
|
iDescriptor.inputs.pvInputs.showConsolidations = false;
|
||||||
iDescriptor.inputs.pvInputs.showFibo1Levels = false;
|
iDescriptor.inputs.pvInputs.showFibo1Levels = true;
|
||||||
iDescriptor.inputs.pvInputs.showFibo2Levels = false;
|
iDescriptor.inputs.pvInputs.showFibo2Levels = true;
|
||||||
iDescriptor.inputs.pvInputs.showFibo3Levels = false;
|
iDescriptor.inputs.pvInputs.showFibo3Levels = true;
|
||||||
iDescriptor.inputs.pvInputs.showFibo4Levels = false;
|
iDescriptor.inputs.pvInputs.showFibo4Levels = true;
|
||||||
iDescriptor.inputs.pvInputs.showFibo5Levels = false;
|
iDescriptor.inputs.pvInputs.showFibo5Levels = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XZG ...
|
// XZG ...
|
||||||
|
|||||||
@@ -4110,3 +4110,58 @@ int GenerateEQMOrders(
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Count Positions from a Collection ...
|
||||||
|
void CountPositions(
|
||||||
|
const XPosition &positions[],
|
||||||
|
int &longs,
|
||||||
|
double &longProfits,
|
||||||
|
double &longVolumes, //
|
||||||
|
//
|
||||||
|
int &shorts,
|
||||||
|
double &shortProfits,
|
||||||
|
double &shortVolumes //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
longs = 0;
|
||||||
|
longProfits = 0;
|
||||||
|
longVolumes = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
shorts = 0;
|
||||||
|
shortProfits = 0;
|
||||||
|
shortVolumes = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
int positionsCount = ArraySize(positions);
|
||||||
|
if (!IsValidSize(positionsCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < positionsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPosition iPosition = positions[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLong = IsLong(iPosition.type);
|
||||||
|
if (isLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
longs++;
|
||||||
|
longProfits += iPosition.profit;
|
||||||
|
longVolumes = iPosition.volume;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
shorts++;
|
||||||
|
shortProfits += iPosition.profit;
|
||||||
|
shortVolumes = iPosition.volume;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user