complete XCA Indicator, implements it's Helper and Add all Conditions, and also rename XSTRCCI tProject o XCAEA and only use XCA and XOSC inside it ...
This commit is contained in:
@@ -1801,6 +1801,371 @@ bool IsFVGBoxValid(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
|
||||||
|
bool DetectXCAEAConditions(
|
||||||
|
XCAEAConditions &conditions,
|
||||||
|
XBoxZone &box,
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
XCXCAEAHelper *helper,
|
||||||
|
int barIndex = 0,
|
||||||
|
int loopback = 10 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
conditions.Clean();
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
loopback = NormalizeInt(loopback, 5);
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = helper.GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = helper.GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = helper.GetConditions(
|
||||||
|
conditions,
|
||||||
|
barIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int zIDX = barIndex;
|
||||||
|
int cIDX = zIDX + 1;
|
||||||
|
int pIDX = cIDX + 1;
|
||||||
|
int ppIDX = pIDX + 1;
|
||||||
|
int p3IDX = ppIDX + 1;
|
||||||
|
int p4IDX = p3IDX + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL zBar;
|
||||||
|
XOHCL cBar;
|
||||||
|
XOHCL pBar;
|
||||||
|
XOHCL ppBar;
|
||||||
|
XOHCL p3Bar;
|
||||||
|
XOHCL p4Bar;
|
||||||
|
result = zBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
zIDX //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
zBar.GetPreviousBar(cBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
cBar.GetPreviousBar(pBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
pBar.GetPreviousBar(ppBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
ppBar.GetPreviousBar(p3Bar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
p3Bar.GetPreviousBar(p4Bar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
ppBar.Clean();
|
||||||
|
p3Bar.Clean();
|
||||||
|
p4Bar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
conditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bars Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION cBarDir;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hammer ...
|
||||||
|
bool isCBarHammer = helper
|
||||||
|
.barAnalyser
|
||||||
|
.IsHammer(
|
||||||
|
cBar,
|
||||||
|
cBarDir //
|
||||||
|
);
|
||||||
|
bool isCBarBullishHammer =
|
||||||
|
isCBarHammer &&
|
||||||
|
IsBullish(cBarDir);
|
||||||
|
bool isCBarBearishHammer =
|
||||||
|
isCBarHammer &&
|
||||||
|
IsBearish(cBarDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rejected ...
|
||||||
|
bool isCBarRejected = helper
|
||||||
|
.barAnalyser
|
||||||
|
.IsRejected(
|
||||||
|
cBar,
|
||||||
|
cBarDir,
|
||||||
|
false, // Force Type ...
|
||||||
|
true // Force Fibo Pressure ...
|
||||||
|
);
|
||||||
|
bool isCBarBullishRejected =
|
||||||
|
isCBarRejected &&
|
||||||
|
IsBullish(cBarDir);
|
||||||
|
bool isCBarBearishRejected =
|
||||||
|
isCBarRejected &&
|
||||||
|
IsBearish(cBarDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Engulfed ...
|
||||||
|
bool isCBarEngulfed = helper
|
||||||
|
.barAnalyser
|
||||||
|
.IsEngulfed(
|
||||||
|
cBar,
|
||||||
|
cBarDir //
|
||||||
|
);
|
||||||
|
bool isCBarBullishEngulfed =
|
||||||
|
isCBarEngulfed &&
|
||||||
|
IsBullish(cBarDir);
|
||||||
|
bool isCBarBearishEngulfed =
|
||||||
|
isCBarEngulfed &&
|
||||||
|
IsBearish(cBarDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Momentum ...
|
||||||
|
bool isCBarMomentum = helper
|
||||||
|
.barAnalyser
|
||||||
|
.IsMomentum(
|
||||||
|
cBar,
|
||||||
|
cBarDir,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
bool isCBarBullishMomentum =
|
||||||
|
isCBarMomentum &&
|
||||||
|
IsBullish(cBarDir);
|
||||||
|
bool isCBarBearishMomentum =
|
||||||
|
isCBarMomentum &&
|
||||||
|
IsBearish(cBarDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bar Sumarise ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarValidForBullish =
|
||||||
|
(isCBarBullishHammer ||
|
||||||
|
isCBarBullishRejected ||
|
||||||
|
isCBarBullishMomentum ||
|
||||||
|
isCBarBullishEngulfed);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarValidForBearish =
|
||||||
|
(isCBarBearishHammer ||
|
||||||
|
isCBarBearishRejected ||
|
||||||
|
isCBarBearishMomentum ||
|
||||||
|
isCBarBearishEngulfed);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLowsUnderValesGolden =
|
||||||
|
//
|
||||||
|
pBar.low < conditions.valesGoldenBuffer[pIDX] &&
|
||||||
|
ppBar.low < conditions.valesGoldenBuffer[ppIDX] &&
|
||||||
|
p3Bar.low < conditions.valesGoldenBuffer[p3IDX] &&
|
||||||
|
p4Bar.low < conditions.valesGoldenBuffer[p4IDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isHighsOverPeaksGolden =
|
||||||
|
//
|
||||||
|
pBar.high > conditions.peaksGoldenBuffer[pIDX] &&
|
||||||
|
ppBar.high > conditions.peaksGoldenBuffer[ppIDX] &&
|
||||||
|
p3Bar.high > conditions.peaksGoldenBuffer[p3IDX] &&
|
||||||
|
p4Bar.high > conditions.peaksGoldenBuffer[p4IDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSwingLowSameAsVale =
|
||||||
|
conditions.swingLowsBuffer[p4IDX] == conditions.valesBuffer[p4IDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSwingHighSameAsPeak =
|
||||||
|
conditions.swingHighsBuffer[p4IDX] == conditions.peaksBuffer[p4IDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isStrSame = conditions.strBuffer[cIDX] == conditions.strBuffer[pIDX] &&
|
||||||
|
conditions.strBuffer[pIDX] == conditions.strBuffer[ppIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSameStrBreakedUp =
|
||||||
|
isStrSame &&
|
||||||
|
conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSameStrBreakedDown =
|
||||||
|
isStrSame &&
|
||||||
|
conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isStrBullishVPattern =
|
||||||
|
//
|
||||||
|
conditions.strStateBuffer[zIDX] > 0 &&
|
||||||
|
conditions.strStateBuffer[cIDX] > 0 &&
|
||||||
|
conditions.strStateBuffer[pIDX] > 0 &&
|
||||||
|
conditions.strBuffer[pIDX] < conditions.strBuffer[ppIDX] &&
|
||||||
|
conditions.strBuffer[pIDX] < conditions.strBuffer[cIDX] &&
|
||||||
|
conditions.strBuffer[pIDX] < conditions.strBuffer[zIDX] &&
|
||||||
|
conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isStrBearishVPattern =
|
||||||
|
//
|
||||||
|
conditions.strStateBuffer[zIDX] < 0 &&
|
||||||
|
conditions.strStateBuffer[cIDX] < 0 &&
|
||||||
|
conditions.strStateBuffer[pIDX] < 0 &&
|
||||||
|
conditions.strBuffer[pIDX] > conditions.strBuffer[ppIDX] &&
|
||||||
|
conditions.strBuffer[pIDX] > conditions.strBuffer[cIDX] &&
|
||||||
|
conditions.strBuffer[pIDX] > conditions.strBuffer[zIDX] &&
|
||||||
|
conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarLowInTKZone =
|
||||||
|
//
|
||||||
|
cBar.low < conditions.tenkanSenBuffer[cIDX] &&
|
||||||
|
cBar.low > conditions.kijunSenBuffer[cIDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarHighInTKZone =
|
||||||
|
//
|
||||||
|
cBar.high > conditions.tenkanSenBuffer[cIDX] &&
|
||||||
|
cBar.high < conditions.kijunSenBuffer[cIDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Summarise Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
//
|
||||||
|
isCBarLowInTKZone &&
|
||||||
|
isCBarBullishRejected &&
|
||||||
|
isCBarValidForBullish &&
|
||||||
|
conditions.isX3MaSlowBullish &&
|
||||||
|
conditions.isTenkanSenOverKijunSen &&
|
||||||
|
conditions.kijunSenBuffer[cIDX] > conditions.x3maSlowBuffer[cIDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
isCBarHighInTKZone &&
|
||||||
|
isCBarBearishRejected &&
|
||||||
|
isCBarValidForBearish &&
|
||||||
|
conditions.isX3MaSlowBearish &&
|
||||||
|
conditions.isTenkanSenUnderKijunSen &&
|
||||||
|
conditions.kijunSenBuffer[cIDX] < conditions.x3maSlowBuffer[cIDX]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
double entry = GetEntry(
|
||||||
|
conditions.symbol,
|
||||||
|
dir //
|
||||||
|
);
|
||||||
|
double sl = conditions.kijunSenBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
box.dir = dir;
|
||||||
|
box.symbol = conditions.symbol;
|
||||||
|
box.period = conditions.period;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.upper =
|
||||||
|
isBullish
|
||||||
|
? entry
|
||||||
|
: sl;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.lower =
|
||||||
|
isBullish
|
||||||
|
? sl
|
||||||
|
: entry;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.to = zBar.time;
|
||||||
|
box.from = p4Bar.time;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.type = ToString(dir) + "_Signal_" + conditions.symbol + "_" + ToString(conditions.period);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = box.IsValid() &&
|
||||||
|
HasDirection(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
conditions.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
ppBar.Clean();
|
||||||
|
p3Bar.Clean();
|
||||||
|
p4Bar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// SaherElm IT Center XTest MQL5 Expert Advisor
|
// SaherElm IT Center XTest MQL5 Expert Advisor
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// Name: XSTRCCIEA
|
// Name: XCAEA
|
||||||
// Description: an Exper Advisor which used Panels
|
// Description: an Exper Advisor which used Panels
|
||||||
//
|
//
|
||||||
// Maintainer:
|
// Maintainer:
|
||||||
@@ -15,7 +15,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 XSTRCCIEA"
|
#property description "SaherElm XCAEA EA"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
#include "../Classes/x-saherelm.x-alert.class.mq5"
|
#include "../Classes/x-saherelm.x-alert.class.mq5"
|
||||||
#include "../Classes/x-saherelm.x-trade.class.mq5"
|
#include "../Classes/x-saherelm.x-trade.class.mq5"
|
||||||
#include "../Classes/x-saherelm.x-volume.class.mq5"
|
#include "../Classes/x-saherelm.x-volume.class.mq5"
|
||||||
#include "../XSTRCCI/Classes/xstrcci.x-trade.manager.class.mq5"
|
#include "../XCAEA/Classes/xcaea.x-trade.manager.class.mq5"
|
||||||
#include "../XSTRCCI/Signals/xstrcci.signaller.class.mq5"
|
#include "../XCAEA/Signals/xcaea.signaller.class.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
#define ShortName "XSTRCCIEA"
|
#define ShortName "XCAEAEA"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Inputs ...
|
// Inputs ...
|
||||||
@@ -73,13 +73,11 @@ input bool eaReportNewHours = false; // Report New Hours
|
|||||||
// Variables, Instances ...
|
// Variables, Instances ...
|
||||||
XCAlert *eaAlert;
|
XCAlert *eaAlert;
|
||||||
XCTrade *eaTrade;
|
XCTrade *eaTrade;
|
||||||
XCVolume *eaVolume;
|
|
||||||
XCXSTRCCITradeManager *eaTradeManager;
|
|
||||||
|
|
||||||
//
|
|
||||||
XSignal eaSignal;
|
XSignal eaSignal;
|
||||||
XCXSTRCCISignaller *eaSignaller;
|
XCVolume *eaVolume;
|
||||||
XSTRCCIStrategyConditions eaConditions;
|
XCXCAEASignaller *eaSignaller;
|
||||||
|
XCXCAEATradeManager *eaTradeManager;
|
||||||
|
XCAEAStrategyConditions eaConditions;
|
||||||
|
|
||||||
//
|
//
|
||||||
int eaMaxAllowedPositions = 5;
|
int eaMaxAllowedPositions = 5;
|
||||||
@@ -176,7 +174,7 @@ void OnTick()
|
|||||||
|
|
||||||
//
|
//
|
||||||
double r2r = 5;
|
double r2r = 5;
|
||||||
string provider = "XSTRCCI";
|
string provider = "XCAEA";
|
||||||
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
||||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||||
|
|
||||||
@@ -603,7 +601,7 @@ void InitRequirements()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// EA Trae Manager ...
|
// EA Trae Manager ...
|
||||||
eaTradeManager = new XCXSTRCCITradeManager(
|
eaTradeManager = new XCXCAEATradeManager(
|
||||||
eaTrade //
|
eaTrade //
|
||||||
);
|
);
|
||||||
eaTradeManager.SetAlertEnableAlerts(eaEnableAlerts);
|
eaTradeManager.SetAlertEnableAlerts(eaEnableAlerts);
|
||||||
@@ -615,7 +613,7 @@ void InitRequirements()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// EA Signaller ...
|
// EA Signaller ...
|
||||||
eaSignaller = new XCXSTRCCISignaller(
|
eaSignaller = new XCXCAEASignaller(
|
||||||
_Symbol,
|
_Symbol,
|
||||||
_Period //
|
_Period //
|
||||||
);
|
);
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -568,6 +568,8 @@ enum ENUM_X_FIBO_LEVELS
|
|||||||
X_FIBO_LEVEL_382, // 0.382
|
X_FIBO_LEVEL_382, // 0.382
|
||||||
X_FIBO_LEVEL_500, // 0.5
|
X_FIBO_LEVEL_500, // 0.5
|
||||||
X_FIBO_LEVEL_618, // 0.618
|
X_FIBO_LEVEL_618, // 0.618
|
||||||
|
X_FIBO_LEVEL_730, // 0.730
|
||||||
|
X_FIBO_LEVEL_764, // 0.764
|
||||||
X_FIBO_LEVEL_786, // 0.786
|
X_FIBO_LEVEL_786, // 0.786
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -614,6 +616,16 @@ string ToString(ENUM_X_FIBO_LEVELS value)
|
|||||||
result = "0.618";
|
result = "0.618";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_FIBO_LEVEL_730:
|
||||||
|
result = "0.730";
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_FIBO_LEVEL_764:
|
||||||
|
result = "0.764";
|
||||||
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_FIBO_LEVEL_786:
|
case X_FIBO_LEVEL_786:
|
||||||
result = "0.786";
|
result = "0.786";
|
||||||
@@ -664,6 +676,16 @@ double GetFiboLevelValue(ENUM_X_FIBO_LEVELS value)
|
|||||||
result = 0.618;
|
result = 0.618;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_FIBO_LEVEL_730:
|
||||||
|
result = 0.730;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_FIBO_LEVEL_764:
|
||||||
|
result = 0.764;
|
||||||
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_FIBO_LEVEL_786:
|
case X_FIBO_LEVEL_786:
|
||||||
result = 0.786;
|
result = 0.786;
|
||||||
|
|||||||
@@ -1049,6 +1049,46 @@ struct XOHCL
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool IsBreaked(
|
||||||
|
double price,
|
||||||
|
ENUM_X_DIRECTION forDir //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() &&
|
||||||
|
price > 0 &&
|
||||||
|
HasDirection(forDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
IsBullish() &&
|
||||||
|
IsBullish(forDir) &&
|
||||||
|
close > price &&
|
||||||
|
open < price;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
IsBearish() &&
|
||||||
|
IsBearish(forDir) &&
|
||||||
|
close < price &&
|
||||||
|
open > price;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Highest Bar Index ...
|
// Find Highest Bar Index ...
|
||||||
int FindHighestIndex(
|
int FindHighestIndex(
|
||||||
|
|||||||
+117
-28
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// SaherElm IT Center MQL5 Class Library
|
// SaherElm IT Center MQL5 Class Library
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
// Name: XCXSTRCCITradeManager
|
// Name: XCXCAEATradeManager
|
||||||
// Description: provides all Requirements for Managing Trades ...
|
// Description: provides all Requirements for Managing Trades ...
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -24,23 +24,23 @@
|
|||||||
#include "../../Classes/x-saherelm.x-alert.class.mq5"
|
#include "../../Classes/x-saherelm.x-alert.class.mq5"
|
||||||
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
||||||
#include "../../Classes/x-saherelm.x-trade.class.mq5"
|
#include "../../Classes/x-saherelm.x-trade.class.mq5"
|
||||||
#include "../Libraries/xstrcci.signaller.lib.mq5"
|
#include "../Libraries/xcaea.signaller.lib.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions ...
|
// Definitions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
enum ENUM_XSTRCCI_TRADE_FINALIZATION
|
enum ENUM_XCAEA_TRADE_FINALIZATION
|
||||||
{
|
{
|
||||||
XSTRCCI_TRADE_FINAL_NONE,
|
XCAEA_TRADE_FINAL_NONE,
|
||||||
XSTRCCI_TRADE_FINAL_TP,
|
XCAEA_TRADE_FINAL_TP,
|
||||||
XSTRCCI_TRADE_FINAL_SL,
|
XCAEA_TRADE_FINAL_SL,
|
||||||
XSTRCCI_TRADE_FINAL_CLOSE_IN_PROFIT,
|
XCAEA_TRADE_FINAL_CLOSE_IN_PROFIT,
|
||||||
XSTRCCI_TRADE_FINAL_CLOSE_IN_LOSE,
|
XCAEA_TRADE_FINAL_CLOSE_IN_LOSE,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
struct XSTRCCITrade
|
struct XCAEATrade
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -49,12 +49,12 @@ struct XSTRCCITrade
|
|||||||
XSignal signal;
|
XSignal signal;
|
||||||
ulong positionID;
|
ulong positionID;
|
||||||
double commission;
|
double commission;
|
||||||
XSTRCCIStrategyConditions conditions;
|
XCAEAStrategyConditions conditions;
|
||||||
ENUM_XSTRCCI_TRADE_FINALIZATION finalize;
|
ENUM_XCAEA_TRADE_FINALIZATION finalize;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
XSTRCCITrade()
|
XCAEATrade()
|
||||||
{
|
{
|
||||||
Clean();
|
Clean();
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ struct XSTRCCITrade
|
|||||||
commission = 0;
|
commission = 0;
|
||||||
positionID = 0;
|
positionID = 0;
|
||||||
conditions.Clean();
|
conditions.Clean();
|
||||||
finalize = XSTRCCI_TRADE_FINAL_NONE;
|
finalize = XCAEA_TRADE_FINAL_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
ZeroMemory(this);
|
ZeroMemory(this);
|
||||||
@@ -127,7 +127,7 @@ struct XSTRCCITrade
|
|||||||
//
|
//
|
||||||
result = HasSignal() &&
|
result = HasSignal() &&
|
||||||
IsExecuted() &&
|
IsExecuted() &&
|
||||||
finalize != XSTRCCI_TRADE_FINAL_NONE;
|
finalize != XCAEA_TRADE_FINAL_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -136,7 +136,7 @@ struct XSTRCCITrade
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Implementations ...
|
// Implementations ...
|
||||||
class XCXSTRCCITradeManager : public XCBaseAlert
|
class XCXCAEATradeManager : public XCBaseAlert
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Public ...
|
// Public ...
|
||||||
@@ -149,7 +149,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructors ...
|
// Constructors ...
|
||||||
XCXSTRCCITradeManager(XCTrade *&_trader)
|
XCXCAEATradeManager(XCTrade *&_trader)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
trader = _trader;
|
trader = _trader;
|
||||||
@@ -159,7 +159,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// De Constructors ...
|
// De Constructors ...
|
||||||
~XCXSTRCCITradeManager()
|
~XCXCAEATradeManager()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ZeroMemory(trader);
|
ZeroMemory(trader);
|
||||||
@@ -220,6 +220,10 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
*/
|
*/
|
||||||
void Protect()
|
void Protect()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
string prefix = "Protector: ";
|
||||||
|
int targetDistance = 5;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool has = HasChild(trades);
|
bool has = HasChild(trades);
|
||||||
if (!has)
|
if (!has)
|
||||||
@@ -324,9 +328,94 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Select Position ...
|
// Select Position ...
|
||||||
XPosition iPosition = ownPosition[i];
|
XPosition iPosition = ownPosition[i];
|
||||||
|
int idx = -1;
|
||||||
|
has = HasTrade(
|
||||||
|
idx,
|
||||||
|
iPosition.ticket //
|
||||||
|
);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle RF ...
|
bool isLong = IsLong(iPosition.type);
|
||||||
|
double points = GetPoints(iPosition.symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle RF On Targets ...
|
||||||
|
if (iPosition.profit > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double targets[];
|
||||||
|
Copy(
|
||||||
|
trades[idx].signal.targets,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
int targetsCount = ArraySize(targets);
|
||||||
|
has = IsValidSize(targetsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int j = 0; j < targetsCount; j++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double jTarget = targets[j];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Traget Validation ...
|
||||||
|
has =
|
||||||
|
iPosition.sl == 0
|
||||||
|
? true
|
||||||
|
: isLong
|
||||||
|
? iPosition.sl < jTarget
|
||||||
|
: iPosition.sl > jTarget;
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double targetDelta = isLong
|
||||||
|
? jTarget + (targetDistance * points)
|
||||||
|
: jTarget - (targetDistance * points);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Can Risk Free ...
|
||||||
|
bool canRF = jTarget > 0 &&
|
||||||
|
(isLong
|
||||||
|
? jTarget > iPosition.entry
|
||||||
|
: jTarget < iPosition.entry) &&
|
||||||
|
(isLong
|
||||||
|
? iPosition.price > targetDelta
|
||||||
|
: iPosition.price < targetDelta);
|
||||||
|
if (canRF)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double sl = jTarget;
|
||||||
|
double tp = iPosition.tp;
|
||||||
|
string comment = "RF On Target ...";
|
||||||
|
bool isModified = trader.Modify(
|
||||||
|
iPosition.ticket,
|
||||||
|
sl,
|
||||||
|
tp,
|
||||||
|
comment //
|
||||||
|
);
|
||||||
|
if (isModified)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string message = prefix +
|
||||||
|
ToString(iPosition.type) +
|
||||||
|
" Position: " +
|
||||||
|
ToString(iPosition.ticket) +
|
||||||
|
" RF On Traget: " + ToString(jTarget) +
|
||||||
|
" Successfully ...";
|
||||||
|
Alert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,13 +423,13 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
* Execute Specified Signal ...
|
* Execute Specified Signal ...
|
||||||
*
|
*
|
||||||
* @param signal: XSignal instance reference ...
|
* @param signal: XSignal instance reference ...
|
||||||
* @param conditions: XSTRCCIStrategyConditions instance reference ...
|
* @param conditions: XCAEAStrategyConditions instance reference ...
|
||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool Execute(
|
bool Execute(
|
||||||
XSignal &signal,
|
XSignal &signal,
|
||||||
XSTRCCIStrategyConditions &conditions //
|
XCAEAStrategyConditions &conditions //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -400,7 +489,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XSTRCCITrade iTrade;
|
XCAEATrade iTrade;
|
||||||
|
|
||||||
//
|
//
|
||||||
ulong positionID = trader.GetLastOpenPositionTicket();
|
ulong positionID = trader.GetLastOpenPositionTicket();
|
||||||
@@ -447,7 +536,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
trades[idx].swap = deal.swap;
|
trades[idx].swap = deal.swap;
|
||||||
trades[idx].profit = deal.profit;
|
trades[idx].profit = deal.profit;
|
||||||
trades[idx].commission = deal.commission;
|
trades[idx].commission = deal.commission;
|
||||||
trades[idx].finalize = XSTRCCI_TRADE_FINAL_TP;
|
trades[idx].finalize = XCAEA_TRADE_FINAL_TP;
|
||||||
|
|
||||||
//
|
//
|
||||||
tpCount++;
|
tpCount++;
|
||||||
@@ -480,7 +569,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
trades[idx].swap = deal.swap;
|
trades[idx].swap = deal.swap;
|
||||||
trades[idx].profit = deal.profit;
|
trades[idx].profit = deal.profit;
|
||||||
trades[idx].commission = deal.commission;
|
trades[idx].commission = deal.commission;
|
||||||
trades[idx].finalize = XSTRCCI_TRADE_FINAL_SL;
|
trades[idx].finalize = XCAEA_TRADE_FINAL_SL;
|
||||||
|
|
||||||
//
|
//
|
||||||
slCount++;
|
slCount++;
|
||||||
@@ -517,8 +606,8 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
trades[idx].profit = position.profit;
|
trades[idx].profit = position.profit;
|
||||||
trades[idx].commission = position.commission;
|
trades[idx].commission = position.commission;
|
||||||
trades[idx].finalize = isInProfit
|
trades[idx].finalize = isInProfit
|
||||||
? XSTRCCI_TRADE_FINAL_CLOSE_IN_PROFIT
|
? XCAEA_TRADE_FINAL_CLOSE_IN_PROFIT
|
||||||
: XSTRCCI_TRADE_FINAL_CLOSE_IN_LOSE;
|
: XCAEA_TRADE_FINAL_CLOSE_IN_LOSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isInProfit)
|
if (isInProfit)
|
||||||
@@ -576,7 +665,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XSTRCCITrade iTrade = trades[i];
|
XCAEATrade iTrade = trades[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
@@ -636,7 +725,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XSTRCCITrade iTrade = trades[i];
|
XCAEATrade iTrade = trades[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
@@ -687,7 +776,7 @@ class XCXSTRCCITradeManager : public XCBaseAlert
|
|||||||
CArrayObj mObjects;
|
CArrayObj mObjects;
|
||||||
|
|
||||||
//
|
//
|
||||||
XSTRCCITrade trades[];
|
XCAEATrade trades[];
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
File diff suppressed because it is too large
Load Diff
+19
-113
@@ -2,8 +2,8 @@
|
|||||||
//
|
//
|
||||||
// SaherElm IT Center MQL5 Indicator
|
// SaherElm IT Center MQL5 Indicator
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// Name: XSTRCCISignaller Lib
|
// Name: XCAEASignaller Lib
|
||||||
// Description: Library for XSTRCCI Signaller ...
|
// Description: Library for XCAEA Signaller ...
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Maintainer:
|
// Maintainer:
|
||||||
@@ -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 Library for XSTRCCI Signaller"
|
#property description "SaherElm Library for XCAEA Signaller"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "../../Libraries/x-saherelm.common.lib.mq5"
|
#include "../../Libraries/x-saherelm.common.lib.mq5"
|
||||||
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
|
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
|
||||||
#include "../../Libraries/x-saherelm.x-trade.lib.mq5"
|
#include "../../Libraries/x-saherelm.x-trade.lib.mq5"
|
||||||
#include "../Helpers/xstrcci.helper.mq5"
|
#include "../Helpers/xcaea.helper.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enumeration ...
|
// Enumeration ...
|
||||||
@@ -49,7 +49,7 @@ enum ENUM_GUARD_ACTIONS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Conditions Struct ...
|
// Conditions Struct ...
|
||||||
struct XSTRCCIStrategyConditions
|
struct XCAEAStrategyConditions
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -78,11 +78,11 @@ struct XSTRCCIStrategyConditions
|
|||||||
XBoxZone signalBox;
|
XBoxZone signalBox;
|
||||||
ENUM_X_DIRECTION dir;
|
ENUM_X_DIRECTION dir;
|
||||||
ENUM_X_POSITION_TYPES type;
|
ENUM_X_POSITION_TYPES type;
|
||||||
XSTRCCIConditions conditions;
|
XCAEAConditions conditions;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
XSTRCCIStrategyConditions()
|
XCAEAStrategyConditions()
|
||||||
{
|
{
|
||||||
Clean();
|
Clean();
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ struct XSTRCCIStrategyConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Model a Guard Action ...
|
// Model a Guard Action ...
|
||||||
struct XSTRCCIGuard
|
struct XCAEAGuard
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -315,7 +315,7 @@ struct XSTRCCIGuard
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
XSTRCCIGuard()
|
XCAEAGuard()
|
||||||
{
|
{
|
||||||
Clean();
|
Clean();
|
||||||
}
|
}
|
||||||
@@ -385,14 +385,14 @@ struct XSTRCCIGuard
|
|||||||
/**
|
/**
|
||||||
* Add Guard to Collection ...
|
* Add Guard to Collection ...
|
||||||
*
|
*
|
||||||
* @param guard: XSTRCCIGuard instance ...
|
* @param guard: XCAEAGuard instance ...
|
||||||
* @param guards: XSTRCCIGuard instance Collection ...
|
* @param guards: XCAEAGuard instance Collection ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int AddGuard(
|
int AddGuard(
|
||||||
XSTRCCIGuard &guard,
|
XCAEAGuard &guard,
|
||||||
XSTRCCIGuard &guards[] //
|
XCAEAGuard &guards[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -418,11 +418,11 @@ int AddGuard(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool DetectXSTRCCIConditions(
|
bool DetectXCAEAConditions(
|
||||||
XSTRCCIConditions &conditions,
|
XCAEAConditions &conditions,
|
||||||
XBoxZone &box,
|
XBoxZone &box,
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
XCXSTRCCIHelper *helper,
|
XCXCAEAHelper *helper,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
int loopback = 10 //
|
int loopback = 10 //
|
||||||
)
|
)
|
||||||
@@ -601,114 +601,20 @@ bool DetectXSTRCCIConditions(
|
|||||||
//
|
//
|
||||||
// Conditions ...
|
// Conditions ...
|
||||||
|
|
||||||
//
|
|
||||||
bool isLowsUnderValesGolden =
|
|
||||||
//
|
|
||||||
pBar.low < conditions.valesGoldenBuffer[pIDX] &&
|
|
||||||
ppBar.low < conditions.valesGoldenBuffer[ppIDX] &&
|
|
||||||
p3Bar.low < conditions.valesGoldenBuffer[p3IDX] &&
|
|
||||||
p4Bar.low < conditions.valesGoldenBuffer[p4IDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isHighsOverPeaksGolden =
|
|
||||||
//
|
|
||||||
pBar.high > conditions.peaksGoldenBuffer[pIDX] &&
|
|
||||||
ppBar.high > conditions.peaksGoldenBuffer[ppIDX] &&
|
|
||||||
p3Bar.high > conditions.peaksGoldenBuffer[p3IDX] &&
|
|
||||||
p4Bar.high > conditions.peaksGoldenBuffer[p4IDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSwingLowSameAsVale =
|
|
||||||
conditions.swingLowsBuffer[p4IDX] == conditions.valesBuffer[p4IDX];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSwingHighSameAsPeak =
|
|
||||||
conditions.swingHighsBuffer[p4IDX] == conditions.peaksBuffer[p4IDX];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isStrSame = conditions.strBuffer[cIDX] == conditions.strBuffer[pIDX] &&
|
|
||||||
conditions.strBuffer[pIDX] == conditions.strBuffer[ppIDX];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSameStrBreakedUp =
|
|
||||||
isStrSame &&
|
|
||||||
conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSameStrBreakedDown =
|
|
||||||
isStrSame &&
|
|
||||||
conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isStrBullishVPattern =
|
|
||||||
//
|
|
||||||
conditions.strStateBuffer[zIDX] > 0 &&
|
|
||||||
conditions.strStateBuffer[cIDX] > 0 &&
|
|
||||||
conditions.strStateBuffer[pIDX] > 0 &&
|
|
||||||
conditions.strBuffer[pIDX] < conditions.strBuffer[ppIDX] &&
|
|
||||||
conditions.strBuffer[pIDX] < conditions.strBuffer[cIDX] &&
|
|
||||||
conditions.strBuffer[pIDX] < conditions.strBuffer[zIDX] &&
|
|
||||||
conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isStrBearishVPattern =
|
|
||||||
//
|
|
||||||
conditions.strStateBuffer[zIDX] < 0 &&
|
|
||||||
conditions.strStateBuffer[cIDX] < 0 &&
|
|
||||||
conditions.strStateBuffer[pIDX] < 0 &&
|
|
||||||
conditions.strBuffer[pIDX] > conditions.strBuffer[ppIDX] &&
|
|
||||||
conditions.strBuffer[pIDX] > conditions.strBuffer[cIDX] &&
|
|
||||||
conditions.strBuffer[pIDX] > conditions.strBuffer[zIDX] &&
|
|
||||||
conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isCBarLowInTKZone =
|
|
||||||
//
|
|
||||||
cBar.low < conditions.tenkanSenBuffer[cIDX] &&
|
|
||||||
cBar.low > conditions.kijunSenBuffer[cIDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isCBarHighInTKZone =
|
|
||||||
//
|
|
||||||
cBar.high > conditions.tenkanSenBuffer[cIDX] &&
|
|
||||||
cBar.high < conditions.kijunSenBuffer[cIDX]
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Summarise Conditions ...
|
// Summarise Conditions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBullish =
|
bool isBullish =
|
||||||
//
|
//
|
||||||
isCBarLowInTKZone &&
|
false
|
||||||
isCBarBullishRejected &&
|
|
||||||
isCBarValidForBullish &&
|
|
||||||
conditions.isX3MaSlowBullish &&
|
|
||||||
conditions.isTenkanSenOverKijunSen &&
|
|
||||||
conditions.kijunSenBuffer[cIDX] > conditions.x3maSlowBuffer[cIDX]
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBearish =
|
bool isBearish =
|
||||||
//
|
//
|
||||||
isCBarHighInTKZone &&
|
false
|
||||||
isCBarBearishRejected &&
|
|
||||||
isCBarValidForBearish &&
|
|
||||||
conditions.isX3MaSlowBearish &&
|
|
||||||
conditions.isTenkanSenUnderKijunSen &&
|
|
||||||
conditions.kijunSenBuffer[cIDX] < conditions.x3maSlowBuffer[cIDX]
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -728,7 +634,7 @@ bool DetectXSTRCCIConditions(
|
|||||||
conditions.symbol,
|
conditions.symbol,
|
||||||
dir //
|
dir //
|
||||||
);
|
);
|
||||||
double sl = conditions.kijunSenBuffer[cIDX];
|
double sl = 0; // conditions.kijunSenBuffer[cIDX];
|
||||||
|
|
||||||
//
|
//
|
||||||
box.dir = dir;
|
box.dir = dir;
|
||||||
+52
-54
@@ -2,8 +2,8 @@
|
|||||||
//
|
//
|
||||||
// SaherElm IT Center MQL5 Indicator
|
// SaherElm IT Center MQL5 Indicator
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// Name: XCXSTRCCISignaller ...
|
// Name: XCXCAEASignaller ...
|
||||||
// Description: Class for XSTRCCI Signaller ...
|
// Description: Class for XCAEA Signaller ...
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Maintainer:
|
// Maintainer:
|
||||||
@@ -16,20 +16,20 @@
|
|||||||
#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 Class for XSTRCCI Signaller"
|
#property description "SaherElm Class for XCAEA Signaller"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../../Classes/x-saherelm.base.class.mq5"
|
#include "../../Classes/x-saherelm.base.class.mq5"
|
||||||
#include "../../Classes/x-saherelm.x-cobject.class.mq5"
|
#include "../../Classes/x-saherelm.x-cobject.class.mq5"
|
||||||
#include "../Helpers/xstrcci.helper.mq5"
|
#include "../Helpers/xcaea.helper.mq5"
|
||||||
#include "../Libraries/xstrcci.signaller.lib.mq5"
|
#include "../Libraries/xcaea.signaller.lib.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions ...
|
// Definitions ...
|
||||||
|
|
||||||
class XCXSTRCCISignaller : XCBase
|
class XCXCAEASignaller : XCBase
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Public ...
|
// Public ...
|
||||||
@@ -37,16 +37,16 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
bool useGuards;
|
bool useGuards;
|
||||||
XSTRCCIInputs inputs;
|
XCAEAInputs inputs;
|
||||||
XBarTracker barTraker;
|
XBarTracker barTraker;
|
||||||
XCXSTRCCIHelper *helper;
|
XCXCAEAHelper *helper;
|
||||||
bool continuesRFTillTarget;
|
bool continuesRFTillTarget;
|
||||||
XSTRCCIStrategyConditions mConditions;
|
XCAEAStrategyConditions mConditions;
|
||||||
XSTRCCIStrategyConditions mConditionsCollection[];
|
XCAEAStrategyConditions mConditionsCollection[];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
XCXSTRCCISignaller(
|
XCXCAEASignaller(
|
||||||
string _symbol,
|
string _symbol,
|
||||||
ENUM_TIMEFRAMES _period //
|
ENUM_TIMEFRAMES _period //
|
||||||
)
|
)
|
||||||
@@ -59,7 +59,7 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCXSTRCCISignaller()
|
~XCXCAEASignaller()
|
||||||
{
|
{
|
||||||
DeInit();
|
DeInit();
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
*/
|
*/
|
||||||
bool DetectSignalSetup(
|
bool DetectSignalSetup(
|
||||||
double tpReward = 3,
|
double tpReward = 3,
|
||||||
double maxAllowedSLDistanceInPoint = 300 //
|
double maxAllowedSLDistanceInPoint = 100 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -162,8 +162,8 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
// Checking Conditions ...
|
// Checking Conditions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XSTRCCIConditions conditions;
|
XCAEAConditions conditions;
|
||||||
hasSignalBox = DetectXSTRCCIConditions(
|
hasSignalBox = DetectXCAEAConditions(
|
||||||
conditions,
|
conditions,
|
||||||
signalBox,
|
signalBox,
|
||||||
signalBoxDir,
|
signalBoxDir,
|
||||||
@@ -232,6 +232,17 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
? entry - sl
|
? entry - sl
|
||||||
: sl - entry;
|
: sl - entry;
|
||||||
risk += spread;
|
risk += spread;
|
||||||
|
if (risk >= maxAllowedSLDistanceInPoint * points) {
|
||||||
|
//
|
||||||
|
// Fix Risk in Big Distances ...
|
||||||
|
double hh5 = zBar.FindHighest(5, MODE_HIGH);
|
||||||
|
double ll5 = zBar.FindLowest(5, MODE_LOW);
|
||||||
|
|
||||||
|
//
|
||||||
|
double hhll5Delta = hh5 - ll5;
|
||||||
|
double riskDelta = hhll5Delta / 2;
|
||||||
|
risk = riskDelta;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double rewardTP = risk * tpReward;
|
double rewardTP = risk * tpReward;
|
||||||
@@ -255,7 +266,7 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
? entry
|
? entry
|
||||||
: sl;
|
: sl;
|
||||||
mConditions.dir = signalBoxDir;
|
mConditions.dir = signalBoxDir;
|
||||||
mConditions.provider = "XSTRCCI";
|
mConditions.provider = "XCAEA";
|
||||||
mConditions.signalBox = signalBox;
|
mConditions.signalBox = signalBox;
|
||||||
mConditions.setupTime = zBar.time;
|
mConditions.setupTime = zBar.time;
|
||||||
mConditions.conditions = conditions;
|
mConditions.conditions = conditions;
|
||||||
@@ -307,13 +318,13 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
/**
|
/**
|
||||||
* Detect Trigger Conditions for Specified Signal ...
|
* Detect Trigger Conditions for Specified Signal ...
|
||||||
*
|
*
|
||||||
* @param conditions: XSTRCCIStrategyConditions instance Reference, Specified Signal Conditions ...
|
* @param conditions: XCAEAStrategyConditions instance Reference, Specified Signal Conditions ...
|
||||||
* @param maxAllowedSetupAge: specified Setup Age for Expiration (if bigger than Zero) ...
|
* @param maxAllowedSetupAge: specified Setup Age for Expiration (if bigger than Zero) ...
|
||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool DetectSignalTrigger(
|
bool DetectSignalTrigger(
|
||||||
XSTRCCIStrategyConditions &conditions,
|
XCAEAStrategyConditions &conditions,
|
||||||
int maxAllowedSetupAge = 60 //
|
int maxAllowedSetupAge = 60 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -381,14 +392,14 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
/**
|
/**
|
||||||
* Detect Guards bsed on Signalling Class ...
|
* Detect Guards bsed on Signalling Class ...
|
||||||
*
|
*
|
||||||
* @param guards: XSTRCCIGuard instance Collection, Holds Provided Guards ...
|
* @param guards: XCAEAGuard instance Collection, Holds Provided Guards ...
|
||||||
* @param positions: XPosition instance Collection, Provides Signalling Based Positions for Apply Guards on them ...
|
* @param positions: XPosition instance Collection, Provides Signalling Based Positions for Apply Guards on them ...
|
||||||
* @param provider: X121SMCStrategySignalProviderData instance Reference, Specified Data for Cycles ...
|
* @param provider: X121SMCStrategySignalProviderData instance Reference, Specified Data for Cycles ...
|
||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool DetectGuards(
|
bool DetectGuards(
|
||||||
XSTRCCIGuard &guards[],
|
XCAEAGuard &guards[],
|
||||||
const XPosition &positions[] //
|
const XPosition &positions[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -427,7 +438,7 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Copy Original Items ...
|
// Copy Original Items ...
|
||||||
XSTRCCIStrategyConditions tmpItems[];
|
XCAEAStrategyConditions tmpItems[];
|
||||||
Copy(
|
Copy(
|
||||||
mConditionsCollection,
|
mConditionsCollection,
|
||||||
tmpItems //
|
tmpItems //
|
||||||
@@ -441,7 +452,7 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XSTRCCIStrategyConditions iItem = tmpItems[i];
|
XCAEAStrategyConditions iItem = tmpItems[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool canRemove = mConditions.dir == iItem.dir &&
|
bool canRemove = mConditions.dir == iItem.dir &&
|
||||||
@@ -526,40 +537,27 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
inputs.ctInputs.showCandleTime = true;
|
inputs.ctInputs.showCandleTime = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XCA ...
|
||||||
inputs.pvInputs.showSar = false;
|
|
||||||
inputs.pvInputs.showPeaks = false;
|
|
||||||
inputs.pvInputs.showVales = false;
|
|
||||||
inputs.pvInputs.showTrend = false;
|
|
||||||
inputs.pvInputs.showSwingLows = false;
|
|
||||||
inputs.pvInputs.showSwingHighs = false;
|
|
||||||
inputs.pvInputs.showGoldenZones = false;
|
|
||||||
inputs.pvInputs.showSupports = false;
|
|
||||||
inputs.pvInputs.showResistances = false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTR ...
|
inputs.caInputs.supResSmoothingLength = 7;
|
||||||
inputs.strInputs.showStr = false;
|
inputs.caInputs.supResSmoothingMode = X_MA_MODE_NONE;
|
||||||
inputs.strInputs.showVidya = false;
|
|
||||||
inputs.strInputs.showStrUpper = false;
|
|
||||||
inputs.strInputs.showStrLower = false;
|
|
||||||
inputs.strInputs.showStrSMLow = false;
|
|
||||||
inputs.strInputs.showStrSMHigh = false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// X3MA ...
|
inputs.caInputs.showKI = true;
|
||||||
inputs.ma3Inputs.showX3MaFast = false;
|
inputs.caInputs.showSar = true;
|
||||||
inputs.ma3Inputs.showX3MaMid = false;
|
inputs.caInputs.showTrend = true;
|
||||||
inputs.ma3Inputs.showX3MaSlow = true;
|
inputs.caInputs.showSwings = false;
|
||||||
|
inputs.caInputs.showLongCycle = false;
|
||||||
//
|
inputs.caInputs.showHindCycle = false;
|
||||||
// XICH ...
|
inputs.caInputs.showFiboLevel1 = false;
|
||||||
inputs.ichInputs.showKumo = false;
|
inputs.caInputs.showFiboLevel2 = false;
|
||||||
inputs.ichInputs.showKijunSen = true;
|
inputs.caInputs.showFiboLevel3 = false;
|
||||||
inputs.ichInputs.showTenkanSen = true;
|
inputs.caInputs.showShortCycle = false;
|
||||||
inputs.ichInputs.showChikouSpan = false;
|
inputs.caInputs.showMediumCycle = false;
|
||||||
inputs.ichInputs.showSenkouSpanA = false;
|
inputs.caInputs.showPeaksAndVales = true;
|
||||||
inputs.ichInputs.showSenkouSpanB = false;
|
inputs.caInputs.showPeakAndValeGolden = true;
|
||||||
|
inputs.caInputs.showSupportAndResistance = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XOSCS ...
|
// XOSCS ...
|
||||||
@@ -577,8 +575,8 @@ class XCXSTRCCISignaller : XCBase
|
|||||||
inputs.showMACD = false;
|
inputs.showMACD = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTRCCI Helper ...
|
// XCAEA Helper ...
|
||||||
helper = new XCXSTRCCIHelper();
|
helper = new XCXCAEAHelper();
|
||||||
helper.Init(
|
helper.Init(
|
||||||
symbol,
|
symbol,
|
||||||
period,
|
period,
|
||||||
@@ -18,6 +18,7 @@ async function handleCleanup() {
|
|||||||
"Parsers", // Strategies Filters based on Conditions
|
"Parsers", // Strategies Filters based on Conditions
|
||||||
"Strategies", // Strategies Classes which Provides Signals
|
"Strategies", // Strategies Classes which Provides Signals
|
||||||
"X121SMCEA", // X121SMC EA Projects ...
|
"X121SMCEA", // X121SMC EA Projects ...
|
||||||
|
"XCAEA", // XCAEA Projects ...
|
||||||
];
|
];
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user