cleanup and backup old styles and try toimplement new POI Detector ...
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Classes/x-saherelm.xmd5.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-md5.class.mq5"
|
||||
|
||||
//
|
||||
// Models ...
|
||||
@@ -10322,7 +10322,7 @@ string ToMD5(T content)
|
||||
}
|
||||
|
||||
//
|
||||
static XSCMD5 md5;
|
||||
static XCMD5 md5;
|
||||
|
||||
//
|
||||
result = md5.Hash(strContent);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -125,7 +125,7 @@ enum ENUM_XSESSION
|
||||
|
||||
//
|
||||
// Base POI Model Class ...
|
||||
class XCBasePOI : public XSCBase
|
||||
class XCBasePOI : public XCBase
|
||||
{
|
||||
//
|
||||
public:
|
||||
@@ -300,11 +300,7 @@ class XCZone : public XCBasePOI
|
||||
// Overrides ...
|
||||
|
||||
//
|
||||
protected:
|
||||
//
|
||||
// Props ...
|
||||
double mUpper; // Zone Upper ...
|
||||
double mLower; // Zone Lower ...
|
||||
// Validators ...
|
||||
|
||||
/**
|
||||
* Validate Upper and Lower of Zone ...
|
||||
@@ -339,6 +335,13 @@ class XCZone : public XCBasePOI
|
||||
return IsSpecifiedValid(From());
|
||||
}
|
||||
|
||||
//
|
||||
protected:
|
||||
//
|
||||
// Props ...
|
||||
double mUpper; // Zone Upper ...
|
||||
double mLower; // Zone Lower ...
|
||||
|
||||
//
|
||||
private:
|
||||
//
|
||||
@@ -1041,6 +1044,35 @@ class XCSwing : public XCBasePOI
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Fill Swing Bar as XOHCLstruct ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool FillBar(
|
||||
XOHCL &bar //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bar = mBar;
|
||||
result = mBar.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Swing High or not ...
|
||||
*
|
||||
@@ -1129,10 +1161,16 @@ class XCSwing : public XCBasePOI
|
||||
//
|
||||
string hash = ToMD5(mBar.GetTag());
|
||||
|
||||
//
|
||||
string subType = IsSwingHigh()
|
||||
? "High"
|
||||
: "Low";
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
TypeAsString() + mSep +
|
||||
subType + mSep +
|
||||
ToString(mBar.period) + mSep +
|
||||
hash
|
||||
//
|
||||
@@ -2130,18 +2168,154 @@ class XCFVG : public XCTwoBarZone
|
||||
};
|
||||
|
||||
//
|
||||
// TODO: Implement this ...
|
||||
// Trading Day ...
|
||||
class XCDay : public XCFromToZone
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
void XCDay()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCDay()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Initialize POI ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Init()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
//
|
||||
protected:
|
||||
//
|
||||
|
||||
//
|
||||
private:
|
||||
//
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// TODO: Implement this ...
|
||||
// Trading Session ...
|
||||
class XCSession : public XCFromToZone
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
void XCSession()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCSession()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Initialize POI ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Init()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
//
|
||||
protected:
|
||||
//
|
||||
|
||||
//
|
||||
private:
|
||||
//
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
// Model Exists Founded POIs ...
|
||||
struct XPOIState
|
||||
{
|
||||
//
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
datetime reportedAt;
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
void XPOIState()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
/**
|
||||
* Cleanup all props ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
reportedAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Extensions ...
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Libraries/x-saherelm.common.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.draw.lib.mq5"
|
||||
#include <Trade/Trade.mqh>
|
||||
|
||||
//
|
||||
@@ -1463,162 +1462,6 @@ struct XSignal
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Signal on Chart ...
|
||||
bool Draw(
|
||||
long chartID,
|
||||
int subWindow = 0,
|
||||
string prefix = NULL,
|
||||
color entryColor = clrGold,
|
||||
color bullishColor = clrSpringGreen,
|
||||
color bearishColor = clrTomato //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isLong = IsLong(this.type);
|
||||
|
||||
//
|
||||
prefix =
|
||||
//
|
||||
(!IsValid(prefix) ? "" : prefix) +
|
||||
this.symbol + "_" +
|
||||
ToString(this.period) + "_" +
|
||||
this.provider
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
int age = this.GetAge();
|
||||
|
||||
//
|
||||
// Retrieve Time ...
|
||||
datetime time0 = iTime(
|
||||
this.symbol,
|
||||
this.period,
|
||||
age //
|
||||
);
|
||||
|
||||
//
|
||||
// Retrieve 3 Time ...
|
||||
datetime time3 = iTime(
|
||||
this.symbol,
|
||||
this.period,
|
||||
age + 3 //
|
||||
);
|
||||
|
||||
//
|
||||
color posColor = isLong
|
||||
? bullishColor
|
||||
: bearishColor;
|
||||
color tpColor = bullishColor;
|
||||
color slColor = bearishColor;
|
||||
|
||||
//
|
||||
ENUM_LINE_STYLE vLineStyle = STYLE_DOT;
|
||||
ENUM_LINE_STYLE tpLineStyle = STYLE_SOLID;
|
||||
ENUM_LINE_STYLE slLineStyle = STYLE_SOLID;
|
||||
ENUM_LINE_STYLE entryLineStyle = STYLE_SOLID;
|
||||
|
||||
//
|
||||
int lineWidth = 2;
|
||||
|
||||
//
|
||||
// Vertical Line ...
|
||||
string vlName = prefix + "_" + (string)time;
|
||||
|
||||
//
|
||||
result = DrawVerticalLine(
|
||||
chartID,
|
||||
vlName,
|
||||
subWindow,
|
||||
time0,
|
||||
posColor,
|
||||
vLineStyle,
|
||||
lineWidth //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// TP ...
|
||||
double profit = (MathAbs(this.tp - this.entry)) * this.volume;
|
||||
string tpName = prefix + "_TP_" + (string)profit;
|
||||
|
||||
//
|
||||
result = DrawTrendLine(
|
||||
chartID,
|
||||
tpName,
|
||||
subWindow,
|
||||
time3,
|
||||
this.tp,
|
||||
time0,
|
||||
this.tp,
|
||||
tpColor,
|
||||
tpLineStyle,
|
||||
lineWidth //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// SL ...
|
||||
double lost = (MathAbs(this.sl - this.entry)) * this.volume;
|
||||
string slName = prefix + "_SL_" + (string)lost;
|
||||
|
||||
//
|
||||
result = DrawTrendLine(
|
||||
chartID,
|
||||
slName,
|
||||
subWindow,
|
||||
time3,
|
||||
this.sl,
|
||||
time0,
|
||||
this.sl,
|
||||
slColor,
|
||||
slLineStyle,
|
||||
lineWidth //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// ENTRY ...
|
||||
string entryName = prefix + "_ENTRY_" + (string)lost;
|
||||
|
||||
//
|
||||
result = DrawTrendLine(
|
||||
chartID,
|
||||
entryName,
|
||||
subWindow,
|
||||
time3,
|
||||
this.entry,
|
||||
time,
|
||||
this.entry,
|
||||
entryColor,
|
||||
entryLineStyle,
|
||||
lineWidth //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string GetTag()
|
||||
{
|
||||
@@ -5866,223 +5709,4 @@ int ExtractSymbolPositions(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user