last works ...
This commit is contained in:
Vendored
+149
-151
@@ -43,157 +43,8 @@
|
|||||||
"title": "Signal Executing On Breakouts"
|
"title": "Signal Executing On Breakouts"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"in-progress": [
|
"in-progress": [],
|
||||||
{
|
"testing": [],
|
||||||
"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": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"creation_time": "2024-06-05T00:18:44.371Z",
|
|
||||||
"id": "76",
|
|
||||||
"references": [],
|
|
||||||
"title": "Enable Comment Score and Summary on each Tick ..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"category": "XMQL",
|
|
||||||
"creation_time": "2024-05-30T22:34:15.388Z",
|
|
||||||
"description": {
|
|
||||||
"content": "- [x] in this way all class can Has his own Alerts ...\n- [] preare Alert Prefix for Each Separated Once ...",
|
|
||||||
"mime": "text/markdown"
|
|
||||||
},
|
|
||||||
"id": "69",
|
|
||||||
"references": [],
|
|
||||||
"title": "make provider and ea classes to instance XSCBaseAlert class"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"category": "XMQL",
|
|
||||||
"creation_time": "2024-06-01T00:58:06.730Z",
|
|
||||||
"id": "73",
|
|
||||||
"references": [],
|
|
||||||
"title": "R&D about indicator Class implementation ..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"category": "XMQL",
|
|
||||||
"creation_time": "2024-06-01T00:57:10.458Z",
|
|
||||||
"description": {
|
|
||||||
"content": "do r&d about Volume Profiling and Implement it inside X121 Market Cycle;",
|
|
||||||
"mime": "text/markdown"
|
|
||||||
},
|
|
||||||
"id": "72",
|
|
||||||
"references": [],
|
|
||||||
"title": "R&D about Volume Profiling"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"creation_time": "2024-06-05T07:28:47.379Z",
|
|
||||||
"id": "77",
|
|
||||||
"references": [],
|
|
||||||
"title": "Apply fix on Zero TP SL for X110 Signller"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"testing": [
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"creation_time": "2024-06-01T00:56:22.059Z",
|
|
||||||
"description": {
|
|
||||||
"content": "Indicators:\n- [x] XHULL;\n- [x] XSSL;\n- [x] XAMA;\n- [x] XTM;\n\nfor each indicator:\n- [x] Buffers;\n- [x] Conditions;\n- [x] Clean;\n- [x] Score;\n- [x] Summary;\n\nignore XAMA and XTM ...",
|
|
||||||
"mime": "text/markdown"
|
|
||||||
},
|
|
||||||
"id": "71",
|
|
||||||
"references": [],
|
|
||||||
"title": "add XHULL/XSSLC/XAMA/XTM Indicators also to X121MarketCycle Calss"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"category": "X121 Market Conditions",
|
|
||||||
"creation_time": "2024-05-30T21:38:04.455Z",
|
|
||||||
"description": {
|
|
||||||
"content": "- [x] Remove all Unused Indicators and Helpers;\n-- [x] XCHLH;\n-- [x] XCHMA;\n-- [x] XFI;\n-- [x] XTS;\n-- [x] XRSI;\n-- [x] XOBD;\n-- [x] XLH;\n- [x] resolve side affects;\n- [x] Cleanup Market Conditions;\n- [x] Merge reading Required Data to XMarket Conditions;",
|
|
||||||
"mime": "text/markdown"
|
|
||||||
},
|
|
||||||
"id": "62",
|
|
||||||
"references": [],
|
|
||||||
"title": "Cleanup all Old Indicator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"category": "XTrade",
|
|
||||||
"creation_time": "2024-05-30T22:23:48.918Z",
|
|
||||||
"id": "68",
|
|
||||||
"references": [],
|
|
||||||
"title": "fix cc and ct indicator issues ..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"category": "X121 Provider",
|
|
||||||
"creation_time": "2024-05-30T21:40:26.010Z",
|
|
||||||
"description": {
|
|
||||||
"content": "- [x] implement a Signaller Struct to Describe a Signaller state;\n- [x] use it in X121ProviderDescriptor;\n- [x] inside X121Provider use this Struct to Handle Signaller's State;",
|
|
||||||
"mime": "text/markdown"
|
|
||||||
},
|
|
||||||
"id": "63",
|
|
||||||
"references": [],
|
|
||||||
"title": "Implement a Signaller Struct"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "Hadi Khazaee Asl"
|
|
||||||
},
|
|
||||||
"category": "X121 Provider",
|
|
||||||
"creation_time": "2024-05-30T21:41:50.930Z",
|
|
||||||
"description": {
|
|
||||||
"content": "Each Market must have their own Pivot Points;\n\n- [x] Remove Current Support and Resistance;\n- [x] add Support and Resistance and also Score Generating in each Market;\n- [x] create a General Common Function to Access Support and Resistances;",
|
|
||||||
"mime": "text/markdown"
|
|
||||||
},
|
|
||||||
"id": "64",
|
|
||||||
"references": [],
|
|
||||||
"title": "Move Support and Resistance Pivots Finders inside X121Market Class"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"done": [
|
"done": [
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
@@ -380,6 +231,19 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "add Support for XSupport and InDirectional Support Signals"
|
"title": "add Support for XSupport and InDirectional Support Signals"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"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": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -393,6 +257,28 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "add supports to plot trend arrow in tdma indicator"
|
"title": "add supports to plot trend arrow in tdma indicator"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"creation_time": "2024-06-01T00:56:22.059Z",
|
||||||
|
"description": {
|
||||||
|
"content": "Indicators:\n- [x] XHULL;\n- [x] XSSL;\n- [x] XAMA;\n- [x] XTM;\n\nfor each indicator:\n- [x] Buffers;\n- [x] Conditions;\n- [x] Clean;\n- [x] Score;\n- [x] Summary;\n\nignore XAMA and XTM ...",
|
||||||
|
"mime": "text/markdown"
|
||||||
|
},
|
||||||
|
"id": "71",
|
||||||
|
"references": [],
|
||||||
|
"title": "add XHULL/XSSLC/XAMA/XTM Indicators also to X121MarketCycle Calss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"creation_time": "2024-06-05T07:28:47.379Z",
|
||||||
|
"id": "77",
|
||||||
|
"references": [],
|
||||||
|
"title": "Apply fix on Zero TP SL for X110 Signller"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -421,6 +307,33 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "Check Partial Closing"
|
"title": "Check Partial Closing"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"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": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"category": "X121 Market Conditions",
|
||||||
|
"creation_time": "2024-05-30T21:38:04.455Z",
|
||||||
|
"description": {
|
||||||
|
"content": "- [x] Remove all Unused Indicators and Helpers;\n-- [x] XCHLH;\n-- [x] XCHMA;\n-- [x] XFI;\n-- [x] XTS;\n-- [x] XRSI;\n-- [x] XOBD;\n-- [x] XLH;\n- [x] resolve side affects;\n- [x] Cleanup Market Conditions;\n- [x] Merge reading Required Data to XMarket Conditions;",
|
||||||
|
"mime": "text/markdown"
|
||||||
|
},
|
||||||
|
"id": "62",
|
||||||
|
"references": [],
|
||||||
|
"title": "Cleanup all Old Indicator"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -704,6 +617,15 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "Do a Refactor On Long Signals"
|
"title": "Do a Refactor On Long Signals"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"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 ..."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -714,6 +636,16 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "extends new section based indicators"
|
"title": "extends new section based indicators"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"category": "XTrade",
|
||||||
|
"creation_time": "2024-05-30T22:23:48.918Z",
|
||||||
|
"id": "68",
|
||||||
|
"references": [],
|
||||||
|
"title": "fix cc and ct indicator issues ..."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -742,6 +674,20 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "IMP Works TODO:"
|
"title": "IMP Works TODO:"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"category": "X121 Provider",
|
||||||
|
"creation_time": "2024-05-30T21:40:26.010Z",
|
||||||
|
"description": {
|
||||||
|
"content": "- [x] implement a Signaller Struct to Describe a Signaller state;\n- [x] use it in X121ProviderDescriptor;\n- [x] inside X121Provider use this Struct to Handle Signaller's State;",
|
||||||
|
"mime": "text/markdown"
|
||||||
|
},
|
||||||
|
"id": "63",
|
||||||
|
"references": [],
|
||||||
|
"title": "Implement a Signaller Struct"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -765,6 +711,20 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "increase min balance for trading based on account balance ..."
|
"title": "increase min balance for trading based on account balance ..."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"category": "XMQL",
|
||||||
|
"creation_time": "2024-05-30T22:34:15.388Z",
|
||||||
|
"description": {
|
||||||
|
"content": "- [x] in this way all class can Has his own Alerts ...\n- [] preare Alert Prefix for Each Separated Once ...",
|
||||||
|
"mime": "text/markdown"
|
||||||
|
},
|
||||||
|
"id": "69",
|
||||||
|
"references": [],
|
||||||
|
"title": "make provider and ea classes to instance XSCBaseAlert class"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -775,6 +735,20 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "make settings input related to Indicators and Oscillators hidden or private"
|
"title": "make settings input related to Indicators and Oscillators hidden or private"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"category": "X121 Provider",
|
||||||
|
"creation_time": "2024-05-30T21:41:50.930Z",
|
||||||
|
"description": {
|
||||||
|
"content": "Each Market must have their own Pivot Points;\n\n- [x] Remove Current Support and Resistance;\n- [x] add Support and Resistance and also Score Generating in each Market;\n- [x] create a General Common Function to Access Support and Resistances;",
|
||||||
|
"mime": "text/markdown"
|
||||||
|
},
|
||||||
|
"id": "64",
|
||||||
|
"references": [],
|
||||||
|
"title": "Move Support and Resistance Pivots Finders inside X121Market Class"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -788,6 +762,16 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "R&D about Exists Examples"
|
"title": "R&D about Exists Examples"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"category": "XMQL",
|
||||||
|
"creation_time": "2024-06-01T00:58:06.730Z",
|
||||||
|
"id": "73",
|
||||||
|
"references": [],
|
||||||
|
"title": "R&D about indicator Class implementation ..."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -960,6 +944,20 @@
|
|||||||
"content": "do a refactor on all brokers, higgh priority criterias ...",
|
"content": "do a refactor on all brokers, higgh priority criterias ...",
|
||||||
"mime": "text/markdown"
|
"mime": "text/markdown"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "Hadi Khazaee Asl"
|
||||||
|
},
|
||||||
|
"category": "XMQL",
|
||||||
|
"creation_time": "2024-06-01T00:57:10.458Z",
|
||||||
|
"description": {
|
||||||
|
"content": "do r&d about Volume Profiling and Implement it inside X121 Market Cycle;",
|
||||||
|
"mime": "text/markdown"
|
||||||
|
},
|
||||||
|
"id": "72",
|
||||||
|
"references": [],
|
||||||
|
"title": "R&D about Volume Profiling"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1879,7 +1879,9 @@ struct X121SignalGenerator
|
|||||||
bool _allowShort, // Allow Short Signals
|
bool _allowShort, // Allow Short Signals
|
||||||
double _volume = 0.01, // Volume
|
double _volume = 0.01, // Volume
|
||||||
double _slPoint = 0, // SL Point
|
double _slPoint = 0, // SL Point
|
||||||
double _tpPoint = 30 // TP Point
|
bool _ignoreSL = false, // Ignore Calculated SL
|
||||||
|
double _tpPoint = 30, // TP Point
|
||||||
|
bool _ignoreTP = false // Ignore Calculated TP
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1970,8 +1972,12 @@ struct X121SignalGenerator
|
|||||||
X_ORDER_MODE_MARKET,
|
X_ORDER_MODE_MARKET,
|
||||||
mEntry,
|
mEntry,
|
||||||
_volume,
|
_volume,
|
||||||
0, // mSL,
|
_ignoreSL
|
||||||
mTP //
|
? 0
|
||||||
|
: mSL,
|
||||||
|
_ignoreTP
|
||||||
|
? 0
|
||||||
|
: mTP //
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -636,6 +636,49 @@ public:
|
|||||||
mSLPoint = value;
|
mSLPoint = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool IgnoreTP()
|
||||||
|
{
|
||||||
|
return mIgnoreTP;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void IgnoreTP(bool value)
|
||||||
|
{
|
||||||
|
mIgnoreTP = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool IgnoreSL()
|
||||||
|
{
|
||||||
|
return mIgnoreSL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void IgnoreSL(bool value)
|
||||||
|
{
|
||||||
|
mIgnoreSL = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int ReuiredSignalVerifications()
|
||||||
|
{
|
||||||
|
return mReuiredSignalVerifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ReuiredSignalVerifications(int value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 1)
|
||||||
|
{
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mReuiredSignalVerifications = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool IsEnable()
|
bool IsEnable()
|
||||||
{
|
{
|
||||||
@@ -744,13 +787,33 @@ public:
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Cleanup Signals ...
|
cPusher = 0;
|
||||||
|
sPusher = 0;
|
||||||
|
mPusher = 0;
|
||||||
|
lPusher = 0;
|
||||||
|
hPusher = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
cProvider = NULL;
|
||||||
|
sProvider = NULL;
|
||||||
|
mProvider = NULL;
|
||||||
|
lProvider = NULL;
|
||||||
|
hProvider = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
cSignal.Clean();
|
cSignal.Clean();
|
||||||
sSignal.Clean();
|
sSignal.Clean();
|
||||||
mSignal.Clean();
|
mSignal.Clean();
|
||||||
lSignal.Clean();
|
lSignal.Clean();
|
||||||
hSignal.Clean();
|
hSignal.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
cConditions.Clean();
|
||||||
|
sConditions.Clean();
|
||||||
|
mConditions.Clean();
|
||||||
|
lConditions.Clean();
|
||||||
|
hConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Current ...
|
// Current ...
|
||||||
bool canProcess = mSetups[i]
|
bool canProcess = mSetups[i]
|
||||||
@@ -799,7 +862,9 @@ public:
|
|||||||
mAllowShort,
|
mAllowShort,
|
||||||
mVolume,
|
mVolume,
|
||||||
mSLPoint,
|
mSLPoint,
|
||||||
mTPPoint //
|
mIgnoreSL,
|
||||||
|
mTPPoint,
|
||||||
|
mIgnoreTP //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -856,7 +921,9 @@ public:
|
|||||||
mAllowShort,
|
mAllowShort,
|
||||||
mVolume,
|
mVolume,
|
||||||
mSLPoint,
|
mSLPoint,
|
||||||
mTPPoint //
|
mIgnoreSL,
|
||||||
|
mTPPoint,
|
||||||
|
mIgnoreTP //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -913,7 +980,9 @@ public:
|
|||||||
mAllowShort,
|
mAllowShort,
|
||||||
mVolume,
|
mVolume,
|
||||||
mSLPoint,
|
mSLPoint,
|
||||||
mTPPoint //
|
mIgnoreSL,
|
||||||
|
mTPPoint,
|
||||||
|
mIgnoreTP //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -970,7 +1039,9 @@ public:
|
|||||||
mAllowShort,
|
mAllowShort,
|
||||||
mVolume,
|
mVolume,
|
||||||
mSLPoint,
|
mSLPoint,
|
||||||
mTPPoint //
|
mIgnoreSL,
|
||||||
|
mTPPoint,
|
||||||
|
mIgnoreTP //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1027,7 +1098,9 @@ public:
|
|||||||
mAllowShort,
|
mAllowShort,
|
||||||
mVolume,
|
mVolume,
|
||||||
mSLPoint,
|
mSLPoint,
|
||||||
mTPPoint //
|
mIgnoreSL,
|
||||||
|
mTPPoint,
|
||||||
|
mIgnoreTP //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1039,111 +1112,109 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Parse Signals and Add them for Executing ...
|
|
||||||
// Here we can Save Signal and it's Conditions to
|
|
||||||
// Specified Collector then Update them on SL and TP ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Current Signals ...
|
|
||||||
if (cPusher > 0 && cSignal.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
cSignal,
|
|
||||||
signals //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
AddNewSignal(
|
// Parse Signals and Add them for Executing ...
|
||||||
cPusher,
|
|
||||||
cSignal,
|
|
||||||
mBullishScore,
|
|
||||||
mBearishScore,
|
|
||||||
cConditions //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Short Signals ...
|
|
||||||
if (sPusher > 0 && sSignal.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
sSignal,
|
|
||||||
signals //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
AddNewSignal(
|
// Current Signals ...
|
||||||
sPusher,
|
if (cPusher > mReuiredSignalVerifications && cSignal.IsValid())
|
||||||
sSignal,
|
{
|
||||||
mBullishScore,
|
//
|
||||||
mBearishScore,
|
AddRef(
|
||||||
sConditions //
|
cSignal,
|
||||||
);
|
signals //
|
||||||
}
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Medium Signals ...
|
AddNewSignal(
|
||||||
if (mPusher > 0 && mSignal.IsValid())
|
cPusher,
|
||||||
{
|
cSignal,
|
||||||
//
|
mBullishScore,
|
||||||
AddRef(
|
mBearishScore,
|
||||||
mSignal,
|
cConditions //
|
||||||
signals //
|
);
|
||||||
);
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
AddNewSignal(
|
// Short Signals ...
|
||||||
mPusher,
|
if (sPusher > mReuiredSignalVerifications && sSignal.IsValid())
|
||||||
mSignal,
|
{
|
||||||
mBullishScore,
|
//
|
||||||
mBearishScore,
|
AddRef(
|
||||||
mConditions //
|
sSignal,
|
||||||
);
|
signals //
|
||||||
}
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Long Signals ...
|
AddNewSignal(
|
||||||
if (lPusher > 0 && lSignal.IsValid())
|
sPusher,
|
||||||
{
|
sSignal,
|
||||||
//
|
mBullishScore,
|
||||||
AddRef(
|
mBearishScore,
|
||||||
lSignal,
|
sConditions //
|
||||||
signals //
|
);
|
||||||
);
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
AddNewSignal(
|
// Medium Signals ...
|
||||||
lPusher,
|
if (mPusher > mReuiredSignalVerifications && mSignal.IsValid())
|
||||||
lSignal,
|
{
|
||||||
mBullishScore,
|
//
|
||||||
mBearishScore,
|
AddRef(
|
||||||
lConditions //
|
mSignal,
|
||||||
);
|
signals //
|
||||||
}
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hind Signals ...
|
AddNewSignal(
|
||||||
if (hPusher > 0 && hSignal.IsValid())
|
mPusher,
|
||||||
{
|
mSignal,
|
||||||
//
|
mBullishScore,
|
||||||
AddRef(
|
mBearishScore,
|
||||||
hSignal,
|
mConditions //
|
||||||
signals //
|
);
|
||||||
);
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
AddNewSignal(
|
// Long Signals ...
|
||||||
hPusher,
|
if (lPusher > mReuiredSignalVerifications && lSignal.IsValid())
|
||||||
hSignal,
|
{
|
||||||
mBullishScore,
|
//
|
||||||
mBearishScore,
|
AddRef(
|
||||||
hConditions //
|
lSignal,
|
||||||
);
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddNewSignal(
|
||||||
|
lPusher,
|
||||||
|
lSignal,
|
||||||
|
mBullishScore,
|
||||||
|
mBearishScore,
|
||||||
|
lConditions //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hind Signals ...
|
||||||
|
if (hPusher > mReuiredSignalVerifications && hSignal.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
hSignal,
|
||||||
|
signals //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddNewSignal(
|
||||||
|
hPusher,
|
||||||
|
hSignal,
|
||||||
|
mBullishScore,
|
||||||
|
mBearishScore,
|
||||||
|
hConditions //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1230,24 +1301,49 @@ public:
|
|||||||
//
|
//
|
||||||
const bool result = false;
|
const bool result = false;
|
||||||
|
|
||||||
//
|
|
||||||
// Here we Implement Account Protector ...
|
|
||||||
HandleAccountProtect();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do all State Management here ...
|
// Do all State Management here ...
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Check State Interval ...
|
||||||
|
// static datetime lastStateManaged = NULL;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// datetime cTime = TimeCurrent();
|
||||||
|
// int interval = PeriodSeconds(PERIOD_M3);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// bool canManageState =
|
||||||
|
// //
|
||||||
|
// !IsValid(lastStateManaged)
|
||||||
|
// ? true
|
||||||
|
// : (int)cTime >= (int)lastStateManaged + interval;
|
||||||
|
// //
|
||||||
|
// ;
|
||||||
|
// if (!canManageState)
|
||||||
|
// {
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// lastStateManaged = cTime;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Retrieve Account Profit ...
|
||||||
|
// double profit = mTrader.Profit();
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Check EQM Orders and Handle Hedging ...
|
||||||
|
// DoEQMHedge();
|
||||||
|
|
||||||
//
|
//
|
||||||
// if Returns true, Signal Execution failed ...
|
// if Returns true, Signal Execution failed ...
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Tools For Signal Info Collect ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Used for Signal Info States ...
|
// Used for Signal Info States ...
|
||||||
void OnDealsChangedHandler(int count)
|
void OnDealsChangedHandler(int count) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XDeal deal;
|
XDeal deal;
|
||||||
@@ -1260,18 +1356,24 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void OnGoingToProfit(XProfitTrack &track) override
|
||||||
|
{
|
||||||
|
// RemoveEQMOrders();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void OnGoingToDrawdown(XProfitTrack &track) override
|
||||||
|
{
|
||||||
|
// PlaceEQMOrders();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protected ...
|
// Protected ...
|
||||||
protected:
|
protected:
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
//
|
|
||||||
// Do All Protection Senarios here ...
|
|
||||||
void HandleAccountProtect()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
@@ -1279,11 +1381,14 @@ private:
|
|||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool mAllowLong; // Allow Long
|
bool mAllowLong; // Allow Long
|
||||||
bool mAllowShort; // Allow Short
|
bool mAllowShort; // Allow Short
|
||||||
double mVolume; // Volume
|
double mVolume; // Volume
|
||||||
double mTPPoint; // TP Point
|
double mTPPoint; // TP Point
|
||||||
double mSLPoint; // SL Point
|
double mSLPoint; // SL Point
|
||||||
|
bool mIgnoreTP; // Ignore Calculated TP
|
||||||
|
bool mIgnoreSL; // Ignore Calculated SL
|
||||||
|
int mReuiredSignalVerifications; // Required Verifications for Validate Signals
|
||||||
|
|
||||||
//
|
//
|
||||||
XSignalInfo mSignalInfos[];
|
XSignalInfo mSignalInfos[];
|
||||||
@@ -1545,6 +1650,242 @@ private:
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// EQM Functions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check and Hedge ...
|
||||||
|
void DoEQMHedge() {}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remove Untriggered EQM Orders ...
|
||||||
|
void RemoveEQMOrders()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
RemoveDraws("XTRND");
|
||||||
|
|
||||||
|
//
|
||||||
|
XOrder supports[];
|
||||||
|
int supportsCount = mTrader.GetOrders(
|
||||||
|
supports,
|
||||||
|
NULL, // All Symbols ...
|
||||||
|
XEQMSupportToken, // Only EQM Supports ...
|
||||||
|
NULL, // All Periods ...
|
||||||
|
X_POSITION_TYPE_ALL, // All Order Types ...
|
||||||
|
ORDER_STATE_PLACED, // Untriggered Orders ...
|
||||||
|
true // Filter by Magic ...
|
||||||
|
);
|
||||||
|
if (!IsValidSize(supportsCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int cancelled = mTrader.CancelOrders(
|
||||||
|
supports //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidSize(cancelled))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string message = XEQMSupportToken + " Cancel " + ToString(cancelled) + " Supports ...";
|
||||||
|
|
||||||
|
//
|
||||||
|
Alert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Place EQM Orders ...
|
||||||
|
void PlaceEQMOrders()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = CountSetups();
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XSignal supports[];
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string iSymbol = mSetups[i].GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES iPeriod = NULL; // All Periods ...
|
||||||
|
string iProvider = NULL; // All Providers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XPosition iPositions[];
|
||||||
|
int iPositionsCount = mTrader.GetPositions(
|
||||||
|
iPositions,
|
||||||
|
iSymbol,
|
||||||
|
iProvider,
|
||||||
|
iPeriod,
|
||||||
|
X_POSITION_TYPE_ALL //
|
||||||
|
);
|
||||||
|
if (!IsValidSize(iPositionsCount))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int maxInDIDX = FindMaxDrawdownIndex(
|
||||||
|
iPositions //
|
||||||
|
);
|
||||||
|
if (!IsValidIndex(maxInDIDX))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XPosition maxInDP = iPositions[maxInDIDX];
|
||||||
|
bool isLong = IsLong(maxInDP.type);
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iZBar;
|
||||||
|
bool isInited = iZBar.Init(
|
||||||
|
iSymbol,
|
||||||
|
iPeriod,
|
||||||
|
0 //
|
||||||
|
);
|
||||||
|
if (!isInited)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double iSupport = 0;
|
||||||
|
double iResistance = 0;
|
||||||
|
bool isDrawn = DrawTrendState(
|
||||||
|
ChartID(),
|
||||||
|
"XTRND",
|
||||||
|
iZBar,
|
||||||
|
iSupport,
|
||||||
|
iResistance //
|
||||||
|
);
|
||||||
|
if (isDrawn)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSignal iSignal;
|
||||||
|
|
||||||
|
//
|
||||||
|
double iSL = 0;
|
||||||
|
double iTP = 0;
|
||||||
|
double iEntry = 0;
|
||||||
|
ENUM_POSITION_TYPE iType;
|
||||||
|
ENUM_X_ORDER_MODES iMode;
|
||||||
|
double iVolume = maxInDP.volume * 3;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (iSupport > 0 && isLong && iSupport > maxInDP.sl && maxInDP.sl > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Add Short Support for Long ...
|
||||||
|
iEntry = iSupport;
|
||||||
|
iSL = maxInDP.tp;
|
||||||
|
iTP = maxInDP.sl;
|
||||||
|
iMode = X_ORDER_MODE_STOP;
|
||||||
|
iType = POSITION_TYPE_SELL;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPrepared = iSignal.Prepare(
|
||||||
|
iSymbol,
|
||||||
|
XEQMSupportToken,
|
||||||
|
iPeriod,
|
||||||
|
iType,
|
||||||
|
iMode,
|
||||||
|
iEntry,
|
||||||
|
iVolume,
|
||||||
|
iSL,
|
||||||
|
iTP //
|
||||||
|
);
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSignal.comment = GenerateSupportTag(maxInDP.ticket);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iSignal,
|
||||||
|
supports ///
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
iSignal.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (iResistance > 0 && !isLong && iResistance < maxInDP.sl && maxInDP.sl > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Add Long Support for Short ...
|
||||||
|
iEntry = iResistance;
|
||||||
|
iSL = maxInDP.tp;
|
||||||
|
iTP = maxInDP.sl;
|
||||||
|
iMode = X_ORDER_MODE_STOP;
|
||||||
|
iType = POSITION_TYPE_BUY;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPrepared = iSignal.Prepare(
|
||||||
|
iSymbol,
|
||||||
|
XEQMSupportToken,
|
||||||
|
iPeriod,
|
||||||
|
iType,
|
||||||
|
iMode,
|
||||||
|
iEntry,
|
||||||
|
iVolume,
|
||||||
|
iSL,
|
||||||
|
iTP //
|
||||||
|
);
|
||||||
|
if (isPrepared)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSignal.comment = GenerateSupportTag(maxInDP.ticket);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iSignal,
|
||||||
|
supports ///
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
iSignal.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int supportsCount = ArraySize(supports);
|
||||||
|
if (!IsValidSize(supportsCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_SIGNAL_EXECUTION_RESULT states[];
|
||||||
|
int executeds = mTrader.ExecuteSignals(
|
||||||
|
supports,
|
||||||
|
states,
|
||||||
|
ORDER_TIME_GTC,
|
||||||
|
false,
|
||||||
|
false // Ignore Policies
|
||||||
|
);
|
||||||
|
if (IsValidSize(executeds))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string message = XEQMSupportToken + " Execute " + ToString(executeds) + " Supports ...";
|
||||||
|
|
||||||
|
//
|
||||||
|
Alert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3009,7 +3009,7 @@ protected:
|
|||||||
symbol,
|
symbol,
|
||||||
provider,
|
provider,
|
||||||
period,
|
period,
|
||||||
ToOrderType(type),
|
type,
|
||||||
ORDER_STATE_PLACED,
|
ORDER_STATE_PLACED,
|
||||||
true // Filter by Magic ...
|
true // Filter by Magic ...
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -2523,14 +2523,14 @@ public:
|
|||||||
//
|
//
|
||||||
// Retrieve All Orders ...
|
// Retrieve All Orders ...
|
||||||
int GetOrders(
|
int GetOrders(
|
||||||
XOrder &result[], // Hold's Result
|
XOrder &result[], // Hold's Result
|
||||||
string symbol = NULL, // Trading Symbol
|
string symbol = NULL, // Trading Symbol
|
||||||
string provider = NULL, // Signal Provider
|
string provider = NULL, // Signal Provider
|
||||||
ENUM_TIMEFRAMES period = NULL, // Trading Period
|
ENUM_TIMEFRAMES period = NULL, // Trading Period
|
||||||
ENUM_ORDER_TYPE type = NULL, // Long (Buy) or Short (Sell)
|
ENUM_X_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell)
|
||||||
ENUM_ORDER_STATE state = NULL, // Order State
|
ENUM_ORDER_STATE state = NULL, // Order State
|
||||||
bool filterByMagic = true, // Get Only Self Open Positions
|
bool filterByMagic = true, // Get Only Self Open Positions
|
||||||
bool forceClean = true // Clean Result Array
|
bool forceClean = true // Clean Result Array
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2605,16 +2605,16 @@ public:
|
|||||||
//
|
//
|
||||||
// Retrieve Historical Orders ...
|
// Retrieve Historical Orders ...
|
||||||
int GetOrders(
|
int GetOrders(
|
||||||
XOrder &result[], // Hold's Result
|
XOrder &result[], // Hold's Result
|
||||||
string symbol = NULL, // Trading Symbol
|
string symbol = NULL, // Trading Symbol
|
||||||
string provider = NULL, // Signal Provider
|
string provider = NULL, // Signal Provider
|
||||||
ENUM_TIMEFRAMES period = NULL, // Trading Period
|
ENUM_TIMEFRAMES period = NULL, // Trading Period
|
||||||
ENUM_ORDER_TYPE type = NULL, // Long (Buy) or Short (Sell)
|
ENUM_X_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell)
|
||||||
ENUM_ORDER_STATE state = NULL, // Order State
|
ENUM_ORDER_STATE state = NULL, // Order State
|
||||||
datetime startDate = NULL, // Specify Start Date
|
datetime startDate = NULL, // Specify Start Date
|
||||||
datetime endDate = NULL, // Specify End Date
|
datetime endDate = NULL, // Specify End Date
|
||||||
bool filterByMagic = true, // Get Only Self Open Positions
|
bool filterByMagic = true, // Get Only Self Open Positions
|
||||||
bool forceClean = true // Clean Result Array
|
bool forceClean = true // Clean Result Array
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
type *.x121.log > Signals.x121.log
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SaherElm IT Center XTESTXXX MQL5 Expert Advisor
|
// SaherElm IT Center X121EA MQL5 Expert Advisor
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// Name: XTESTXXX
|
// Name: X121EA
|
||||||
// Description: an Exper Advisor which used RSI and MA
|
// Description: an Exper Advisor which used RSI and MA
|
||||||
// to Analyse Market ...
|
// to Analyse Market ...
|
||||||
//
|
//
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm XTESTXXX"
|
#property description "SaherElm X121EA"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -24,23 +24,41 @@
|
|||||||
#include "../Classes/x-saherelm.x121.setup.xea.mq5"
|
#include "../Classes/x-saherelm.x121.setup.xea.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
#define ShortName "XTESTXXX"
|
#define ShortName "X121EA"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
long eaMagicNumber = 78692110; // Magic Number
|
// Common ...
|
||||||
int eaSlippage = 10; // Slippgae
|
long x121EAMagicNumber = 78692110; // Magic Number
|
||||||
|
int x121EASlippage = 10; // Slippgae
|
||||||
|
|
||||||
//
|
//
|
||||||
string eaSymbols = "EURUSDb"; // Symbols
|
// Trading Symbols ...
|
||||||
|
string x121EASymbols = "EURUSDb,GBPUSDb,XAUUSDb,USDCHFb"; // Symbols
|
||||||
|
|
||||||
//
|
//
|
||||||
bool eaAllowLong = true; // Allow Long Trades
|
// Signals ...
|
||||||
bool eaAllowShort = true; // Allow Short Trades
|
bool x121EAAllowLong = true; // Allow Long Trades
|
||||||
double eaVolume = 0.05; // Static Volume
|
bool x121EAAllowShort = true; // Allow Short Trades
|
||||||
int eaReuiredVerifications = 1; // Required Verifications for Signals
|
int x121EAReuiredSignalVerifications = 2; // Required Verifications for Signals
|
||||||
|
|
||||||
|
//
|
||||||
|
// Risk Management ...
|
||||||
|
double x121EAVolume = 0.01; // Static Volume
|
||||||
|
double x121EATPPoint = 30; // TP Point
|
||||||
|
double x121EASLPoint = 300; // SL Point
|
||||||
|
bool x121EAIgnoreSL = true; // Ignore Calculated SL
|
||||||
|
bool x121EAIgnoreTP = false; // Ignore Calculated TP
|
||||||
|
|
||||||
|
//
|
||||||
|
// Alert ...
|
||||||
|
bool x121EAEnableAlerts = true; // Enable Alerts
|
||||||
|
bool x121EALogAlerts = true; // Log Alerts
|
||||||
|
bool x121EAMailAlerts = false; // Mail Alerts
|
||||||
|
bool x121EAPushAlerts = false; // Push Alerts
|
||||||
|
bool x121EATerminalAlerts = false; // Terminal Alerts
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions ...
|
// Definitions ...
|
||||||
@@ -49,7 +67,7 @@ int eaReuiredVerifications = 1; // Required Verifications for Signals
|
|||||||
// Local Variables ...
|
// Local Variables ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XSCX121SetupEA *mEA;
|
XSCX121SetupEA *x121EA;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Event Handlers ...
|
// Event Handlers ...
|
||||||
@@ -90,14 +108,14 @@ void OnDeinit(const int reason)
|
|||||||
|
|
||||||
//
|
//
|
||||||
// De Initialize XSampleEA Providers ...
|
// De Initialize XSampleEA Providers ...
|
||||||
delete mEA;
|
delete x121EA;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// On Tick Handler ...
|
// On Tick Handler ...
|
||||||
void OnTick()
|
void OnTick()
|
||||||
{
|
{
|
||||||
mEA.OnTick();
|
x121EA.OnTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -113,7 +131,7 @@ bool InitialEA()
|
|||||||
TesterHideIndicators(true);
|
TesterHideIndicators(true);
|
||||||
|
|
||||||
//
|
//
|
||||||
result = IsValid(eaSymbols);
|
result = IsValid(x121EASymbols);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -123,7 +141,7 @@ bool InitialEA()
|
|||||||
string symbols[];
|
string symbols[];
|
||||||
int symbolsCount = SplitContent(
|
int symbolsCount = SplitContent(
|
||||||
symbols,
|
symbols,
|
||||||
eaSymbols //
|
x121EASymbols //
|
||||||
);
|
);
|
||||||
result = symbolsCount > 0;
|
result = symbolsCount > 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -132,21 +150,30 @@ bool InitialEA()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
mEA = new XSCX121SetupEA(
|
x121EA = new XSCX121SetupEA(
|
||||||
eaSlippage,
|
x121EASlippage,
|
||||||
eaMagicNumber //
|
x121EAMagicNumber //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allow Signals ...
|
// Configure EA ...
|
||||||
mEA.AllowLong(true);
|
x121EA.Volume(x121EAVolume);
|
||||||
mEA.AllowShort(true);
|
x121EA.TPPoint(x121EATPPoint);
|
||||||
mEA.Volume(0.01);
|
x121EA.SLPoint(x121EASLPoint);
|
||||||
mEA.TPPoint(30);
|
x121EA.IgnoreSL(x121EAIgnoreSL);
|
||||||
mEA.SLPoint(0);
|
x121EA.IgnoreTP(x121EAIgnoreTP);
|
||||||
|
x121EA.AllowLong(x121EAAllowLong);
|
||||||
|
x121EA.AllowShort(x121EAAllowShort);
|
||||||
|
x121EA.ReuiredSignalVerifications(x121EAReuiredSignalVerifications);
|
||||||
|
|
||||||
//
|
//
|
||||||
mEA.SetAlertPrefix(ShortName);
|
// Configure Alert ...
|
||||||
|
x121EA.SetAlertPrefix(ShortName);
|
||||||
|
x121EA.SetAlertEnableAlerts(x121EAEnableAlerts);
|
||||||
|
x121EA.SetAlertLogAlerts(x121EALogAlerts);
|
||||||
|
x121EA.SetAlertMailAlerts(x121EAMailAlerts);
|
||||||
|
x121EA.SetAlertPushAlerts(x121EAPushAlerts);
|
||||||
|
x121EA.SetAlertTerminalAlerts(x121EATerminalAlerts);
|
||||||
|
|
||||||
//
|
//
|
||||||
X121SetupInputs setupInputsDefault;
|
X121SetupInputs setupInputsDefault;
|
||||||
@@ -175,7 +202,7 @@ bool InitialEA()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = mEA.AddSetup(iSetupCycle);
|
result = x121EA.AddSetup(iSetupCycle);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
+121
-102
@@ -45,6 +45,127 @@ enum ENUM_X_SWING_TYPE
|
|||||||
X_SWING_LOW = -1,
|
X_SWING_LOW = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_SERIESMODE ToSeriesMode(ENUM_X_SWING_TYPE value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_SERIESMODE result = MODE_HIGH;
|
||||||
|
|
||||||
|
//
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
case X_SWING_HIGH:
|
||||||
|
result = MODE_HIGH;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_SWING_LOW:
|
||||||
|
result = MODE_LOW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Swing Points ...
|
||||||
|
int FindSwing(
|
||||||
|
string mSymbol, // Trading Symbol ...
|
||||||
|
ENUM_TIMEFRAMES mPeriod, // Trading Period ...
|
||||||
|
ENUM_X_SWING_TYPE mode, // Swing Based On Price mode ...
|
||||||
|
int mLength, // Loopback ...
|
||||||
|
int bar_index // BarIndex ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (StringLen(mSymbol) == 0 || (mode != X_SWING_HIGH && mode != X_SWING_LOW))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int current = bar_index;
|
||||||
|
int founded = FindNextSwing(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
mode,
|
||||||
|
(mLength * 2) + 1,
|
||||||
|
current - mLength);
|
||||||
|
|
||||||
|
//
|
||||||
|
while (founded != current)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
current = FindNextSwing(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
mode,
|
||||||
|
mLength,
|
||||||
|
current + 1);
|
||||||
|
|
||||||
|
//
|
||||||
|
founded = FindNextSwing(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
mode,
|
||||||
|
(mLength * 2) + 1,
|
||||||
|
current - mLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = current;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Next Swing ...
|
||||||
|
int FindNextSwing(
|
||||||
|
string mSymbol, // Trading Symbol ...
|
||||||
|
ENUM_TIMEFRAMES mPeriod, // Trading Period ...
|
||||||
|
ENUM_X_SWING_TYPE mode, // Swing Based On Price mode ...
|
||||||
|
int mLength, // Loopback ...
|
||||||
|
int bar_index // BarIndex ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (bar_index < 0)
|
||||||
|
{
|
||||||
|
mLength += bar_index;
|
||||||
|
bar_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_SERIESMODE mSeriesMode = ToSeriesMode(mode);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mode == X_SWING_HIGH
|
||||||
|
? iHighest(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
mSeriesMode,
|
||||||
|
mLength,
|
||||||
|
bar_index)
|
||||||
|
: iLowest(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
mSeriesMode,
|
||||||
|
mLength,
|
||||||
|
bar_index);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPERIOD Calculation Method ...
|
// XPERIOD Calculation Method ...
|
||||||
enum ENUM_X_PERIOD_METHOD
|
enum ENUM_X_PERIOD_METHOD
|
||||||
@@ -1399,108 +1520,6 @@ struct XOHCL
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Find Swings (Highs nd Lows) ...
|
|
||||||
int FindSwing(
|
|
||||||
ENUM_X_SWING_TYPE swing, // Swing Based On Price mode ...
|
|
||||||
int mLength // Loopback ...
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = -1;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!IsValid() ||
|
|
||||||
!IsValid(swing))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int current = Index();
|
|
||||||
int founded = FindNextSwing(
|
|
||||||
swing,
|
|
||||||
(mLength * 2) + 1,
|
|
||||||
current - mLength
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
while (founded != current)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
current = FindNextSwing(
|
|
||||||
swing,
|
|
||||||
mLength,
|
|
||||||
current + 1
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
founded = FindNextSwing(
|
|
||||||
swing,
|
|
||||||
(mLength * 2) + 1,
|
|
||||||
current - mLength
|
|
||||||
//
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = current;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Find Next Swing ...
|
|
||||||
int FindNextSwing(
|
|
||||||
ENUM_X_SWING_TYPE swing, // Swing Based On Price mode ...
|
|
||||||
int from, // from Bar Index
|
|
||||||
int mLength // Loopback ...
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = -1;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!IsValid() ||
|
|
||||||
!IsValid(swing))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (from < 0)
|
|
||||||
{
|
|
||||||
mLength += from;
|
|
||||||
from = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_SERIESMODE mMode = swing == X_SWING_HIGH
|
|
||||||
? MODE_HIGH
|
|
||||||
: MODE_LOW;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = swing == X_SWING_HIGH
|
|
||||||
? iHighest(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
mMode,
|
|
||||||
mLength,
|
|
||||||
from)
|
|
||||||
: iLowest(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
mMode,
|
|
||||||
mLength,
|
|
||||||
from);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Lowest Bar Index ...
|
// Find Lowest Bar Index ...
|
||||||
int FindHighestIndex(
|
int FindHighestIndex(
|
||||||
|
|||||||
@@ -1840,13 +1840,13 @@ struct XOrder
|
|||||||
//
|
//
|
||||||
// Check Items Passed Specific Filters or not ...
|
// Check Items Passed Specific Filters or not ...
|
||||||
bool IsFiltersPassed(
|
bool IsFiltersPassed(
|
||||||
string mSymbol = NULL, // Trading Symbol
|
string mSymbol = NULL, // Trading Symbol
|
||||||
string mProvider = NULL, // Signal Provider
|
string mProvider = NULL, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe
|
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe
|
||||||
ENUM_ORDER_TYPE mType = NULL, // Long (Buy), Short (Sell)
|
ENUM_X_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell)
|
||||||
ENUM_ORDER_STATE mState = NULL, // Order State
|
ENUM_ORDER_STATE mState = NULL, // Order State
|
||||||
ulong mMagic = NULL, // Magic Number
|
ulong mMagic = NULL, // Magic Number
|
||||||
bool mFilterByMagic = true // Get Only Self Open Positions
|
bool mFilterByMagic = true // Get Only Self Open Positions
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3374,8 +3374,8 @@ bool IsTypeFilterPassed(
|
|||||||
//
|
//
|
||||||
bool result = type == NULL || type == X_POSITION_TYPE_ALL
|
bool result = type == NULL || type == X_POSITION_TYPE_ALL
|
||||||
? true
|
? true
|
||||||
: ((type == X_POSITION_TYPE_LONG && item.type == POSITION_TYPE_BUY) ||
|
: ((type == X_POSITION_TYPE_LONG && ((int)item.type == (int)POSITION_TYPE_BUY || (int)item.type == (int)ORDER_TYPE_BUY)) ||
|
||||||
(type == X_POSITION_TYPE_SHORT && item.type == POSITION_TYPE_SELL));
|
(type == X_POSITION_TYPE_SHORT && ((int)item.type == (int)POSITION_TYPE_SELL || (int)item.type == (int)ORDER_TYPE_SELL)));
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -4320,3 +4320,224 @@ void CountPositions(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custom Drawings ...
|
||||||
|
bool DrawTrendState(
|
||||||
|
long chartId,
|
||||||
|
string _prefix,
|
||||||
|
XOHCL &_bar,
|
||||||
|
double &support,
|
||||||
|
double &resistance,
|
||||||
|
int shoulders = 10,
|
||||||
|
int subWindow = 0,
|
||||||
|
color resistanceColor = clrRed,
|
||||||
|
color supportColor = clrGreen,
|
||||||
|
color swingHighColor = clrAqua,
|
||||||
|
color swingLowColor = clrMagenta //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsValid(_prefix) &&
|
||||||
|
_bar.IsValid()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Low Swings ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int firstSwingLowIndex = FindSwing(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
X_SWING_LOW,
|
||||||
|
shoulders,
|
||||||
|
_bar.Index() + 1 //
|
||||||
|
);
|
||||||
|
XOHCL firstSwingLowBar;
|
||||||
|
result = firstSwingLowBar.Init(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
firstSwingLowIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int secondSwingLowIndex = FindSwing(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
X_SWING_LOW,
|
||||||
|
shoulders,
|
||||||
|
firstSwingLowIndex + 1 //
|
||||||
|
);
|
||||||
|
XOHCL secondSwingLowBar;
|
||||||
|
result = secondSwingLowBar.Init(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
secondSwingLowIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
support = secondSwingLowBar.low;
|
||||||
|
|
||||||
|
//
|
||||||
|
string lowSwingTrendLineName = _prefix + "_Low_Swing_Trend";
|
||||||
|
|
||||||
|
//
|
||||||
|
result = DrawTrendLine(
|
||||||
|
chartId,
|
||||||
|
lowSwingTrendLineName,
|
||||||
|
subWindow,
|
||||||
|
secondSwingLowBar.time,
|
||||||
|
secondSwingLowBar.low,
|
||||||
|
firstSwingLowBar.time,
|
||||||
|
firstSwingLowBar.low,
|
||||||
|
swingLowColor,
|
||||||
|
STYLE_SOLID,
|
||||||
|
2,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true // Ray Right ...
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string lowSwingSupportLineName = _prefix + "_Low_Swing_Support";
|
||||||
|
|
||||||
|
//
|
||||||
|
result = DrawTrendLine(
|
||||||
|
chartId,
|
||||||
|
lowSwingSupportLineName,
|
||||||
|
subWindow,
|
||||||
|
secondSwingLowBar.time,
|
||||||
|
secondSwingLowBar.low,
|
||||||
|
firstSwingLowBar.time,
|
||||||
|
secondSwingLowBar.low,
|
||||||
|
supportColor,
|
||||||
|
STYLE_SOLID,
|
||||||
|
2,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true // Ray Right ...
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find High Swings ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int firstSwingHighIndex = FindSwing(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
X_SWING_HIGH,
|
||||||
|
shoulders,
|
||||||
|
_bar.Index() + 1 //
|
||||||
|
);
|
||||||
|
XOHCL firstSwingHighBar;
|
||||||
|
result = firstSwingHighBar.Init(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
firstSwingHighIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int secondSwingHighIndex = FindSwing(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
X_SWING_HIGH,
|
||||||
|
shoulders,
|
||||||
|
firstSwingHighIndex + 1 //
|
||||||
|
);
|
||||||
|
XOHCL secondSwingHighBar;
|
||||||
|
result = secondSwingHighBar.Init(
|
||||||
|
_bar.symbol,
|
||||||
|
_bar.period,
|
||||||
|
secondSwingHighIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
resistance = secondSwingHighBar.high;
|
||||||
|
|
||||||
|
//
|
||||||
|
string highSwingTrendLineName = _prefix + "_High_Swing_Trend";
|
||||||
|
|
||||||
|
//
|
||||||
|
result = DrawTrendLine(
|
||||||
|
chartId,
|
||||||
|
highSwingTrendLineName,
|
||||||
|
subWindow,
|
||||||
|
secondSwingHighBar.time,
|
||||||
|
secondSwingHighBar.high,
|
||||||
|
firstSwingHighBar.time,
|
||||||
|
firstSwingHighBar.high,
|
||||||
|
swingHighColor,
|
||||||
|
STYLE_SOLID,
|
||||||
|
2,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true // Ray Right ...
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string highSwingResistanceLineName = _prefix + "_High_Swing_Resistance";
|
||||||
|
|
||||||
|
//
|
||||||
|
result = DrawTrendLine(
|
||||||
|
chartId,
|
||||||
|
highSwingResistanceLineName,
|
||||||
|
subWindow,
|
||||||
|
secondSwingHighBar.time,
|
||||||
|
secondSwingHighBar.high,
|
||||||
|
firstSwingHighBar.time,
|
||||||
|
secondSwingHighBar.high,
|
||||||
|
resistanceColor,
|
||||||
|
STYLE_SOLID,
|
||||||
|
2,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true // Ray Right ...
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
@@ -1,358 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
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
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] > 0 &&
|
|
||||||
conditions.oscCcis[1] > 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] > 0 &&
|
|
||||||
conditions.oscMacdMains[1] > 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bullishScore > bearishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
sl = conditions.ichSenkouSpanBs[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasShortConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
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
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] < 0 &&
|
|
||||||
conditions.oscCcis[1] < 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] < 0 &&
|
|
||||||
conditions.oscMacdMains[1] < 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bearishScore > bullishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
sl = conditions.ichSenkouSpanAs[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
@@ -1,231 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SaherElm IT Center MQL5 Class Library
|
|
||||||
// ----------------------------------------------
|
|
||||||
// Name: X121Signaller
|
|
||||||
// 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 X121Signaller : public XSignallerDescriptor
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Public ...
|
|
||||||
public:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor(s) ...
|
|
||||||
void X121Signaller()
|
|
||||||
{
|
|
||||||
name = X121;
|
|
||||||
Default();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Deconstructor ...
|
|
||||||
void ~X121Signaller() {}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Override(s) ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasLongConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
(conditions.isMRBFastCrossedOverSlow &&
|
|
||||||
(conditions.isCHEBullish &&
|
|
||||||
conditions.isTrendBullish &&
|
|
||||||
conditions.isMCFastOverSlow))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isMRBSlowCrossedtOverVerifier &&
|
|
||||||
(conditions.isCHEBullish &&
|
|
||||||
conditions.isTrendBullish &&
|
|
||||||
conditions.isMCFastOverSlow &&
|
|
||||||
conditions.isMRBFastOverSlow))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isCHESwitchedToBullish &&
|
|
||||||
(conditions.isTrendBullish &&
|
|
||||||
conditions.isMCFastOverSlow &&
|
|
||||||
conditions.isMRBFastOverSlow))
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] > 0 &&
|
|
||||||
conditions.oscCcis[1] > 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] > 0 &&
|
|
||||||
conditions.oscMacdMains[1] > 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bullishScore > bearishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
sl = conditions.mrbSlows[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasShortConditions(
|
|
||||||
X121MCycleConditions &conditions, // Market Conditions
|
|
||||||
double &sl, // Hold SL ...
|
|
||||||
double &tp // Hold TP ...
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
sl = 0;
|
|
||||||
tp = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = allowShort;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
(conditions.isSMHKSwitchedToBearish &&
|
|
||||||
(conditions.isTDBearish &&
|
|
||||||
conditions.isCHEBearish &&
|
|
||||||
conditions.isTrendBearish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isTDSwitchedToBearish &&
|
|
||||||
(conditions.isSMHKBearish &&
|
|
||||||
conditions.isCHEBearish &&
|
|
||||||
conditions.isTrendBearish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isCHESwitchedToBearish &&
|
|
||||||
(conditions.isTDBearish &&
|
|
||||||
conditions.isSMHKBearish &&
|
|
||||||
conditions.isTrendBearish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isTrendSwitchedToBearish &&
|
|
||||||
(conditions.isTDBearish &&
|
|
||||||
conditions.isCHEBearish &&
|
|
||||||
conditions.isSMHKBearish))
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] < 0 &&
|
|
||||||
conditions.oscCcis[1] < 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] < 0 &&
|
|
||||||
conditions.oscMacdMains[1] < 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bearishScore > bullishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
sl = conditions.mrbFasts[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SaherElm IT Center MQL5 Class Library
|
|
||||||
// ----------------------------------------------
|
|
||||||
// Name: X128Signaller
|
|
||||||
// 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 X128Signaller : public XSignallerDescriptor
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Public ...
|
|
||||||
public:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor(s) ...
|
|
||||||
void X128Signaller()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
name = X128;
|
|
||||||
Default();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Deconstructor ...
|
|
||||||
void ~X128Signaller() {}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Override(s) ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasLongConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
false
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
sl = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasShortConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
false
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
sl = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Protected ...
|
|
||||||
protected:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
double lastPeakOnPeakTouched;
|
|
||||||
double lastValeOnPeakTouched;
|
|
||||||
datetime lastTouchedPeak;
|
|
||||||
|
|
||||||
//
|
|
||||||
double lastPeakOnValeTouched;
|
|
||||||
double lastValeOnValeTouched;
|
|
||||||
datetime lastTouchedVale;
|
|
||||||
};
|
|
||||||
@@ -1,237 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SaherElm IT Center MQL5 Class Library
|
|
||||||
// ----------------------------------------------
|
|
||||||
// Name: X786Signaller
|
|
||||||
// Description: Signalling using X786 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 X786Signaller : public XSignallerDescriptor
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Public ...
|
|
||||||
public:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor(s) ...
|
|
||||||
void X786Signaller()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
name = X786;
|
|
||||||
Default();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Deconstructor ...
|
|
||||||
void ~X786Signaller() {}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Override(s) ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasLongConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
(conditions.isSMHKSwitchedToBullish &&
|
|
||||||
(conditions.isTDBullish &&
|
|
||||||
conditions.isCHEBullish &&
|
|
||||||
conditions.isTrendBullish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isTDSwitchedToBullish &&
|
|
||||||
(conditions.isSMHKBullish &&
|
|
||||||
conditions.isCHEBullish &&
|
|
||||||
conditions.isTrendBullish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isCHESwitchedToBullish &&
|
|
||||||
(conditions.isTDBullish &&
|
|
||||||
conditions.isSMHKBullish &&
|
|
||||||
conditions.isTrendBullish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isTrendSwitchedToBullish &&
|
|
||||||
(conditions.isTDBullish &&
|
|
||||||
conditions.isCHEBullish &&
|
|
||||||
conditions.isSMHKBullish))
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] > 0 &&
|
|
||||||
conditions.oscCcis[1] > 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] > 0 &&
|
|
||||||
conditions.oscMacdMains[1] > 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bullishScore > bearishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
sl = conditions.donLowerHs[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasShortConditions(
|
|
||||||
X121MCycleConditions &conditions, // Market Conditions
|
|
||||||
double &sl, // Hold SL ...
|
|
||||||
double &tp // Hold TP ...
|
|
||||||
) override
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
tp = 0;
|
|
||||||
sl = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = allowShort;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
(conditions.isSMHKSwitchedToBearish &&
|
|
||||||
(conditions.isTDBearish &&
|
|
||||||
conditions.isCHEBearish &&
|
|
||||||
conditions.isTrendBearish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isTDSwitchedToBearish &&
|
|
||||||
(conditions.isSMHKBearish &&
|
|
||||||
conditions.isCHEBearish &&
|
|
||||||
conditions.isTrendBearish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isCHESwitchedToBearish &&
|
|
||||||
(conditions.isTDBearish &&
|
|
||||||
conditions.isSMHKBearish &&
|
|
||||||
conditions.isTrendBearish))
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.isTrendSwitchedToBearish &&
|
|
||||||
(conditions.isTDBearish &&
|
|
||||||
conditions.isCHEBearish &&
|
|
||||||
conditions.isSMHKBearish))
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] < 0 &&
|
|
||||||
conditions.oscCcis[1] < 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] < 0 &&
|
|
||||||
conditions.oscMacdMains[1] < 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bearishScore > bullishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
sl = conditions.donUpperLs[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,425 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SaherElm IT Center MQL5 Class Library
|
|
||||||
// ----------------------------------------------
|
|
||||||
// Name: X92Signaller
|
|
||||||
// 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 X92Signaller : public XSignallerDescriptor
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Public ...
|
|
||||||
public:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor(s) ...
|
|
||||||
void X92Signaller()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
name = X92;
|
|
||||||
Default();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Deconstructor ...
|
|
||||||
void ~X92Signaller() {}
|
|
||||||
|
|
||||||
//
|
|
||||||
void SetSymbol(string value)
|
|
||||||
{
|
|
||||||
this.symbol = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void SetPeriod(ENUM_TIMEFRAMES value)
|
|
||||||
{
|
|
||||||
this.period = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Override(s) ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasLongConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (IsLookingForBoundary())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
FindBoundary(conditions);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isRejected =
|
|
||||||
//
|
|
||||||
(conditions.bars[1].low > lastLower &&
|
|
||||||
conditions.bars[2].low > lastLower &&
|
|
||||||
conditions.bars[3].low > lastLower &&
|
|
||||||
conditions.bars[4].low > lastLower &&
|
|
||||||
conditions.bars[5].low > lastLower)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
conditions.bars[1].IsSupportRejected(lastLower)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
bool isBreaked =
|
|
||||||
//
|
|
||||||
(conditions.bars[1].low > lastUpper &&
|
|
||||||
conditions.bars[2].low > lastUpper &&
|
|
||||||
conditions.bars[3].low > lastUpper &&
|
|
||||||
conditions.bars[4].low > lastUpper &&
|
|
||||||
conditions.bars[5].low > lastUpper)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
conditions.bars[1].IsResistanceBreaked(lastUpper)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
isBreaked
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
isRejected
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] > 0 &&
|
|
||||||
conditions.oscCcis[1] > 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] > 0 &&
|
|
||||||
conditions.oscMacdMains[1] > 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bullishScore > bearishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
sl = isBreaked
|
|
||||||
? lastUpper
|
|
||||||
: lastLower;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
HandleResetBundary();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasShortConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (IsLookingForBoundary())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
FindBoundary(conditions);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
conditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isRejected =
|
|
||||||
//
|
|
||||||
(conditions.bars[1].high < lastUpper &&
|
|
||||||
conditions.bars[2].high < lastUpper &&
|
|
||||||
conditions.bars[3].high < lastUpper &&
|
|
||||||
conditions.bars[4].high < lastUpper &&
|
|
||||||
conditions.bars[5].high < lastUpper)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
conditions.bars[1].IsResistanceRejected(lastUpper)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
bool isBreaked =
|
|
||||||
//
|
|
||||||
(conditions.bars[1].high < lastLower &&
|
|
||||||
conditions.bars[2].high < lastLower &&
|
|
||||||
conditions.bars[3].high < lastLower &&
|
|
||||||
conditions.bars[4].high < lastLower &&
|
|
||||||
conditions.bars[5].high < lastLower)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
conditions.bars[1].IsSupportBreaked(lastLower)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
isBreaked
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
isRejected
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isOSCVerified =
|
|
||||||
//
|
|
||||||
(conditions.oscCcis[0] < 0 &&
|
|
||||||
conditions.oscCcis[1] < 0)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(conditions.oscMacdMains[0] < 0 &&
|
|
||||||
conditions.oscMacdMains[1] < 0)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result =
|
|
||||||
isOSCVerified &&
|
|
||||||
bearishScore > bullishScore * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
sl = isBreaked
|
|
||||||
? lastLower
|
|
||||||
: lastUpper;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
HandleResetBundary();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Protected ...
|
|
||||||
protected:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
double lastUpper;
|
|
||||||
double lastLower;
|
|
||||||
datetime lastTime;
|
|
||||||
|
|
||||||
//
|
|
||||||
string symbol;
|
|
||||||
ENUM_TIMEFRAMES period;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool IsLookingForBoundary()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = lastUpper == 0 && lastLower == 0;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void FindBoundary(const X121MCycleConditions &conditions)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int zIndex = 0;
|
|
||||||
int cIndex = 1;
|
|
||||||
int pIndex = 2;
|
|
||||||
int ppIndex = 3;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Inside Bar ...
|
|
||||||
if (conditions.bars[cIndex].IsInsideBar())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
lastUpper = conditions.bars[pIndex].high;
|
|
||||||
lastLower = conditions.bars[pIndex].low;
|
|
||||||
|
|
||||||
//
|
|
||||||
lastTime = TimeCurrent();
|
|
||||||
|
|
||||||
//
|
|
||||||
DrawPivot(lastUpper, clrOrangeRed);
|
|
||||||
DrawPivot(lastLower, clrLimeGreen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void HandleResetBundary()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!IsSpecifiedValid(lastTime))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int age = iBarShift(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
lastTime,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (age < 7)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
RemoveDraws("X92_");
|
|
||||||
|
|
||||||
//
|
|
||||||
lastLower = 0;
|
|
||||||
lastUpper = 0;
|
|
||||||
lastTime = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void DrawPivot(
|
|
||||||
double price,
|
|
||||||
color clr //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
long chartID = ChartID();
|
|
||||||
datetime time1 = iTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
2 //
|
|
||||||
);
|
|
||||||
datetime time = iTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
0 //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
string pPrefix = "X92_P_" +
|
|
||||||
ToString(price);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (IsDrawExists(pPrefix))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
DrawTrendLine(
|
|
||||||
chartID,
|
|
||||||
pPrefix,
|
|
||||||
0,
|
|
||||||
time1,
|
|
||||||
price,
|
|
||||||
time,
|
|
||||||
price,
|
|
||||||
clr,
|
|
||||||
STYLE_SOLID,
|
|
||||||
2,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
};
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SaherElm IT Center MQL5 Class Library
|
|
||||||
// ----------------------------------------------
|
|
||||||
// Name: XSPSignaller
|
|
||||||
// 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 XSPSignaller : public XSignallerDescriptor
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Public ...
|
|
||||||
public:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor(s) ...
|
|
||||||
void XSPSignaller()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
name = XSP;
|
|
||||||
Default();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Deconstructor ...
|
|
||||||
void ~XSPSignaller() {}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Override(s) ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasLongConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
false
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
sl = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasShortConditions(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
false
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
sl = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Protected ...
|
|
||||||
protected:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user