last backup ...
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class
|
||||
// -------------------------------------------------
|
||||
// Name: XCXFIMAExpret ...
|
||||
// Description: XFIMA Expert Class ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm XFIMA Expert Class"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.x-expert.class.mq5"
|
||||
#include "../Classes/x-saherelm.xfima.signaller.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
class XCXFIMAExpret : public XCBaseExpert
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
/**
|
||||
* Prepare Signallers per Symbol Config ...
|
||||
*
|
||||
* @param symbolConfig: XSymbolTradeConfig, Symbol Trade Configurations ...
|
||||
*/
|
||||
void PrepareSignallers(XSymbolTradeConfig &symbolConfig) override
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!symbolConfig.IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Instantiate Signaller ...
|
||||
|
||||
//
|
||||
// XFIMA Inputs ...
|
||||
|
||||
//
|
||||
XFIMAInputs fimaInputs;
|
||||
fimaInputs.Default();
|
||||
fimaInputs.Hide();
|
||||
|
||||
//
|
||||
// Instantiate Signaller Class ...
|
||||
XCXFIMAStrategy1Signaller *fima1Signaller = new XCXFIMAStrategy1Signaller(
|
||||
symbolConfig.symbol,
|
||||
symbolConfig.period,
|
||||
fimaInputs,
|
||||
false // Process All Ticks ...
|
||||
);
|
||||
if (!fima1Signaller.IsValid())
|
||||
{
|
||||
//
|
||||
fima1Signaller.Destroy();
|
||||
delete fima1Signaller;
|
||||
ZeroMemory(fima1Signaller);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Register Signaller ...
|
||||
RegisterSignaller((XCBaseSignaller *)fima1Signaller);
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
fimaInputs.Clean();
|
||||
ZeroMemory(fima1Signaller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional On Tick Processing if Required ...
|
||||
*
|
||||
* @param barIndex: int, Specified Bar Index ...
|
||||
*/
|
||||
void virtual HandleOnTickAdditional(int barIndex = 0)
|
||||
{
|
||||
//
|
||||
// Implement this if required ...
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,708 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class
|
||||
// -------------------------------------------------
|
||||
// Name: XCXFIMAPoiDrawer ...
|
||||
// Description: XFIMA POI Drawer Class ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm XFIMA POI Drawer Class"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
||||
#include "../Libraries/x-saherelm.xfima.lib.mq5"
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
class XCXFIMAPOIDrawer : public XCPOIDrawer
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Tested Zones ...
|
||||
color testedBullishColor;
|
||||
color testedBearishColor;
|
||||
|
||||
//
|
||||
// Breaked Zones ...
|
||||
color breakedBullishColor;
|
||||
color breakedBearishColor;
|
||||
|
||||
//
|
||||
// FakeBreaked Zones ...
|
||||
color fakeBreakedBullishColor;
|
||||
color fakeBreakedBearishColor;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XCXFIMAPOIDrawer() : XCPOIDrawer()
|
||||
{
|
||||
Default();
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
~XCXFIMAPOIDrawer()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
/**
|
||||
* Do additional Configurations for Child Classes ...
|
||||
*/
|
||||
void virtual Default() override
|
||||
{
|
||||
//
|
||||
// Apply Default Props ...
|
||||
|
||||
//
|
||||
Prefix(NULL);
|
||||
ChartIdentification(0);
|
||||
SubWindowIdentification(0);
|
||||
|
||||
//
|
||||
defaultBullishStyle.width = 1;
|
||||
defaultBullishStyle.clr = clrAqua;
|
||||
defaultBullishStyle.style = STYLE_SOLID;
|
||||
|
||||
//
|
||||
defaultBearishStyle.width = 1;
|
||||
defaultBearishStyle.clr = clrMagenta;
|
||||
defaultBearishStyle.style = STYLE_SOLID;
|
||||
|
||||
//
|
||||
boxBullishStyle = defaultBullishStyle;
|
||||
boxBearishStyle = defaultBearishStyle;
|
||||
|
||||
//
|
||||
testedBullishColor = clrLime;
|
||||
breakedBullishColor = clrGreen;
|
||||
fakeBreakedBullishColor = clrYellow;
|
||||
|
||||
//
|
||||
testedBearishColor = clrRed;
|
||||
breakedBearishColor = clrDarkRed;
|
||||
fakeBreakedBearishColor = clrDarkOrange;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Specified Directional Arrow Anchor ...
|
||||
ENUM_ARROW_ANCHOR GetArrowAnchor(ENUM_X_DIRECTION forDir)
|
||||
{
|
||||
//
|
||||
ENUM_ARROW_ANCHOR result = ANCHOR_BOTTOM;
|
||||
|
||||
//
|
||||
if (HasDirection(forDir))
|
||||
{
|
||||
//
|
||||
result =
|
||||
IsSpecifiedBullish(forDir)
|
||||
? ANCHOR_TOP
|
||||
: ANCHOR_BOTTOM;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Specified Directional Arrow Code ...
|
||||
int GetArrowCode(ENUM_X_DIRECTION forDir)
|
||||
{
|
||||
//
|
||||
int result = 159;
|
||||
|
||||
//
|
||||
if (HasDirection(forDir))
|
||||
{
|
||||
//
|
||||
result =
|
||||
IsSpecifiedBullish(forDir)
|
||||
? 233
|
||||
: 234;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Specified Directional Arrow Code ...
|
||||
color GetArrowColor(ENUM_X_DIRECTION forDir)
|
||||
{
|
||||
//
|
||||
color result = clrYellow;
|
||||
|
||||
//
|
||||
if (HasDirection(forDir))
|
||||
{
|
||||
//
|
||||
result =
|
||||
IsSpecifiedBullish(forDir)
|
||||
? clrAqua
|
||||
: clrMagenta;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Specified Directional Arrow Price Type ...
|
||||
ENUM_X_PRICE GetArrowPriceType(ENUM_X_DIRECTION forDir)
|
||||
{
|
||||
//
|
||||
ENUM_X_PRICE result = X_PRICE_CLOSE;
|
||||
|
||||
//
|
||||
if (HasDirection(forDir))
|
||||
{
|
||||
//
|
||||
result =
|
||||
IsSpecifiedBullish(forDir)
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_HIGH;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Tested Zone Style ...
|
||||
*
|
||||
* @param style: reference to hold result ...
|
||||
* @param zone: Specified Zone ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool GetTestedStyle(
|
||||
XPOIStyle &style,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
style.Clean();
|
||||
|
||||
//
|
||||
result = zone.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
GetBoxStyle(
|
||||
style,
|
||||
zone.dir //
|
||||
);
|
||||
|
||||
//
|
||||
style.width = 3;
|
||||
style.clr =
|
||||
zone.IsBullish()
|
||||
? testedBullishColor
|
||||
: testedBearishColor;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Patterns Zone Style ...
|
||||
*
|
||||
* @param style: reference to hold result ...
|
||||
* @param zone: Specified Zone ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool GetPatternStyle(
|
||||
XPOIStyle &style,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
style.Clean();
|
||||
|
||||
//
|
||||
result = zone.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
GetPatternStyle(
|
||||
style,
|
||||
zone.dir //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Patterns Zone Style ...
|
||||
*
|
||||
* @param style: reference to hold result ...
|
||||
* @param forDir: Specified Direction ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool GetPatternStyle(
|
||||
XPOIStyle &style,
|
||||
ENUM_X_DIRECTION forDir //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
style.Clean();
|
||||
|
||||
//
|
||||
result = HasDirection(forDir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
GetBoxStyle(
|
||||
style,
|
||||
forDir //
|
||||
);
|
||||
|
||||
//
|
||||
style.width = 2;
|
||||
style.style = STYLE_DASH;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Breaked Zone Style ...
|
||||
*
|
||||
* @param style: reference to hold result ...
|
||||
* @param zone: Specified Zone ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool GetBreakedStyle(
|
||||
XPOIStyle &style,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
style.Clean();
|
||||
|
||||
//
|
||||
result = zone.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
GetBoxStyle(
|
||||
style,
|
||||
zone.dir //
|
||||
);
|
||||
|
||||
//
|
||||
style.width = 3;
|
||||
style.clr =
|
||||
zone.IsBullish()
|
||||
? breakedBullishColor
|
||||
: breakedBearishColor;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fake Breaked Zone Style ...
|
||||
*
|
||||
* @param style: reference to hold result ...
|
||||
* @param zone: Specified Zone ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool GetFakeBreakedStyle(
|
||||
XPOIStyle &style,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
style.Clean();
|
||||
|
||||
//
|
||||
result = zone.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
GetBoxStyle(
|
||||
style,
|
||||
zone.dir //
|
||||
);
|
||||
|
||||
//
|
||||
style.width = 3;
|
||||
style.clr =
|
||||
zone.IsBullish()
|
||||
? fakeBreakedBullishColor
|
||||
: fakeBreakedBearishColor;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill Arrow Based Drawing Specs ...
|
||||
*
|
||||
* @param forDir: Specified Direction ...
|
||||
* @param arrowPriceType: ENUM_X_PRICE, refrence for Arrow Price ...
|
||||
* @param arrowCode: int, reference for Arrow Code ...
|
||||
* @param arrowWidth: int, reference for Arrow Width ...
|
||||
* @param arrowColor: color, reference for Arrow Color ...
|
||||
* @param arrowAnchor: ENUM_ARROW_ANCHOR, reference for Arrow Anchor ...
|
||||
*/
|
||||
void FillArrowSpecs(
|
||||
ENUM_X_DIRECTION forDir,
|
||||
ENUM_X_PRICE &arrowPriceType,
|
||||
int &arrowCode,
|
||||
int &arrowWidth,
|
||||
color &arrowColor,
|
||||
ENUM_ARROW_ANCHOR &arrowAnchor //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Prepare ...
|
||||
arrowCode = 159;
|
||||
arrowWidth = 2;
|
||||
arrowColor = CLR_NONE;
|
||||
arrowAnchor = ANCHOR_BOTTOM;
|
||||
arrowPriceType = X_PRICE_CLOSE;
|
||||
|
||||
//
|
||||
if (HasDirection(forDir))
|
||||
{
|
||||
//
|
||||
arrowCode = GetArrowCode(forDir);
|
||||
arrowColor = GetArrowColor(forDir);
|
||||
arrowAnchor = GetArrowAnchor(forDir);
|
||||
arrowPriceType = GetArrowPriceType(forDir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Tested Style ...
|
||||
*
|
||||
* @param object: reference pointer to Object ...
|
||||
* @param zone: reference to Zone ...
|
||||
*/
|
||||
void ApplyTestedStyle(
|
||||
XCBoxObject *&object,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (!zone.IsValid() ||
|
||||
object == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XPOIStyle style;
|
||||
if (!GetTestedStyle(style, zone))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ApplyBoxStyle(
|
||||
object,
|
||||
style //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Breaked Style ...
|
||||
*
|
||||
* @param object: reference pointer to Object ...
|
||||
* @param zone: reference to Zone ...
|
||||
*/
|
||||
void ApplyBreakedStyle(
|
||||
XCBoxObject *&object,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (!zone.IsValid() ||
|
||||
object == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XPOIStyle style;
|
||||
if (!GetBreakedStyle(style, zone))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ApplyBoxStyle(
|
||||
object,
|
||||
style //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Tested Style ...
|
||||
*
|
||||
* @param object: reference pointer to Object ...
|
||||
* @param zone: reference to Zone ...
|
||||
*/
|
||||
void ApplyFakeBreakStyle(
|
||||
XCBoxObject *&object,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (!zone.IsValid() ||
|
||||
object == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XPOIStyle style;
|
||||
if (!GetFakeBreakedStyle(style, zone))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ApplyBoxStyle(
|
||||
object,
|
||||
style //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Pattern Style ...
|
||||
*
|
||||
* @param object: reference pointer to Object ...
|
||||
* @param zone: reference to Zone ...
|
||||
*/
|
||||
void ApplyPatternStyle(
|
||||
XCBoxObject *&object,
|
||||
XBoxZone &zone //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (!zone.IsValid() ||
|
||||
object == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XPOIStyle style;
|
||||
if (!GetPatternStyle(style, zone))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ApplyBoxStyle(
|
||||
object,
|
||||
style //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Patterns Style ...
|
||||
*
|
||||
* @param object: reference pointer to Object ...
|
||||
*/
|
||||
void ApplyPatternsStyle(
|
||||
CArrayObj *&objects //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (objects == NULL ||
|
||||
objects.Total() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XPOIStyle iStyle;
|
||||
string iName = NULL;
|
||||
XCBoxObject *iBoxObj = NULL;
|
||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||
for (int i = 0; i < objects.Total(); i++)
|
||||
{
|
||||
//
|
||||
iBoxObj = (XCBoxObject *)objects.At(i);
|
||||
iName = iBoxObj.ObjName();
|
||||
|
||||
//
|
||||
iDir =
|
||||
IsSpecifiedValid(iName) &&
|
||||
Contains(
|
||||
"BULL",
|
||||
iName //
|
||||
)
|
||||
? X_DIRECTION_BULLISH
|
||||
: IsSpecifiedValid(iName) &&
|
||||
Contains(
|
||||
"BEAR",
|
||||
iName //
|
||||
)
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
has = GetPatternStyle(iStyle, iDir);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ApplyBoxStyle(
|
||||
iBoxObj,
|
||||
iStyle //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iStyle.Clean();
|
||||
ZeroMemory(iBoxObj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Style to Specified Pivot Object ...
|
||||
*
|
||||
* @param object: reference pointer to Object ...
|
||||
* @param zone: reference to Zone ...
|
||||
*/
|
||||
void ApplyPivotStyle(
|
||||
XCBarArrowObject *&object,
|
||||
XPOIStyle &style //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (object == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
object.ArrowColor(style.clr);
|
||||
object.ArrowWidth(style.width);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Patterns Style ...
|
||||
*
|
||||
* @param object: reference pointer to Object ...
|
||||
*/
|
||||
void ApplyPivotsStyle(
|
||||
CArrayObj *&objects //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (objects == NULL ||
|
||||
objects.Total() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XPOIStyle iStyle;
|
||||
string iName = NULL;
|
||||
XCBarArrowObject *iObj = NULL;
|
||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||
for (int i = 0; i < objects.Total(); i++)
|
||||
{
|
||||
//
|
||||
iObj = (XCBarArrowObject *)objects.At(i);
|
||||
iName = iObj.ObjName();
|
||||
|
||||
//
|
||||
iDir =
|
||||
IsSpecifiedValid(iName) &&
|
||||
Contains(
|
||||
"BULL",
|
||||
iName //
|
||||
)
|
||||
? X_DIRECTION_BULLISH
|
||||
: IsSpecifiedValid(iName) &&
|
||||
Contains(
|
||||
"BEAR",
|
||||
iName //
|
||||
)
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
has = GetPatternStyle(iStyle, iDir);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ApplyPivotStyle(
|
||||
iObj,
|
||||
iStyle //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iStyle.Clean();
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user