last ...
This commit is contained in:
Vendored
+96
-47
@@ -1,5 +1,58 @@
|
||||
{
|
||||
"todo": [
|
||||
"todo": [],
|
||||
"in-progress": [
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"creation_time": "2024-06-17T00:01:04.987Z",
|
||||
"description": {
|
||||
"content": "- Max Number;\n- Voluem Multiplier;\n- Max Volume;\n- Support on Distance;",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "81",
|
||||
"references": [],
|
||||
"title": "Fix Allow Supports ..."
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"creation_time": "2024-06-16T23:58:59.163Z",
|
||||
"description": {
|
||||
"content": "Fix Open Signals When Support Signals only Open\nMax Allowed Trades Handler ...",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "79",
|
||||
"references": [],
|
||||
"title": "Fix Max Allowed Trade on Only SUpport Signals"
|
||||
}
|
||||
],
|
||||
"testing": [
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"creation_time": "2024-06-16T23:57:54.021Z",
|
||||
"id": "78",
|
||||
"references": [],
|
||||
"title": "add Max Allowe Signals per Symbol"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"creation_time": "2024-06-16T23:59:52.125Z",
|
||||
"description": {
|
||||
"content": "- Start Time;\n- End Time;\n- Close On Specific;\n- Close On Opposite;",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "80",
|
||||
"references": [],
|
||||
"title": "Complete Signalling COntrols ..."
|
||||
}
|
||||
],
|
||||
"done": [
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
@@ -14,38 +67,6 @@
|
||||
"references": [],
|
||||
"title": "Add all Trail and Position State Managements inside Guards"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"category": "X121 EA",
|
||||
"creation_time": "2024-05-30T21:47:35.252Z",
|
||||
"details": {
|
||||
"content": "Senario 1:\n- when a new Position Recieved and Executed;\n- detect all Same Symbol/Period Provider Positions;\n- if All exists open positions running in profit;\n- detect nearest entry and put all SLs in it;",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "66",
|
||||
"references": [],
|
||||
"title": "Position Management Senarios"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"category": "XTrade",
|
||||
"creation_time": "2024-05-30T21:33:31.361Z",
|
||||
"description": {
|
||||
"content": "implement a mechanism to waits for breakout signals entry then Execute Signals;",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "61",
|
||||
"references": [],
|
||||
"title": "Signal Executing On Breakouts"
|
||||
}
|
||||
],
|
||||
"in-progress": [],
|
||||
"testing": [],
|
||||
"done": [
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
@@ -749,6 +770,20 @@
|
||||
"references": [],
|
||||
"title": "Move Support and Resistance Pivots Finders inside X121Market Class"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"category": "X121 EA",
|
||||
"creation_time": "2024-05-30T21:47:35.252Z",
|
||||
"details": {
|
||||
"content": "Senario 1:\n- when a new Position Recieved and Executed;\n- detect all Same Symbol/Period Provider Positions;\n- if All exists open positions running in profit;\n- detect nearest entry and put all SLs in it;",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "66",
|
||||
"references": [],
|
||||
"title": "Position Management Senarios"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
@@ -786,6 +821,20 @@
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
@@ -900,6 +949,20 @@
|
||||
"references": [],
|
||||
"title": "resolve InvalidStop on Partial Closing"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"category": "XTrade",
|
||||
"creation_time": "2024-05-30T21:33:31.361Z",
|
||||
"description": {
|
||||
"content": "implement a mechanism to waits for breakout signals entry then Execute Signals;",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "61",
|
||||
"references": [],
|
||||
"title": "Signal Executing On Breakouts"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
@@ -944,20 +1007,6 @@
|
||||
"content": "do a refactor on all brokers, higgh priority criterias ...",
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -945,27 +945,34 @@ protected:
|
||||
}
|
||||
|
||||
//
|
||||
// Signal Event Listeners ...
|
||||
|
||||
//
|
||||
void NotifyOnSignalEventHandlers(XSignal &signal)
|
||||
int CancelOrders()
|
||||
{
|
||||
//
|
||||
int listenersCount = ArraySize(mOnSignalEventHandlers);
|
||||
if (listenersCount <= 0)
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
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;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < listenersCount; i++)
|
||||
{
|
||||
//
|
||||
TOnSignal iListener = mOnSignalEventHandlers[i];
|
||||
result = mTrader.CancelOrders(
|
||||
supports //
|
||||
);
|
||||
|
||||
//
|
||||
iListener(signal);
|
||||
}
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1069,7 +1076,7 @@ protected:
|
||||
//
|
||||
// Check Hedge Conditions is Happens or not ...
|
||||
// if true doing Hedge ...
|
||||
bool DoEQMHedge()
|
||||
bool DoHedge()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
@@ -1148,6 +1155,30 @@ protected:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Signal Event Listeners ...
|
||||
|
||||
//
|
||||
void NotifyOnSignalEventHandlers(XSignal &signal)
|
||||
{
|
||||
//
|
||||
int listenersCount = ArraySize(mOnSignalEventHandlers);
|
||||
if (listenersCount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < listenersCount; i++)
|
||||
{
|
||||
//
|
||||
TOnSignal iListener = mOnSignalEventHandlers[i];
|
||||
|
||||
//
|
||||
iListener(signal);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Guards ...
|
||||
|
||||
|
||||
@@ -1142,3 +1142,198 @@
|
||||
);
|
||||
bullishScore += tmpBullishScore;
|
||||
bearishScore += tmpBearishScore;
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ input double x121EANextTrailPoint = 10; // Next Trailling Step
|
||||
//
|
||||
input group "Supporting";
|
||||
input bool x121EAAllowSupport = false; // Allow Support Signals
|
||||
double x121EASupportDistance = 50; // Supporting Distance
|
||||
input int x121EAMaxNumberOfSupports = 1; // Max Number of Support Signals
|
||||
input double x121EASupportVolumeMultiplier = 2.0; // Support Signals Volume Multiplier
|
||||
input double x121EAMaxAllowedSupportVolume = 0.8; // Max Allowed Support Signals Volume
|
||||
@@ -244,6 +245,7 @@ bool InitialEA()
|
||||
//
|
||||
// Supporting ...
|
||||
x121EA.AllowSupport(x121EAAllowSupport);
|
||||
x121EA.SupportDistance(x121EASupportDistance);
|
||||
x121EA.MaxNumberOfSupports(x121EAMaxNumberOfSupports);
|
||||
x121EA.SupportVolumeMultiplier(x121EASupportVolumeMultiplier);
|
||||
x121EA.MaxAllowedSupportVolume(x121EAMaxAllowedSupportVolume);
|
||||
|
||||
Reference in New Issue
Block a user