last works ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -3180,6 +3180,52 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
//
|
||||
// Retrieve Last Open Position Ticket ...
|
||||
ulong GetLastOpenPositionTicket()
|
||||
{
|
||||
//
|
||||
ulong result = 0;
|
||||
|
||||
int positionsCount = PositionsTotal();
|
||||
if (positionsCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = PositionGetTicket(PositionsTotal() - 1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Last Placed Order Ticket ...
|
||||
ulong GetLastPlacedOrderTicket()
|
||||
{
|
||||
//
|
||||
ulong result = 0;
|
||||
|
||||
int ordersCount = OrdersTotal();
|
||||
if (ordersCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (mOrderInfo.SelectByIndex(ordersCount - 1))
|
||||
{
|
||||
result = mOrderInfo.Ticket();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
@@ -3340,49 +3386,6 @@ protected:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Last Open Position Ticket ...
|
||||
ulong GetLastOpenPositionTicket()
|
||||
{
|
||||
//
|
||||
ulong result = 0;
|
||||
|
||||
int positionsCount = PositionsTotal();
|
||||
if (positionsCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = PositionGetTicket(PositionsTotal() - 1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Last Placed Order Ticket ...
|
||||
ulong GetLastPlacedOrderTicket()
|
||||
{
|
||||
//
|
||||
ulong result = 0;
|
||||
|
||||
int ordersCount = OrdersTotal();
|
||||
if (ordersCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (mOrderInfo.SelectByIndex(ordersCount - 1))
|
||||
{
|
||||
result = mOrderInfo.Ticket();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract Specific Deals Position's Pack ...
|
||||
// this used when a Position SL or TP triggered and we want to close
|
||||
|
||||
+26
-20
@@ -45,6 +45,7 @@ input bool x121EAAllowLong = true; // Allow Long Trades
|
||||
input bool x121EAAllowShort = true; // Allow Short Trades
|
||||
input double x121EAMaxAllowedDrawdownFactor = 0.002; // Max Allowed Drawdown Factor
|
||||
input double x121EAVolume = 0.01; // Static Volume
|
||||
input double x121EAR2R = 1; // Risk to Reward Ratio
|
||||
|
||||
//
|
||||
// Vars ...
|
||||
@@ -226,10 +227,11 @@ bool InitialEA()
|
||||
// X786 Signaller ...
|
||||
X786Signaller *x786Signaller = new X786Signaller();
|
||||
x786Signaller.Default();
|
||||
x786Signaller.maxAllowedLong = 0;
|
||||
x786Signaller.maxAllowedShort = 0;
|
||||
x786Signaller.allowLong = false; // x121EAAllowLong;
|
||||
x786Signaller.allowShort = false; // x121EAAllowShort;
|
||||
x786Signaller.r2r = x121EAR2R;
|
||||
x786Signaller.maxAllowedLong = 1;
|
||||
x786Signaller.maxAllowedShort = 1;
|
||||
x786Signaller.allowLong = x121EAAllowLong;
|
||||
x786Signaller.allowShort = x121EAAllowShort;
|
||||
x786Signaller.maxAllowedOpenPositionAge = 0;
|
||||
x786Signaller.minRequiredProfitPerTrade = 0;
|
||||
x786Signaller.openNextPositionOnProfit = false;
|
||||
@@ -241,10 +243,11 @@ bool InitialEA()
|
||||
// X121 Signaller ...
|
||||
X121Signaller *x121Signaller = new X121Signaller();
|
||||
x121Signaller.Default();
|
||||
x121Signaller.maxAllowedLong = 0;
|
||||
x121Signaller.maxAllowedShort = 0;
|
||||
x121Signaller.allowLong = false; // x121EAAllowLong;
|
||||
x121Signaller.allowShort = false; // x121EAAllowShort;
|
||||
x121Signaller.r2r = x121EAR2R;
|
||||
x121Signaller.maxAllowedLong = 1;
|
||||
x121Signaller.maxAllowedShort = 1;
|
||||
x121Signaller.allowLong = x121EAAllowLong;
|
||||
x121Signaller.allowShort = x121EAAllowShort;
|
||||
x121Signaller.maxAllowedOpenPositionAge = 0;
|
||||
x121Signaller.minRequiredProfitPerTrade = 0;
|
||||
x121Signaller.openNextPositionOnProfit = false;
|
||||
@@ -256,8 +259,9 @@ bool InitialEA()
|
||||
// X110 Signaller ...
|
||||
X110Signaller *x110Signaller = new X110Signaller();
|
||||
x110Signaller.Default();
|
||||
x110Signaller.maxAllowedLong = 0;
|
||||
x110Signaller.maxAllowedShort = 0;
|
||||
x110Signaller.r2r = x121EAR2R;
|
||||
x110Signaller.maxAllowedLong = 1;
|
||||
x110Signaller.maxAllowedShort = 1;
|
||||
x110Signaller.allowLong = x121EAAllowLong;
|
||||
x110Signaller.allowShort = x121EAAllowShort;
|
||||
x110Signaller.maxAllowedOpenPositionAge = 0;
|
||||
@@ -271,12 +275,13 @@ bool InitialEA()
|
||||
// X92 Signaller ...
|
||||
X92Signaller *x92Signaller = new X92Signaller();
|
||||
x92Signaller.Default();
|
||||
x92Signaller.r2r = x121EAR2R;
|
||||
x92Signaller.SetSymbol(iSymbol);
|
||||
x92Signaller.SetPeriod(iPeriod);
|
||||
x92Signaller.maxAllowedLong = 0;
|
||||
x92Signaller.maxAllowedShort = 0;
|
||||
x92Signaller.allowLong = false; // x121EAAllowLong;
|
||||
x92Signaller.allowShort = false; // x121EAAllowShort;
|
||||
x92Signaller.maxAllowedLong = 1;
|
||||
x92Signaller.maxAllowedShort = 1;
|
||||
x92Signaller.allowLong = x121EAAllowLong;
|
||||
x92Signaller.allowShort = x121EAAllowShort;
|
||||
x92Signaller.maxAllowedOpenPositionAge = 0;
|
||||
x92Signaller.minRequiredProfitPerTrade = 0;
|
||||
x92Signaller.openNextPositionOnProfit = false;
|
||||
@@ -288,8 +293,9 @@ bool InitialEA()
|
||||
// X128 Signaller ...
|
||||
X128Signaller *x128Signaller = new X128Signaller();
|
||||
x128Signaller.Default();
|
||||
x128Signaller.maxAllowedLong = 0;
|
||||
x128Signaller.maxAllowedShort = 0;
|
||||
x128Signaller.r2r = x121EAR2R;
|
||||
x128Signaller.maxAllowedLong = 1;
|
||||
x128Signaller.maxAllowedShort = 1;
|
||||
x128Signaller.allowLong = false; // x121EAAllowLong;
|
||||
x128Signaller.allowShort = false; // x121EAAllowShort;
|
||||
x128Signaller.maxAllowedOpenPositionAge = 0;
|
||||
@@ -322,12 +328,12 @@ bool InitialEA()
|
||||
ArrayResize(iDescriptor.signallers, 1);
|
||||
|
||||
//
|
||||
// iDescriptor.signallers[idx] = x786Signaller;
|
||||
// idx++;
|
||||
iDescriptor.signallers[idx] = x786Signaller;
|
||||
idx++;
|
||||
// iDescriptor.signallers[idx] = x121Signaller;
|
||||
// idx++;
|
||||
iDescriptor.signallers[idx] = x110Signaller;
|
||||
idx++;
|
||||
// iDescriptor.signallers[idx] = x110Signaller;
|
||||
// idx++;
|
||||
// iDescriptor.signallers[idx] = x92Signaller;
|
||||
// idx++;
|
||||
// iDescriptor.signallers[idx] = x128Signaller;
|
||||
|
||||
@@ -5737,6 +5737,14 @@ bool NotEmpty(T value)
|
||||
return value != EMPTY_VALUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Check a Value Not Empty and Zero ...
|
||||
template <typename T>
|
||||
bool NotEmptyZero(T value)
|
||||
{
|
||||
return value != EMPTY_VALUE && value != 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Add Specified Item to Array ...
|
||||
template <typename T>
|
||||
@@ -5836,6 +5844,11 @@ void Clean(T &buffer[])
|
||||
ArrayFree(buffer);
|
||||
ArrayResize(buffer, 0);
|
||||
}
|
||||
template <typename T>
|
||||
void SpecificClean(T &buffer[])
|
||||
{
|
||||
Clean(buffer);
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Whole Content of Source to Dest array ...
|
||||
|
||||
@@ -3819,6 +3819,94 @@ bool SpecifiedIsPositionsReadyForHedge(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract a Collection of Positions SL ...
|
||||
int ExtractSLs(
|
||||
XPosition &positions[],
|
||||
double &sls[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(sls);
|
||||
|
||||
//
|
||||
int positionsCount = ArraySize(positions);
|
||||
if (!IsValidSize(positionsCount))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < positionsCount; i++)
|
||||
{
|
||||
//
|
||||
XPosition iPosition = positions[i];
|
||||
|
||||
//
|
||||
if (iPosition.sl > 0)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iPosition.sl,
|
||||
sls //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(sls);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract a Colletion of Positions TP ...
|
||||
int ExtractTPs(
|
||||
XPosition &positions[],
|
||||
double &tps[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(tps);
|
||||
|
||||
//
|
||||
int positionsCount = ArraySize(positions);
|
||||
if (!IsValidSize(positionsCount))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < positionsCount; i++)
|
||||
{
|
||||
//
|
||||
XPosition iPosition = positions[i];
|
||||
|
||||
//
|
||||
if (iPosition.tp > 0)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iPosition.tp,
|
||||
tps //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(tps);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve String Representation ...
|
||||
string ToString(ENUM_X_SIGNAL_EXECUTION_RESULT value)
|
||||
|
||||
@@ -156,19 +156,19 @@ public:
|
||||
//
|
||||
result =
|
||||
//
|
||||
// condition1
|
||||
// //
|
||||
// ||
|
||||
// //
|
||||
// condition2
|
||||
// //
|
||||
// ||
|
||||
// //
|
||||
condition1
|
||||
//
|
||||
||
|
||||
//
|
||||
condition2
|
||||
//
|
||||
||
|
||||
//
|
||||
condition3
|
||||
// //
|
||||
// ||
|
||||
// //
|
||||
// condition4
|
||||
//
|
||||
||
|
||||
//
|
||||
condition4
|
||||
//
|
||||
;
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bullishScore > bearishScore;
|
||||
bullishScore > bearishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -293,19 +293,19 @@ public:
|
||||
//
|
||||
result =
|
||||
//
|
||||
// condition1
|
||||
condition1
|
||||
|
||||
||
|
||||
//
|
||||
condition2
|
||||
//
|
||||
||
|
||||
//
|
||||
// ||
|
||||
// //
|
||||
// condition2
|
||||
// //
|
||||
// ||
|
||||
// //
|
||||
condition3
|
||||
// //
|
||||
// ||
|
||||
// //
|
||||
// condition4
|
||||
//
|
||||
||
|
||||
//
|
||||
condition4
|
||||
//
|
||||
;
|
||||
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bearishScore > bullishScore ;
|
||||
bearishScore > bullishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -326,3 +326,5 @@ public:
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
@@ -73,6 +73,14 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
conditions.GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
@@ -98,6 +106,13 @@ public:
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bullishScore > bearishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
@@ -129,6 +144,14 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
conditions.GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
@@ -160,6 +183,13 @@ public:
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bearishScore > bullishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
|
||||
@@ -74,6 +74,14 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
conditions.GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
@@ -105,6 +113,13 @@ public:
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bullishScore > bearishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
@@ -125,6 +140,10 @@ public:
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
tp = 0;
|
||||
sl = 0;
|
||||
|
||||
//
|
||||
result = allowShort;
|
||||
if (!result)
|
||||
@@ -133,8 +152,12 @@ public:
|
||||
}
|
||||
|
||||
//
|
||||
tp = 0;
|
||||
sl = 0;
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
conditions.GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
result =
|
||||
@@ -167,6 +190,13 @@ public:
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bearishScore > bullishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
|
||||
@@ -96,6 +96,14 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
conditions.GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
bool isRejected =
|
||||
//
|
||||
@@ -135,6 +143,13 @@ public:
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bullishScore > bearishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
@@ -182,6 +197,14 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
conditions.GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
bool isRejected =
|
||||
//
|
||||
@@ -221,6 +244,13 @@ public:
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
result =
|
||||
bearishScore > bullishScore * 1.5;
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user