This commit is contained in:
2024-07-19 08:08:26 +03:30
parent 70f2435c44
commit b038cc0b7e
11 changed files with 3482 additions and 308 deletions
+32 -216
View File
@@ -814,11 +814,9 @@ void FindSupport()
//
datetime at = NULL;
double support = 0;
XOHCL support;
bool hasSupport = cBar.HasSupport(
support,
at //
);
support);
if (!hasSupport)
{
return;
@@ -828,21 +826,7 @@ void FindSupport()
eaBarTracker.Waits();
//
DrawTrendLine(
ChartID(),
"Support-" + ToString((int)at),
0,
at,
support,
TimeCurrent(),
support,
clrAqua,
STYLE_DOT,
1,
false,
false,
true //
);
DrawSupport(support, ChartID());
//
Print("Support Detected ...");
@@ -866,11 +850,9 @@ void FindResistance()
//
datetime at = NULL;
double resistance = 0;
XOHCL resistance;
bool hasResistance = cBar.HasResistance(
resistance,
at //
);
resistance);
if (!hasResistance)
{
return;
@@ -880,21 +862,7 @@ void FindResistance()
eaBarTracker.Waits();
//
DrawTrendLine(
ChartID(),
"Resistance-" + ToString((int)at),
0,
at,
resistance,
TimeCurrent(),
resistance,
clrMagenta,
STYLE_DOT,
1,
false,
false,
true //
);
DrawResistance(resistance, ChartID());
//
Print("Resistance Detected ...");
@@ -917,19 +885,13 @@ void FindBullishTrend()
}
//
double hSwings[];
datetime hSwingTimes[];
//
double lSwings[];
datetime lSwingTimes[];
XOHCL hSwings[];
XOHCL lSwings[];
//
bool isBullishTrend = cBar.HasBullishTrend(
hSwings,
hSwingTimes,
lSwings,
lSwingTimes,
false // Method 2 ...
);
if (!isBullishTrend)
@@ -941,85 +903,13 @@ void FindBullishTrend()
eaBarTracker.Waits();
//
DrawTrendLine(
ChartID(),
"HSING-BULLTrend-" + ToString((int)hSwingTimes[ArraySize(hSwingTimes) - 1]) + "," + ToString((int)hSwingTimes[0]),
0,
hSwingTimes[ArraySize(hSwingTimes) - 1],
hSwings[ArraySize(hSwings) - 1],
hSwingTimes[0],
hSwings[0],
clrAqua,
STYLE_DOT,
1,
false,
false,
true //
DrawBullishTrend(
cBar,
hSwings,
lSwings,
ChartID() //
);
//
DrawTrendLine(
ChartID(),
"LSING-BULLTrend-" + ToString((int)lSwingTimes[ArraySize(lSwingTimes) - 1]) + "," + ToString((int)lSwingTimes[0]),
0,
lSwingTimes[ArraySize(lSwingTimes) - 1],
lSwings[ArraySize(lSwings) - 1],
lSwingTimes[0],
lSwings[0],
clrMagenta,
STYLE_DOT,
1,
false,
false,
true //
);
//
// Draw Arrow On Swing Highs ...
for (int i = 0; i < ArraySize(hSwings); i++)
{
//
double iPrice = hSwings[i];
datetime iTime = hSwingTimes[i];
//
DrawArrow(
ChartID(),
"HSIGN-BULLTrend-Arrow-" + ToString((int)iTime),
0,
iTime,
iPrice,
234,
ANCHOR_BOTTOM,
clrAqua,
STYLE_SOLID,
2 //
);
}
//
// Draw Arrow On Swing Highs ...
for (int i = 0; i < ArraySize(lSwings); i++)
{
//
double iPrice = lSwings[i];
datetime iTime = lSwingTimes[i];
//
DrawArrow(
ChartID(),
"LSIGN-BULLTrend-Arrow-" + ToString((int)iTime),
0,
iTime,
iPrice,
233,
ANCHOR_TOP,
clrMagenta,
STYLE_SOLID,
2 //
);
}
//
Print("Bullish Trend Detected ...");
}
@@ -1041,19 +931,13 @@ void FindBearishTrend()
}
//
double hSwings[];
datetime hSwingTimes[];
//
double lSwings[];
datetime lSwingTimes[];
XOHCL hSwings[];
XOHCL lSwings[];
//
bool isBearishTrend = cBar.HasBearishTrend(
hSwings,
hSwingTimes,
lSwings,
lSwingTimes,
false // Method 2 ...
);
if (!isBearishTrend)
@@ -1065,92 +949,21 @@ void FindBearishTrend()
eaBarTracker.Waits();
//
DrawTrendLine(
ChartID(),
"HSING-BEARTrend-" + ToString((int)hSwingTimes[ArraySize(hSwingTimes) - 1]) + "," + ToString((int)hSwingTimes[0]),
0,
hSwingTimes[ArraySize(hSwingTimes) - 1],
hSwings[ArraySize(hSwings) - 1],
hSwingTimes[0],
hSwings[0],
clrAqua,
STYLE_DOT,
1,
false,
false,
true //
DrawBearishTrend(
cBar,
hSwings,
lSwings,
ChartID() //
);
//
DrawTrendLine(
ChartID(),
"LSING-BEARTrend-" + ToString((int)lSwingTimes[ArraySize(lSwingTimes) - 1]) + "," + ToString((int)lSwingTimes[0]),
0,
lSwingTimes[ArraySize(lSwingTimes) - 1],
lSwings[ArraySize(lSwings) - 1],
lSwingTimes[0],
lSwings[0],
clrMagenta,
STYLE_DOT,
1,
false,
false,
true //
);
//
// Draw Arrow On Swing Highs ...
for (int i = 0; i < ArraySize(hSwings); i++)
{
//
double iPrice = hSwings[i];
datetime iTime = hSwingTimes[i];
//
DrawArrow(
ChartID(),
"HSIGN-BEARTrend-Arrow-" + ToString((int)iTime),
0,
iTime,
iPrice,
234,
ANCHOR_BOTTOM,
clrAqua,
STYLE_SOLID,
2 //
);
}
//
// Draw Arrow On Swing Highs ...
for (int i = 0; i < ArraySize(lSwings); i++)
{
//
double iPrice = lSwings[i];
datetime iTime = lSwingTimes[i];
//
DrawArrow(
ChartID(),
"LSIGN-BEARTrend-Arrow-" + ToString((int)iTime),
0,
iTime,
iPrice,
233,
ANCHOR_TOP,
clrMagenta,
STYLE_SOLID,
2 //
);
}
//
Print("Bearish Trend Detected ...");
}
//
// Find Bullish Order Block ...
void FindBullishOrderBlock() {
void FindBullishOrderBlock()
{
//
XOHCL cBar;
bool isInited = cBar.Init(
@@ -1168,7 +981,8 @@ void FindBullishOrderBlock() {
bool hasOB = cBar.HasBullishOrderBlock(
obBar //
);
if (!hasOB) {
if (!hasOB)
{
return;
}
@@ -1178,7 +992,7 @@ void FindBullishOrderBlock() {
//
DrawTrendLine(
ChartID(),
"BULLOB-H-" + ToString((int) obBar.time),
"BULLOB-H-" + ToString((int)obBar.time),
0,
obBar.time,
obBar.high,
@@ -1195,7 +1009,7 @@ void FindBullishOrderBlock() {
//
DrawTrendLine(
ChartID(),
"BULLOB-L-" + ToString((int) obBar.time),
"BULLOB-L-" + ToString((int)obBar.time),
0,
obBar.time,
obBar.low,
@@ -1215,7 +1029,8 @@ void FindBullishOrderBlock() {
//
// Find Bearish Order Block ...
void FindBearishOrderBlock() {
void FindBearishOrderBlock()
{
//
XOHCL cBar;
bool isInited = cBar.Init(
@@ -1233,7 +1048,8 @@ void FindBearishOrderBlock() {
bool hasOB = cBar.HasBearishOrderBlock(
obBar //
);
if (!hasOB) {
if (!hasOB)
{
return;
}
@@ -1243,7 +1059,7 @@ void FindBearishOrderBlock() {
//
DrawTrendLine(
ChartID(),
"BEAROB-H-" + ToString((int) obBar.time),
"BEAROB-H-" + ToString((int)obBar.time),
0,
obBar.time,
obBar.high,
@@ -1260,7 +1076,7 @@ void FindBearishOrderBlock() {
//
DrawTrendLine(
ChartID(),
"BEAROB-L-" + ToString((int) obBar.time),
"BEAROB-L-" + ToString((int)obBar.time),
0,
obBar.time,
obBar.low,
+48 -15
View File
@@ -2,7 +2,7 @@
//
// SaherElm IT Center XTest MQL5 Expert Advisor
// -------------------------------------------------
// Name: XTestPivotsEA
// Name: XSTestEA
// Description: an Exper Advisor which used XTestSetup
// to Analyse Market ...
//
@@ -16,11 +16,11 @@
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XTestPivotsEA"
#property description "SaherElm XSTestEA"
#property strict
//
#define ShortName "XTestPivotsEA"
#define ShortName "XSTestEA"
//
// Imports ...
@@ -28,6 +28,7 @@
#include "../Helpers/x-saherelm.xcc.helper.mq5"
//
#include "../Strategies/x-saherelm.xobvg.strategy.mq5"
#include "../Strategies/x-saherelm.xsrbr.strategy.mq5"
#include "../Strategies/x-saherelm.xemrng.strategy.mq5"
@@ -50,7 +51,7 @@ double eaTPPoint = 200;
double eaSLPoint = 100;
//
double eaR2R = 1.5;
double eaR2R = 2;
//
// Variables ...
@@ -79,6 +80,9 @@ int OnInit()
return INIT_FAILED;
}
//
drawPrefix = ShortName;
//
// EventSetTimer(1);
// EventSetMillisecondTimer(100);
@@ -200,7 +204,8 @@ bool InitialEA()
//
bool useXSRBR = false;
bool useXEMRNG = true;
bool useXEMRNG = false;
bool useXOBVG = true;
//
// EURUSD ...
@@ -257,8 +262,8 @@ bool InitialEA()
eaSLPoint, // SL
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
);
eurusdM15SRBRStrategy.SetAlertLogAlerts(true);
@@ -292,6 +297,34 @@ bool InitialEA()
eurusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
RegisterStrategy(eurusdM5EMRNGStrategy);
}
//
// XOBVG ...
if (useXOBVG)
{
//
XSCXOBVGStrategy *eurusdM5OBVGStrategy;
eurusdM5OBVGStrategy = new XSCXOBVGStrategy(
eurusdSymbol,
PERIOD_M5,
PERIOD_H2, // Analyzing Period
eaVolume,
eaR2R, // R2R ...
eaSlippage,
magicNumber,
false, // Use TP SL Point
false, // Use Max
eaTPPoint, // TP
eaSLPoint, // SL
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts // Max Shorts
);
eurusdM5OBVGStrategy.SetAlertLogAlerts(true);
eurusdM5OBVGStrategy.SetAlertEnableAlerts(true);
RegisterStrategy(eurusdM5OBVGStrategy);
}
}
//
@@ -324,8 +357,8 @@ bool InitialEA()
eaSLPoint, // SL
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
);
usdchfM5SRBRStrategy.SetAlertLogAlerts(true);
@@ -391,8 +424,8 @@ bool InitialEA()
eaSLPoint, // SL
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
);
usdjpyM5SRBRStrategy.SetAlertLogAlerts(true);
@@ -458,8 +491,8 @@ bool InitialEA()
eaSLPoint, // SL
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
);
gbpusdM5SRBRStrategy.SetAlertLogAlerts(true);
@@ -525,8 +558,8 @@ bool InitialEA()
eaSLPoint, // SL
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts, // Max Shorts
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
);
xauusdM5SRBRStrategy.SetAlertLogAlerts(true);