last works ...

This commit is contained in:
2024-06-05 03:51:54 +03:30
parent e4840def0e
commit 1482b30d67
9 changed files with 454 additions and 2548 deletions
+35
View File
@@ -44,6 +44,32 @@
} }
], ],
"in-progress": [ "in-progress": [
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2024-06-05T00:10:14.895Z",
"details": {
"content": "- [] Check Last Time trade for Provider;\n- [] Open Trade only when it's new or Previous in Profit;\n- [] Open Only 2 trade in each Direction at same time;\n- [] Close All Open Trades at Specific Time;\n- [] Enable/Disable Robot time Daily;\n- [] Close Long age Trades;\n- [] Trail or Risk Free Same In Profit Trades when Open New One;",
"mime": "text/markdown"
},
"id": "74",
"references": [],
"title": "add support for:"
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2024-06-05T00:17:33.324Z",
"description": {
"content": "from Provider classes and trader class.\nput them into XEA ...\nans Signallers ...",
"mime": "text/markdown"
},
"id": "75",
"references": [],
"title": "Cleanup all allow long, short, minProfit per trade and drawdown factors variables"
},
{ {
"assignedTo": { "assignedTo": {
"name": "Hadi Khazaee Asl" "name": "Hadi Khazaee Asl"
@@ -81,6 +107,15 @@
"id": "72", "id": "72",
"references": [], "references": [],
"title": "R&D about Volume Profiling" "title": "R&D about Volume Profiling"
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2024-06-05T00:18:44.371Z",
"id": "76",
"references": [],
"title": "Enable Comment Score and Summary on each Tick ..."
} }
], ],
"testing": [ "testing": [
+18 -18
View File
@@ -2540,8 +2540,8 @@ public:
ENUM_XSIGNAL_PROVIDERS name; ENUM_XSIGNAL_PROVIDERS name;
// //
bool enableLong; bool allowLong;
bool enableShort; bool allowShort;
// //
double r2r; double r2r;
@@ -2567,8 +2567,8 @@ public:
name = PROVIDER_NONE; name = PROVIDER_NONE;
// //
enableLong = false; allowLong = false;
enableShort = false; allowShort = false;
// //
r2r = 0; r2r = 0;
@@ -2590,10 +2590,10 @@ public:
// //
name != PROVIDER_NONE && name != PROVIDER_NONE &&
r2r > 0 && r2r > 0 &&
(enableLong (allowLong
? staticVolumeLong > 0 ? staticVolumeLong > 0
: true) && : true) &&
(enableShort (allowShort
? staticVolumeShort > 0 ? staticVolumeShort > 0
: true) : true)
// //
@@ -2642,8 +2642,8 @@ public:
// //
// Validate Signal Type ... // Validate Signal Type ...
result = isLong result = isLong
? enableLong && staticVolumeLong > 0 ? allowLong && staticVolumeLong > 0
: enableShort && staticVolumeShort > 0; : allowShort && staticVolumeShort > 0;
if (!result) if (!result)
{ {
return result; return result;
@@ -2703,8 +2703,8 @@ public:
// //
// Validate Signal Type ... // Validate Signal Type ...
result = isLong result = isLong
? enableLong && staticVolumeLong > 0 ? allowLong && staticVolumeLong > 0
: enableShort && staticVolumeShort > 0; : allowShort && staticVolumeShort > 0;
if (!result) if (!result)
{ {
return result; return result;
@@ -4434,14 +4434,14 @@ public:
conditions.isTenkanSenCrossedUnderKijunSen = isTenkanSenCrossedUnderKijunSen; conditions.isTenkanSenCrossedUnderKijunSen = isTenkanSenCrossedUnderKijunSen;
// //
conditions.isSenkouSpanAOverB = isSenkouSpanACrossedOverB; conditions.isSenkouSpanAOverB = isSenkouSpanAOverB;
conditions.isSenkouSpanAUnderB = isSenkouSpanACrossedUnderB; conditions.isSenkouSpanAUnderB = isSenkouSpanAUnderB;
conditions.isSenkouSpanAOverLast = isSenkouSpanACrossedOverLast; conditions.isSenkouSpanAOverLast = isSenkouSpanAOverLast;
conditions.isSenkouSpanAUnderLast = isSenkouSpanACrossedUnderLast; conditions.isSenkouSpanAUnderLast = isSenkouSpanAUnderLast;
conditions.isFutureSenkouSpanAOverB = isFutureSenkouSpanACrossedOverB; conditions.isFutureSenkouSpanAOverB = isFutureSenkouSpanAOverB;
conditions.isFutureSenkouSpanAUnderB = isFutureSenkouSpanACrossedUnderB; conditions.isFutureSenkouSpanAUnderB = isFutureSenkouSpanAUnderB;
conditions.isFutureSenkouSpanAOverLast = isFutureSenkouSpanACrossedOverLast; conditions.isFutureSenkouSpanAOverLast = isFutureSenkouSpanAOverLast;
conditions.isFutureSenkouSpanAUnderLast = isFutureSenkouSpanACrossedUnderLast; conditions.isFutureSenkouSpanAUnderLast = isFutureSenkouSpanAUnderLast;
// //
conditions.isSenkouSpanACrossedOverB = isSenkouSpanACrossedOverB; conditions.isSenkouSpanACrossedOverB = isSenkouSpanACrossedOverB;
File diff suppressed because it is too large Load Diff
+41 -22
View File
@@ -24,6 +24,7 @@
// //
#include "../Classes/x-saherelm.x121.xea.class.mq5" #include "../Classes/x-saherelm.x121.xea.class.mq5"
#include "../Signallers/x-saherelm.x110.signaller.class.mq5"
#include "../Signallers/x-saherelm.x121.signaller.class.mq5" #include "../Signallers/x-saherelm.x121.signaller.class.mq5"
#include "../Signallers/x-saherelm.x786.signaller.class.mq5" #include "../Signallers/x-saherelm.x786.signaller.class.mq5"
@@ -234,21 +235,33 @@ bool InitialEA()
Clean(iDescriptor.signallers); Clean(iDescriptor.signallers);
// //
ArrayResize(iDescriptor.signallers, 2); ArrayResize(iDescriptor.signallers, 3);
// //
// X786 Signaller ... // X786 Signaller ...
X786Signaller *x786Signaller = new X786Signaller(); X786Signaller *x786Signaller = new X786Signaller();
x786Signaller.Default(); x786Signaller.Default();
x786Signaller.allowLong = false; // x121EAAllowLong;
x786Signaller.allowShort = false; // x121EAAllowShort;
// //
// X121 Signaller ... // X121 Signaller ...
X121Signaller *x121Signaller = new X121Signaller(); X121Signaller *x121Signaller = new X121Signaller();
x121Signaller.Default(); x121Signaller.Default();
x121Signaller.allowLong = false; // x121EAAllowLong;
x121Signaller.allowShort = false; // x121EAAllowShort;
//
// X110 Signaller ...
X110Signaller *x110Signaller = new X110Signaller();
x110Signaller.Default();
x110Signaller.allowLong = x121EAAllowLong;
x110Signaller.allowShort = x121EAAllowShort;
// //
iDescriptor.signallers[0] = x786Signaller; iDescriptor.signallers[0] = x786Signaller;
iDescriptor.signallers[1] = x121Signaller; iDescriptor.signallers[1] = x121Signaller;
iDescriptor.signallers[2] = x110Signaller;
// //
// Set Inputs to Default ... // Set Inputs to Default ...
@@ -988,17 +1001,7 @@ void ApplyPreDefineConfigurations(X121ProviderDescriptor &iDescriptor)
// //
bool isX786 = false; bool isX786 = false;
bool isX121 = false; bool isX121 = false;
bool isX110 = false;
//
// XHULL ...
iDescriptor.inputs.hullInputs.showUpZone = false;
iDescriptor.inputs.hullInputs.showDownZone = false;
//
// XSSLC ...
iDescriptor.inputs.sslcInputs.showUp = false;
iDescriptor.inputs.sslcInputs.showDown = false;
// //
if (isX786) if (isX786)
@@ -1007,22 +1010,38 @@ void ApplyPreDefineConfigurations(X121ProviderDescriptor &iDescriptor)
// //
if (isX121) if (isX121)
{
}
//
if (isX110)
{ {
// //
iDescriptor.inputs.mrbInputs.showFastMa = isX121; iDescriptor.inputs.strInputs.showTrends = isX110;
iDescriptor.inputs.mrbInputs.showSlowMa = isX121;
iDescriptor.inputs.mrbInputs.showRibbon = isX121;
// //
iDescriptor.inputs.mcInputs.showFastMa = isX121; iDescriptor.inputs.mcInputs.showVerifierMa = isX110;
iDescriptor.inputs.mcInputs.showSlowMa = isX121;
iDescriptor.inputs.mcInputs.showVerifierMa = isX121;
// //
iDescriptor.inputs.cheInputs.showLongExit1Line = isX121; iDescriptor.inputs.ichInputs.showKumo = isX110;
iDescriptor.inputs.cheInputs.showShortExit1Line = isX121; iDescriptor.inputs.ichInputs.showKijunSen = isX110;
iDescriptor.inputs.cheInputs.showLongExit2Line = isX121; iDescriptor.inputs.ichInputs.showTenkanSen = isX110;
iDescriptor.inputs.cheInputs.showShortExit2Line = isX121; iDescriptor.inputs.ichInputs.showSenkouSpanA = isX110;
iDescriptor.inputs.ichInputs.showSenkouSpanB = isX110;
//
iDescriptor.inputs.cheInputs.showLongExit1Line = isX110;
iDescriptor.inputs.cheInputs.showShortExit1Line = isX110;
iDescriptor.inputs.cheInputs.showLongExit2Line = isX110;
iDescriptor.inputs.cheInputs.showShortExit2Line = isX110;
//
iDescriptor.inputs.pvInputs.showPeaksAndVales = isX110;
iDescriptor.inputs.pvInputs.showFibo1Levels = isX110;
iDescriptor.inputs.pvInputs.showFibo2Levels = isX110;
iDescriptor.inputs.pvInputs.showFibo3Levels = isX110;
iDescriptor.inputs.pvInputs.showFibo4Levels = isX110;
iDescriptor.inputs.pvInputs.showFibo5Levels = isX110;
} }
} }
+35 -45
View File
@@ -241,6 +241,8 @@ public:
ArraySetAsSeries(chikouSpanBuffer, true); ArraySetAsSeries(chikouSpanBuffer, true);
ArraySetAsSeries(senkouSpanABuffer, true); ArraySetAsSeries(senkouSpanABuffer, true);
ArraySetAsSeries(senkouSpanBBuffer, true); ArraySetAsSeries(senkouSpanBBuffer, true);
ArraySetAsSeries(futureSenkouSpanABuffer, true);
ArraySetAsSeries(futureSenkouSpanBBuffer, true);
// //
mHandler = iCustom( mHandler = iCustom(
@@ -507,21 +509,6 @@ public:
int barIndex // Bar Index int barIndex // Bar Index
) )
{ {
//
barIndex += mInputs.kijunSenLength;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
if (barIndex > ArraySize(senkouSpanABuffer))
{
barIndex = ArraySize(senkouSpanABuffer) - 1;
}
// //
Calculate(); Calculate();
@@ -545,7 +532,7 @@ public:
// //
// Copy Items ... // Copy Items ...
return Copy( return Copy(
start + mInputs.kijunSenLength, start,
count, count,
senkouSpanABuffer, senkouSpanABuffer,
buffer, buffer,
@@ -580,21 +567,6 @@ public:
int barIndex // Bar Index int barIndex // Bar Index
) )
{ {
//
barIndex += mInputs.kijunSenLength;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
if (barIndex > ArraySize(senkouSpanBBuffer))
{
barIndex = ArraySize(senkouSpanBBuffer) - 1;
}
// //
Calculate(); Calculate();
@@ -618,7 +590,7 @@ public:
// //
// Copy Items ... // Copy Items ...
return Copy( return Copy(
start + mInputs.kijunSenLength, start,
count, count,
senkouSpanBBuffer, senkouSpanBBuffer,
buffer, buffer,
@@ -654,10 +626,7 @@ public:
) )
{ {
// //
if (barIndex < 0) barIndex -= mInputs.kijunSenLength;
{
barIndex = 0;
}
// //
Calculate(); Calculate();
@@ -682,9 +651,9 @@ public:
// //
// Copy Items ... // Copy Items ...
return Copy( return Copy(
start, start - mInputs.kijunSenLength,
count, count,
senkouSpanABuffer, futureSenkouSpanABuffer,
buffer, buffer,
forceClean forceClean
// //
@@ -692,7 +661,7 @@ public:
} }
// //
// SenkouSpanB ... // Future SenkouSpanB ...
// //
double GetFutureSenkouSpanB( double GetFutureSenkouSpanB(
@@ -700,10 +669,7 @@ public:
) )
{ {
// //
if (barIndex < 0) barIndex -= mInputs.kijunSenLength;
{
barIndex = 0;
}
// //
Calculate(); Calculate();
@@ -728,9 +694,9 @@ public:
// //
// Copy Items ... // Copy Items ...
return Copy( return Copy(
start, start - mInputs.kijunSenLength,
count, count,
senkouSpanBBuffer, futureSenkouSpanBBuffer,
buffer, buffer,
forceClean forceClean
// //
@@ -754,6 +720,8 @@ private:
double chikouSpanBuffer[]; double chikouSpanBuffer[];
double senkouSpanABuffer[]; double senkouSpanABuffer[];
double senkouSpanBBuffer[]; double senkouSpanBBuffer[];
double futureSenkouSpanABuffer[];
double futureSenkouSpanBBuffer[];
// //
// Tools ... // Tools ...
@@ -820,6 +788,28 @@ private:
senkouSpanBBuffer senkouSpanBBuffer
// //
); );
//
// SenkouSpan A ...
CopyBuffer(
mHandler,
X_ICH_SENKOUSPANA_LINE,
0 - mInputs.kijunSenLength,
totalBars,
futureSenkouSpanABuffer
//
);
//
// SenkouSpan B ...
CopyBuffer(
mHandler,
X_ICH_SENKOUSPANB_LINE,
0 - mInputs.kijunSenLength,
totalBars,
futureSenkouSpanBBuffer
//
);
} }
}; };
+3 -2
View File
@@ -5780,7 +5780,8 @@ int Copy(
int count, // Number of Items for read int count, // Number of Items for read
T &source[], // Source Buffer T &source[], // Source Buffer
T &dest[], // Dest Buffer T &dest[], // Dest Buffer
bool forceClean = true // Force To Clean buffer bool forceClean = true, // Force To Clean buffer
bool forceStart = true // Force To Clean buffer
) )
{ {
// //
@@ -5793,7 +5794,7 @@ int Copy(
} }
// //
if (start < 0) if (start < 0 && forceStart)
{ {
start = 0; start = 0;
} }
@@ -0,0 +1,314 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class Library
// ----------------------------------------------
// Name: X110Signaller
// Description: Signalling using X121 rules ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// Imports ...
#include "../Libraries/x-saherelm.xtrade.lib.mq5"
#include "../Classes/x-saherelm.x121.xmcycle.class.mq5"
//
// Definitions ...
//
// Class ...
class X110Signaller : public XSignallerDescriptor
{
//
// Public ...
public:
//
// Props ...
//
// Constructor(s) ...
void X110Signaller()
{
name = X110;
Default();
}
//
// Deconstructor ...
void ~X110Signaller() {}
//
// Override(s) ...
//
bool HasLongConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
) override
{
//
bool result = false;
//
sl = 0;
tp = 0;
//
result = allowLong;
if (!result)
{
return result;
}
//
bool isCloseOverSenkouSpanA = conditions.bars[1].close > conditions.ichSenkouSpanAs[1];
//
bool isBaseBullish = isCloseOverSenkouSpanA &&
conditions.isSenkouSpanAOverB &&
conditions.isSenkouSpanAOverLast;
//
bool isKijunSenOverSenkouSpanA = conditions.ichKijunSens[1] > conditions.ichSenkouSpanAs[1];
//
bool isCloseOverTenkanSen = conditions.bars[1].close > conditions.ichTenkanSens[1];
//
bool isPriceCloseCrossedUpTenkanSen = conditions.bars[2].close <= conditions.ichTenkanSens[2] &&
conditions.bars[1].close > conditions.ichTenkanSens[1];
//
double cKumoUpper = MathMax(conditions.ichSenkouSpanAs[1], conditions.ichSenkouSpanBs[1]);
double pKumoUpper = MathMax(conditions.ichSenkouSpanAs[2], conditions.ichSenkouSpanBs[2]);
//
double cKumoLower = MathMin(conditions.ichSenkouSpanAs[1], conditions.ichSenkouSpanBs[1]);
double pKumoLower = MathMin(conditions.ichSenkouSpanAs[2], conditions.ichSenkouSpanBs[2]);
//
bool isTenkanSenOverKumo = conditions.ichTenkanSens[1] > cKumoUpper;
bool isTenkanSenOverKumoPrev = conditions.ichTenkanSens[2] > pKumoUpper;
//
bool isTenkanSenUnderKumo = conditions.ichTenkanSens[1] < cKumoLower;
bool isTenkanSenUnderKumoPrev = conditions.ichTenkanSens[2] < pKumoLower;
//
bool isTenkanSenCrossedOverKumo = isTenkanSenOverKumo &&
!isTenkanSenOverKumoPrev;
//
bool isTenkanSenCrossedUnderKumo = isTenkanSenUnderKumo &&
!isTenkanSenUnderKumoPrev;
//
bool condition1 =
isBaseBullish &&
isCloseOverTenkanSen &&
isKijunSenOverSenkouSpanA &&
conditions.isTenkanSenCrossedOverKijunSen;
//
bool condition2 =
isBaseBullish &&
isCloseOverTenkanSen &&
isKijunSenOverSenkouSpanA &&
conditions.isTenkanSenOverKijunSen &&
conditions.isSenkouSpanACrossedOverB;
//
bool condition3 =
isBaseBullish &&
isKijunSenOverSenkouSpanA &&
isPriceCloseCrossedUpTenkanSen &&
conditions.isTenkanSenOverKijunSen;
//
bool condition4 =
isCloseOverTenkanSen &&
isTenkanSenCrossedOverKumo &&
conditions.isTenkanSenOverKijunSen &&
conditions.isFutureSenkouSpanAOverB &&
conditions.isFutureSenkouSpanAOverLast;
//
result =
//
condition1
//
||
//
condition2
//
||
//
condition3
//
||
//
condition4
//
;
//
if (result)
{
sl = conditions.ichSenkouSpanBs[1];
}
//
return result;
}
//
bool HasShortConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
) override
{
//
bool result = false;
//
sl = 0;
tp = 0;
//
result = allowLong;
if (!result)
{
return result;
}
//
bool isCloseUnderSenkouSpanB = conditions.bars[1].close < conditions.ichSenkouSpanBs[1];
//
bool isBaseBearish = isCloseUnderSenkouSpanB &&
conditions.isSenkouSpanAUnderB &&
conditions.isSenkouSpanAUnderLast;
//
bool isKijunSenUnderSenkouSpanB = conditions.ichKijunSens[1] < conditions.ichSenkouSpanBs[1];
//
bool isCloseUnderTenkanSen = conditions.bars[1].close < conditions.ichTenkanSens[1];
//
bool isPriceCloseCrossedDownTenkanSen = conditions.bars[2].close >= conditions.ichTenkanSens[2] &&
conditions.bars[1].close < conditions.ichTenkanSens[1];
//
double cKumoUpper = MathMax(conditions.ichSenkouSpanAs[1], conditions.ichSenkouSpanBs[1]);
double pKumoUpper = MathMax(conditions.ichSenkouSpanAs[2], conditions.ichSenkouSpanBs[2]);
//
double cKumoLower = MathMin(conditions.ichSenkouSpanAs[1], conditions.ichSenkouSpanBs[1]);
double pKumoLower = MathMin(conditions.ichSenkouSpanAs[2], conditions.ichSenkouSpanBs[2]);
//
bool isTenkanSenOverKumo = conditions.ichTenkanSens[1] > cKumoUpper;
bool isTenkanSenOverKumoPrev = conditions.ichTenkanSens[2] > pKumoUpper;
//
bool isTenkanSenUnderKumo = conditions.ichTenkanSens[1] < cKumoLower;
bool isTenkanSenUnderKumoPrev = conditions.ichTenkanSens[2] < pKumoLower;
//
bool isTenkanSenCrossedOverKumo = isTenkanSenOverKumo &&
!isTenkanSenOverKumoPrev;
//
bool isTenkanSenCrossedUnderKumo = isTenkanSenUnderKumo &&
!isTenkanSenUnderKumoPrev;
//
bool condition1 =
isBaseBearish &&
isCloseUnderTenkanSen &&
isKijunSenUnderSenkouSpanB &&
conditions.isTenkanSenCrossedUnderKijunSen;
//
bool condition2 =
isBaseBearish &&
isCloseUnderTenkanSen &&
isKijunSenUnderSenkouSpanB &&
conditions.isTenkanSenUnderKijunSen &&
conditions.isSenkouSpanACrossedUnderB;
//
bool condition3 =
isBaseBearish &&
isKijunSenUnderSenkouSpanB &&
isPriceCloseCrossedDownTenkanSen &&
conditions.isTenkanSenUnderKijunSen;
//
bool condition4 =
isCloseUnderTenkanSen &&
isTenkanSenCrossedUnderKumo &&
conditions.isTenkanSenUnderKijunSen &&
conditions.isFutureSenkouSpanAUnderB &&
conditions.isFutureSenkouSpanAUnderLast;
//
result =
//
condition1
//
||
//
condition2
//
||
//
condition3
//
||
//
condition4
//
;
//
if (result)
{
sl = conditions.ichSenkouSpanAs[1];
}
//
return result;
}
//
// Tools ...
void Default()
{
//
allowLong = true;
allowShort = true;
//
r2r = 1;
//
staticVolumeLong = 0.01;
staticVolumeShort = 0.01;
}
};
@@ -67,7 +67,7 @@ public:
tp = 0; tp = 0;
// //
result = enableLong; result = allowLong;
if (!result) if (!result)
{ {
return result; return result;
@@ -123,7 +123,7 @@ public:
tp = 0; tp = 0;
// //
result = enableShort; result = allowShort;
if (!result) if (!result)
{ {
return result; return result;
@@ -175,8 +175,8 @@ public:
void Default() void Default()
{ {
// //
enableLong = true; allowLong = true;
enableShort = true; allowShort = true;
// //
r2r = 1; r2r = 1;
@@ -68,7 +68,7 @@ public:
tp = 0; tp = 0;
// //
result = enableLong; result = allowLong;
if (!result) if (!result)
{ {
return result; return result;
@@ -125,7 +125,7 @@ public:
bool result = false; bool result = false;
// //
result = enableShort; result = allowShort;
if (!result) if (!result)
{ {
return result; return result;
@@ -180,8 +180,8 @@ public:
void Default() void Default()
{ {
// //
enableLong = true; allowLong = true;
enableShort = true; allowShort = true;
// //
r2r = 1; r2r = 1;