last backup XCAEA

This commit is contained in:
2025-05-08 14:17:59 +03:30
parent 91cc004c55
commit 898e6af837
72 changed files with 126051 additions and 0 deletions
@@ -0,0 +1,167 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Indicator
// -------------------------------------------------
// Name: XCXCAEADataCollector ...
// Description: Class for XCAEA Data Collector ...
//
//
// 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 Class for XCAEA Data Collector"
#property strict
//
// Imports ...
#include "../../Classes/x-saherelm.base.class.mq5"
//
// Definitions ...
//
// Implementation ...
class XCXCAEADataCollector : public XCBase
{
//
// Public ...
public:
//
// Constructors ...
XCXCAEADataCollector()
{
}
//
// Deconstructor ...
~XCXCAEADataCollector()
{
}
//
// Properties ...
//
string Path()
{
return mPath;
}
//
void Path(string value)
{
//
// Normalizing Collector Path ...
if (IsValid(value))
{
mPath = value;
}
else
{
mPath = "XCXCAEADataCollector";
}
}
//
// Tools ...
//
string GetFilePath(string fileName)
{
//
string result = "";
//
result =
//
mPath + "\\" + fileName + ".x121.log"
//
;
//
return result;
}
//
int GetFileHandlerForWrite(string filePath)
{
//
int result = INVALID_HANDLE;
//
if (!IsValid(filePath))
{
return result;
}
//
result = FileOpen(
filePath,
FILE_READ | FILE_WRITE | FILE_TXT //
);
//
return result;
}
/**
* Save Specified Content into Specified File Name ...
*
* @param fileName: string, file name ...
* @param content: string, content ...
*
* @return ( bool )
*/
bool Save(
string fileName,
string content //
)
{
//
bool result = false;
//
result = IsValid(content);
if (!result)
{
return result;
}
//
//
int mHandler = GetFileHandlerForWrite(fileName);
result = mHandler != INVALID_HANDLE;
if (!result)
{
return result;
}
//
FileWrite(mHandler, content);
FileFlush(mHandler);
FileClose(mHandler);
//
return result;
}
//
// Protected ...
protected:
//
// Private ...
private:
//
// Props ...
//
string mPath; // Base Collector Path ...
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,932 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Indicator
// -------------------------------------------------
// Name: XCXCAEAPOIDrawer ...
// Description: Class for XCAEA POI Drawer ...
//
//
// 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 Class for XCAEA POI Drawer"
#property strict
//
// Imports ...
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
#include "../Classes/xcaea.x-poi.detector.class.mq5"
//
// Definitions ...
struct XCAPivotStyle
{
//
// Properties ...
int width;
color clr;
ENUM_LINE_STYLE style;
//
// Constructor ...
XCAPivotStyle()
{
Default();
}
//
// Tools ...
//
// Cleanup Model ...
void Clean()
{
//
width = 1;
clr = CLR_NONE;
style = STYLE_SOLID;
//
ZeroMemory(this);
}
//
// Default Props ...
void Default()
{
//
width = 1;
clr = CLR_NONE;
style = STYLE_SOLID;
}
};
//
// Implementations ...
class XCXCAEAPOIDrawer : public XCBase
{
//
// Public ...
public:
//
// Props ...
//
bool ignoreUpdateOSCTos;
//
// Drawers ...
bool drawPeakPivots;
bool drawValePivots;
bool drawFVGBullishPivots;
bool drawFVGBearishPivots;
bool drawTrendBullishPivots;
bool drawTrendBearishPivots;
//
// Styling ...
//
XCAPivotStyle defaultBullishStyle;
XCAPivotStyle defaultBearishStyle;
//
XCAPivotStyle peakPivotStyle;
XCAPivotStyle valePivotStyle;
//
XCAPivotStyle fvgBullishPivotStyle;
XCAPivotStyle fvgBearishPivotStyle;
//
XCAPivotStyle trendBullishPivotStyle;
XCAPivotStyle trendBearishPivotStyle;
//
// Constructors ...
XCXCAEAPOIDrawer(
XCXCAEAPOIDetector *_detector //
)
{
//
detector = _detector;
drawer = new XCPOIDrawer();
//
Default();
}
//
// De Constructors ...
~XCXCAEAPOIDrawer()
{
//
Clear();
//
ZeroMemory(drawer);
ZeroMemory(detector);
}
//
// Properties ...
//
// Tools ...
//
virtual void Default()
{
//
// Drawing ...
drawPeakPivots = false;
drawValePivots = false;
drawFVGBullishPivots = false;
drawFVGBearishPivots = false;
drawTrendBullishPivots = false;
drawTrendBearishPivots = false;
//
// Styling ...
//
// Bullish ...
defaultBullishStyle.width = 1;
defaultBullishStyle.clr = clrLime;
defaultBullishStyle.style = STYLE_SOLID;
//
// Bearish ...
defaultBearishStyle.width = 1;
defaultBearishStyle.clr = clrRed;
defaultBearishStyle.style = STYLE_SOLID;
//
// Pivots ...
//
// PV ...
peakPivotStyle = defaultBearishStyle;
valePivotStyle = defaultBullishStyle;
//
// FVG ...
fvgBullishPivotStyle = defaultBullishStyle;
fvgBearishPivotStyle = defaultBearishStyle;
//
// TREND ...
trendBullishPivotStyle = defaultBullishStyle;
trendBearishPivotStyle = defaultBearishStyle;
}
//
void Draw(datetime to = NULL)
{
//
// PV ...
DrawPeakPivots(to);
DrawValePivots(to);
//
// FVG ...
DrawFVGBullishPivots(to);
DrawFVGBearishPivots(to);
//
// TREND ...
DrawTrendBullishPivots(to);
DrawTrendBearishPivots(to);
}
//
void DrawBox(
XBoxZone &box,
datetime to = NULL //
)
{
//
bool has = box.IsValid();
if (!has)
{
return;
}
//
// Detect Pivot Type ...
ENUM_XCA_PIVOTS iType = GetPivotType(box);
has = IsValid(iType);
if (!has)
{
return;
}
//
switch (iType)
{
//
case XCA_PEAK:
//
DrawPeakPivot(
box,
to //
);
break;
//
case XCA_VALE:
//
DrawValePivot(
box,
to //
);
break;
//
case XCA_FVG_BULL:
//
DrawFVGBullishPivot(
box,
to //
);
break;
//
case XCA_FVG_BEAR:
//
DrawFVGBearishPivot(
box,
to //
);
break;
//
case XCA_TREND_BULL:
//
DrawTrendBullishPivot(
box,
to //
);
break;
//
case XCA_TREND_BEAR:
//
DrawTrendBearishPivot(
box,
to //
);
break;
}
}
//
void DrawBoxes(
XBoxZone &boxes[],
datetime to = NULL //
)
{
//
bool has = HasChild(boxes);
if (!has)
{
return;
}
//
int count = ArraySize(boxes);
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = boxes[i];
//
// Detect Pivot Type ...
DrawBox(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void Clear()
{
//
// Cleanup Models ...
defaultBullishStyle.Clean();
defaultBearishStyle.Clean();
//
// Cleanup Styles ...
peakPivotStyle.Clean();
valePivotStyle.Clean();
fvgBullishPivotStyle.Clean();
fvgBearishPivotStyle.Clean();
trendBullishPivotStyle.Clean();
trendBearishPivotStyle.Clean();
//
// Cleanup Pivot Objects Holder ...
mPeakPivotObjects.Clear();
mValePivotObjects.Clear();
mFVGBullishPivotObjects.Clear();
mFVGBearishPivotObjects.Clear();
mTrendBullishPivotObjects.Clear();
mTrendBearishPivotObjects.Clear();
}
//
// Collection Drawers ...
//
void DrawPeakPivots(datetime to = NULL)
{
//
bool has = drawPeakPivots;
if (!has)
{
return;
}
//
has = detector.HasPeakPivots();
if (!has)
{
return;
}
//
int count = detector.CountPeakPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.peakPivots[i];
//
DrawPeakPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawValePivots(datetime to = NULL)
{
//
bool has = drawValePivots;
if (!has)
{
return;
}
//
has = detector.HasValePivots();
if (!has)
{
return;
}
//
int count = detector.CountValePivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.valePivots[i];
//
DrawValePivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawFVGBullishPivots(datetime to = NULL)
{
//
bool has = drawFVGBullishPivots;
if (!has)
{
return;
}
//
has = detector.HasFVGBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountFVGBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.fvgBullishPivots[i];
//
DrawFVGBullishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawFVGBearishPivots(datetime to = NULL)
{
//
bool has = drawFVGBearishPivots;
if (!has)
{
return;
}
//
has = detector.HasFVGBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountFVGBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.fvgBearishPivots[i];
//
DrawFVGBearishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawTrendBullishPivots(datetime to = NULL)
{
//
bool has = drawTrendBullishPivots;
if (!has)
{
return;
}
//
has = detector.HasTrendBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTrendBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.trendBullishPivots[i];
//
DrawTrendBullishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawTrendBearishPivots(datetime to = NULL)
{
//
bool has = drawTrendBearishPivots;
if (!has)
{
return;
}
//
has = detector.HasTrendBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTrendBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.trendBearishPivots[i];
//
DrawTrendBearishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
// One Item Drawers ...
//
void DrawPeakPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawPeakPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_PEAK) &&
item.dir == GetDirection(XCA_PEAK);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
peakPivotStyle //
);
//
// Store Object ...
mPeakPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawValePivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawValePivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_VALE) &&
item.dir == GetDirection(XCA_VALE);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
valePivotStyle //
);
//
// Store Object ...
mValePivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawFVGBullishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawFVGBullishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_FVG_BULL) &&
item.dir == GetDirection(XCA_FVG_BULL);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
fvgBullishPivotStyle //
);
//
// Store Object ...
mFVGBullishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawFVGBearishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawFVGBearishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_FVG_BEAR) &&
item.dir == GetDirection(XCA_FVG_BEAR);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
fvgBearishPivotStyle //
);
//
// Store Object ...
mFVGBearishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawTrendBullishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawTrendBullishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_TREND_BULL) &&
item.dir == GetDirection(XCA_TREND_BULL);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
trendBullishPivotStyle //
);
//
// Store Object ...
mTrendBullishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawTrendBearishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawTrendBearishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_TREND_BEAR) &&
item.dir == GetDirection(XCA_TREND_BEAR);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
trendBearishPivotStyle //
);
//
// Store Object ...
mTrendBearishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
// Protected ...
protected:
//
// Props ...
//
void ApplyPivotStyle(
XCBoxObject *&object,
XCAPivotStyle &style //
)
{
//
if (object == NULL)
{
return;
}
//
object.BoxColor(style.clr);
object.BoxWidth(style.width);
object.BoxStyle(style.style);
}
//
// Prrivate ...
private:
//
// Props ...
//
XCPOIDrawer *drawer;
XCXCAEAPOIDetector *detector;
//
CArrayObj mPeakPivotObjects;
CArrayObj mValePivotObjects;
//
CArrayObj mFVGBullishPivotObjects;
CArrayObj mFVGBearishPivotObjects;
//
CArrayObj mTrendBullishPivotObjects;
CArrayObj mTrendBearishPivotObjects;
//
};
//
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,900 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Indicator
// -------------------------------------------------
// Name: XCXCAEASignaller ...
// Description: Class for XCAEA Signaller ...
//
//
// 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 Class for XCAEA Signaller"
#property strict
//
// Imports ...
#include "../../Classes/x-saherelm.base.class.mq5"
#include "../../Classes/x-saherelm.x-cobject.class.mq5"
#include "../Classes/xcaea.x-poi.detector.class.mq5"
#include "../Classes/xcaea.x-poi.drawer.class.mq5"
#include "../Helpers/xcaea.helper.mq5"
#include "../Libraries/xcaea.signaller.lib.mq5"
//
// Definitions ...
class XCXCAEASignaller : XCBase
{
//
// Public ...
public:
//
// Props ...
bool useGuards;
bool useTargets;
int poiLoopback;
XCAEAInputs inputs;
XBarTracker barTraker;
XCXCAEAHelper *helper;
XCXCAEAPOIDrawer *drawer;
bool continuesRFTillTarget;
XBoxZone unAvailableBoxes[];
XCXCAEAPOIDetector *detector;
XCAEAStrategyConditions mConditions;
XCAEAStrategyConditions mConditionsCollection[];
//
// Constructor ...
XCXCAEASignaller(
string _symbol,
ENUM_TIMEFRAMES _period //
)
{
//
symbol = _symbol;
period = _period;
//
Init();
}
//
// Deconstructor ...
~XCXCAEASignaller()
{
DeInit();
}
//
// Properties ...
/**
* Initialize ...
*/
void Init()
{
//
useGuards = false;
useTargets = true;
continuesRFTillTarget = false;
//
barTraker.Init(
symbol,
period //
);
//
inputs.Default();
//
// Configure Indicators ...
//
// XCC ...
inputs.ccInputs.showCandles = true;
//
// XCT ...
inputs.ctInputs.showCandleTime = true;
//
// XCA ...
//
inputs.caInputs.supResSmoothingLength = 7;
inputs.caInputs.supResSmoothingMode = X_MA_MODE_NONE;
//
inputs.x3maInputs.applyColor = true;
//
inputs.x3maInputs.fastLength = 5;
//
inputs.x3maInputs.showFast = false;
inputs.x3maInputs.showSlow = false;
inputs.x3maInputs.showMedium = false;
//
inputs.caInputs.showMAH = false;
inputs.caInputs.showMAL = false;
inputs.caInputs.showMAC = false;
inputs.caInputs.showSar = false;
inputs.caInputs.showSwings = true;
inputs.caInputs.showFiboLevel1 = false;
inputs.caInputs.showFiboLevel2 = false;
inputs.caInputs.showFiboLevel3 = false;
inputs.caInputs.showFiboLevel4 = false;
inputs.caInputs.showFiboLevel5 = false;
inputs.caInputs.showPeaksAndVales = true;
//
inputs.caInputs.showKI = false;
inputs.caInputs.showTKI = false;
inputs.caInputs.showVidya = false;
inputs.caInputs.showTrend = false;
inputs.caInputs.showPeakAndValeGolden = false;
inputs.caInputs.showSupportAndResistance = false;
//
// XOSCS ...
// inputs.oscsInputs.rsiLength = 5;
// inputs.oscsInputs.rsiOBLevel = 90;
// inputs.oscsInputs.rsiOSLevel = 10;
// inputs.oscsInputs.cciLength = 7;
// inputs.oscsInputs.cciOBLevel = 130;
// inputs.oscsInputs.cciOSLevel = -130;
// inputs.oscsInputs.mfiLength = 5;
// inputs.oscsInputs.rviLength = 5;
//
// Oscillators Views ...
inputs.showRSI = false;
inputs.showCCI = false;
inputs.showMFI = false;
inputs.showRVI = false;
inputs.showADX = false;
inputs.showMACD = false;
//
// XCAEA Helper ...
helper = new XCXCAEAHelper();
helper.Init(
symbol,
period,
inputs //
);
//
// Initialize and Configure Detector ...
detector = new XCXCAEAPOIDetector(helper);
//
// Common Configurations ...
detector.maxAllowedPivots = 0;
detector.pivotVerifications = 5;
detector.ticksDividerInPoints = 15;
detector.pivotDetectionLoopbac = 1000;
//
// Configure Detector ...
//
// PV ...
//
detector.maxAllowedPVLifetime = 0;
detector.applySwingsOnPVPivots = true;
detector.selectRejectedPVPivots = true;
detector.selectEngulfedPVPivots = true;
detector.applySupportAndResistanceOnPVPivots = true;
//
// PEAK ...
detector.detectPeakPivots = true;
//
// VALE ...
detector.detectValePivots = true;
//
// FVG ...
//
detector.selectSameBarFVGs = false;
detector.maxAllowedFVGLifetime = 0;
detector.validateFVGUsingPV = false;
detector.applyPVToFVGBoundary = false;
detector.selectRejectedFVGPivots = false;
detector.selectEngulfedFVGPivots = false;
detector.validateFVGUsingManalyser = true;
detector.applyLastBarToFVGBoundary = false;
detector.selectOnlyFVGWhichHasIndirectionalLastBar = true;
//
// Bullish ...
detector.detectFVGBullishPivots = true;
//
// Bearish ...
detector.detectFVGBearishPivots = true;
//
// TREND ...
//
detector.maxAllowedTrendLifetime = 0;
//
// Bullish ...
detector.detectTrendBullishPivots = true;
//
// Bearish ...
detector.detectTrendBearishPivots = true;
//
// DRAWER ...
//
// Initialize and Configure Drawer ...
drawer = new XCXCAEAPOIDrawer(detector);
//
drawer.ignoreUpdateOSCTos = true;
//
// Configure Drawer ...
drawer.drawPeakPivots = true;
drawer.drawValePivots = true;
drawer.drawFVGBullishPivots = true;
drawer.drawFVGBearishPivots = true;
drawer.drawTrendBullishPivots = true;
drawer.drawTrendBearishPivots = true;
//
// Configure Styles ...
//
// PV ...
//
// PEAK ...
XCAPivotStyle peakStyle;
peakStyle.width = 2;
peakStyle.clr = clrMagenta;
peakStyle.style = STYLE_SOLID;
drawer.peakPivotStyle = peakStyle;
peakStyle.Clean();
//
// VALE ...
XCAPivotStyle valeStyle;
valeStyle.width = 2;
valeStyle.clr = clrAqua;
valeStyle.style = STYLE_SOLID;
drawer.valePivotStyle = valeStyle;
valeStyle.Clean();
//
// FVG ...
//
// Bullish ...
XCAPivotStyle fvgBullishStyle;
fvgBullishStyle.width = 2;
fvgBullishStyle.clr = clrLime;
fvgBullishStyle.style = STYLE_DASH;
drawer.fvgBullishPivotStyle = fvgBullishStyle;
fvgBullishStyle.Clean();
//
// Bearish ...
XCAPivotStyle fvgBearishStyle;
fvgBearishStyle.width = 2;
fvgBearishStyle.clr = clrRed;
fvgBearishStyle.style = STYLE_DASH;
drawer.fvgBearishPivotStyle = fvgBearishStyle;
fvgBearishStyle.Clean();
//
// TREND ...
//
// Bullish ...
XCAPivotStyle trendBullishStyle;
trendBullishStyle.width = 2;
trendBullishStyle.clr = clrLime;
trendBullishStyle.style = STYLE_DOT;
drawer.trendBullishPivotStyle = trendBullishStyle;
trendBullishStyle.Clean();
//
// Bearish ...
XCAPivotStyle trendBearishStyle;
trendBearishStyle.width = 2;
trendBearishStyle.clr = clrRed;
trendBearishStyle.style = STYLE_DOT;
drawer.trendBearishPivotStyle = trendBearishStyle;
trendBearishStyle.Clean();
//
}
/**
* DeInitialize ...
*/
void DeInit()
{
//
inputs.Clean();
//
// Cleaning Draws ...
drawer.Clear();
//
ZeroMemory(drawer);
ZeroMemory(helper);
ZeroMemory(detector);
//
mConditions.Clean();
Clean(mConditionsCollection);
//
mObjects.Clear();
mBarObjects.Clear();
//
barTraker.Clean();
}
//
string GetSymbol()
{
return symbol;
}
//
ENUM_TIMEFRAMES GetPeriod()
{
return period;
}
//
// Signaller Tools ...
/**
* Detect Setup Conditions based on Signalling ...
*
* @param maxAllowedSLDistanceInPoint: int, Max Allowed SL Distance in Points (if Bigger thn Zero Provided) ...
*
* @return ( bool )
*/
bool DetectSignalSetup(
double tpReward = 3,
double maxAllowedSLDistanceInPoint = 100 //
)
{
//
bool result = false;
//
// Check Bar Processing ...
if (!barTraker.CanProcessBar())
{
return result;
}
//
bool isBullish = false;
bool isBearish = false;
//
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int ppIndex = pIndex + 1;
//
int loopback = 10;
//
int idx = -1;
int count = 0;
bool has = false;
//
double ask = GetAsk(symbol);
double bid = GetBid(symbol);
datetime cTime = TimeCurrent();
double points = GetPoints(symbol);
//
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
XOHCL pPBar;
result = zBar.Init(
symbol,
period,
zIndex //
);
result =
result &&
zBar.GetPreviousBar(cBar);
result =
result &&
cBar.GetPreviousBar(pBar);
result =
result &&
pBar.GetPreviousBar(pPBar);
if (!result)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
pPBar.Clean();
//
return result;
}
//
// Setup Conditions ...
XBoxZone decisionZone;
bool hasDecisionZone = false;
XCAEAConditions conditions;
ENUM_X_DIRECTION decisionZoneDir = X_DIRECTION_NONE;
//
// Checking Signal's Decision Zone ...
hasDecisionZone = DetectDecisionZone(
helper,
drawer,
decisionZone,
decisionZoneDir,
conditions,
zIndex,
loopback //
);
//
// Make Signal Box UnAvailable ...
if (hasDecisionZone)
{
//
AddRef(
decisionZone,
unAvailableBoxes //
);
}
//
isBullish = hasDecisionZone &&
IsBullish(decisionZoneDir);
//
isBearish = hasDecisionZone &&
IsBearish(decisionZoneDir);
//
result = isBullish ||
isBearish;
if (result)
{
//
// Do What we Want ...
barTraker.Waits();
//
// Prepare Conditions ...
mConditions.symbol = symbol;
mConditions.period = period;
mConditions.time = zBar.time;
mConditions.reward = tpReward;
mConditions.provider = "XCAEA";
mConditions.setupTime = zBar.time;
mConditions.dir = decisionZoneDir;
mConditions.conditions = conditions;
mConditions.decisionZone = decisionZone;
}
//
// Cleanup Resource ...
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
pPBar.Clean();
//
conditions.Clean();
decisionZone.Clean();
//
return result;
}
/**
* Detect Trigger Conditions for Specified Signal ...
*
* @param conditions: XCAEAStrategyConditions instance Reference, Specified Signal Conditions ...
* @param maxAllowedSetupAge: specified Setup Age for Expiration (if bigger than Zero) ...
*
* @return ( bool )
*/
bool DetectSignalTrigger(
XCAEAStrategyConditions &conditions,
int barIndex = 0,
int maxAllowedSetupAge = 200 //
)
{
//
bool result = false;
//
barIndex = NormalizeInt(barIndex, 0);
//
result = conditions.IsSetuped();
if (!result)
{
return result;
}
//
datetime setupTime = conditions.setupTime;
ENUM_X_DIRECTION setupDir = conditions.dir;
//
helper.GetConditions(
conditions.conditions,
barIndex //
);
//
bool isBullish = IsBullish(setupDir);
bool isBearish = IsBearish(setupDir);
//
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int ppIndex = pIndex + 1;
//
int loopback = 10;
//
double ask = GetAsk(symbol);
double bid = GetBid(symbol);
datetime cTime = TimeCurrent();
double points = GetPoints(symbol);
//
// Check Signal Validation ...
// IMPORTANT: since all Validations done in SetUp Process ...
// here we only Execute Signal ...
//
result = isBullish ||
isBearish;
if (!result)
{
return result;
}
//
// Checking Trigger Conditions ...
double sl = 0;
double tp = 0;
ENUM_X_DIRECTION triggerDir = X_DIRECTION_NONE;
//
// Checking Trigger Cond 0 ...
bool canTriggerCond0 = CanTriggerCond0(
helper,
conditions.decisionZone,
triggerDir,
sl,
tp,
barIndex //
);
//
// Checking Trigger Cond 1 ...
bool canTriggerCond1 = false;
// CanTriggerCond1(
// helper,
// conditions.decisionZone,
// triggerDir,
// sl,
// tp,
// barIndex //
// );
//
// Checking Trigger Cond 2 ...
bool canTriggerCond2 = false;
// CanTriggerCond2(
// helper,
// conditions.decisionZone,
// triggerDir,
// sl,
// tp,
// barIndex //
// );
//
// Update Signal Box To ...
conditions.decisionZone.to = cTime;
//
XCBoxObject *iObj;
bool has = helper.poiDrawer.DrawBox(
conditions.decisionZone,
iObj //
);
if (has)
{
mObjects.Add(iObj);
}
ZeroMemory(iObj);
//
// Summarizing Result ...
result =
canTriggerCond0 ||
canTriggerCond1 ||
canTriggerCond2;
//
isBullish = result &&
IsBullish(triggerDir);
isBearish = result &&
IsBearish(triggerDir);
//
// Configure Conditions for Preparing Signal ...
if (result)
{
//
// Reconfigure Position TP/SL Entry and etc ...
//
double entry = GetEntry(
conditions.symbol,
triggerDir //
);
conditions.entry = entry;
//
if (tp > 0.0)
{
//
Add(
tp,
conditions.targets //
);
}
//
double spred = GetSpread(conditions.symbol);
//
double risk = MathAbs(entry - sl) + spred;
double reward = (risk * conditions.reward);
tp =
isBullish
? entry + reward
: entry - reward;
//
// Handling RF ...
double rfReward = risk * 1.85;
double rfPrice =
isBullish
? entry + rfReward
: entry - rfReward;
Add(
rfPrice,
conditions.targets //
);
//
rfReward = risk * 2.85;
rfPrice =
isBullish
? entry + rfReward
: entry - rfReward;
Add(
rfPrice,
conditions.targets //
);
//
// Handling Partial Close ...
// conditions.partialCloseOnTPLevel = 1;
// conditions.partialCloseMultiplier = 0.5;
//
conditions.sl = sl;
conditions.tp = tp;
conditions.dir = triggerDir;
conditions.triggerTime = cTime;
conditions.type = isBullish
? X_POSITION_TYPE_LONG
: X_POSITION_TYPE_SHORT;
//
}
//
// Validating Conditions if not Triggered ...
if (!result)
{
//
// Check Box Age ...
int age = conditions.GetSetupAge();
bool has = age <= maxAllowedSetupAge;
if (!has)
{
conditions.Clean();
}
//
// Check Box Price ...
has = IsBoxBreaked(
helper,
conditions.decisionZone,
barIndex //
);
if (has)
{
conditions.Clean();
}
}
//
// Cleanup ...
//
return result;
}
/**
* Detect Guards bsed on Signalling Class ...
*
* @param guards: XCAEAGuard instance Collection, Holds Provided Guards ...
* @param positions: XPosition instance Collection, Provides Signalling Based Positions for Apply Guards on them ...
* @param provider: X121SMCStrategySignalProviderData instance Reference, Specified Data for Cycles ...
*
* @return ( bool )
*/
bool DetectGuards(
XCAEAGuard &guards[],
const XPosition &positions[] //
)
{
//
bool result = false;
//
return result;
}
/**
* Add Conditions to Conditions Collection if not Exists ...
*
* @param maxAllowed: int, Specified Max Allowed Holding Conditions ...
*
* @return ( int )
*/
int AddConditionsIfNotExists(
int maxAllowed = 10 //
)
{
//
int result = 0;
//
bool isSetuped = IsValid(mConditions.setupTime) &&
HasDirection(mConditions.dir);
if (!isSetuped)
{
return result;
}
//
int count = ArraySize(mConditionsCollection);
if (IsValidSize(count))
{
//
// Copy Original Items ...
XCAEAStrategyConditions tmpItems[];
Copy(
mConditionsCollection,
tmpItems //
);
//
// Prese Item Data ...
bool isBullish = IsBullish(mConditions.dir);
//
for (int i = 0; i < count; i++)
{
//
XCAEAStrategyConditions iItem = tmpItems[i];
//
bool canRemove = mConditions.dir == iItem.dir &&
mConditions.pivot == iItem.pivot;
if (canRemove)
{
//
ArrayRemove(
mConditionsCollection,
i,
1 //
);
}
}
//
Clean(tmpItems);
}
//
AddRef(
mConditions,
mConditionsCollection //
);
//
// Remove Olds ...
CleanupArray(
mConditionsCollection,
maxAllowed //
);
//
result = ArraySize(mConditionsCollection);
//
return result;
}
//
// Protected ...
protected:
//
//
// Private ...
private:
//
// Props ...
string symbol;
ENUM_TIMEFRAMES period;
CArrayObj mObjects;
CArrayObj mBarObjects;
//
};
//
@@ -0,0 +1,647 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center XCond2 MQL5 Script
// -------------------------------------------------
// Name: XCAEA
// Description: an Exper Advisor which used Panels
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XCAEA Cond2 Script"
#property strict
//
// Imports ...
//
// Classes ...
#include "../../Classes/x-saherelm.x-poi.class.mq5"
//
// Libraries ...
#include "../../Libraries/x-saherelm.common.lib.mq5"
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
//
// Helpers ...
#include "../Helpers/xcaea.helper.mq5";
//
// Definitions ...
//
// Holds Drawn Objects ...
CArrayObj mObjects;
//
// Required Objects ...
int mLoopback = 10;
XCAEAInputs mInputs;
XBarTracker mBarTracker;
XCAEAConditions mConditions;
XCXCAEAHelper *helper = NULL;
//
// Event Handlers ...
/**
* Initialize Script ...
*
* @return ( int )
*/
int OnInit()
{
//
// Initialize Helper ...
bool isInited = InitHelper();
if (!isInited)
{
return INIT_FAILED;
}
//
return INIT_SUCCEEDED;
}
/**
* De Initialize Script ...
*
* @param reason: Argument 1
*/
void OnDeinit(const int reason)
{
//
mInputs.Clean();
mConditions.Clean();
//
ZeroMemory(helper);
}
/**
* Handle Tick Event ...
*/
void OnTick()
{
//
bool has = false;
//
// Run on New Bar ...
bool isNewBar = mBarTracker.IsNewBar();
if (!isNewBar)
{
return;
}
//
// Setting Bar Index ...
int barIndex = 0;
//
// Retrieve Conditions ...
has = helper.GetConditions(
mConditions,
barIndex,
mLoopback //
);
if (!has)
{
return;
}
//
// Handling Logic ...
HandleLogic();
}
//
// Custom Functions ...
/**
* Initialize Helper ...
*
* @return ( bool )
*/
bool InitHelper()
{
//
bool result = false;
//
mInputs.Default();
//
// Configure Inputs ...
//
// Oscilators ...
mInputs.showAC = false;
mInputs.showAD = false;
mInputs.showADX = false;
mInputs.showATR = false;
mInputs.showCCI = false;
mInputs.showRSI = false;
mInputs.showMFI = false;
mInputs.showRVI = false;
mInputs.showMACD = false;
mInputs.showMomentum = false;
mInputs.showStochastic = false;
//
// XCT ...
mInputs.ctInputs.showCandleTime = true;
//
// XCC ...
mInputs.ccInputs.showCandles = true;
//
// X3MA ...
mInputs.x3maInputs.showFast = false;
mInputs.x3maInputs.showSlow = false;
mInputs.x3maInputs.showMedium = false;
//
// XOSC ...
// mInputs.oscsInputs;
//
// XCA ...
mInputs.caInputs.showKI = false;
mInputs.caInputs.showSar = false;
mInputs.caInputs.showTKI = false;
mInputs.caInputs.showMAH = true;
mInputs.caInputs.showMAL = true;
mInputs.caInputs.showMAC = true;
mInputs.caInputs.showVidya = false;
mInputs.caInputs.showTrend = false;
mInputs.caInputs.showSwings = false;
mInputs.caInputs.showLongCycle = false;
mInputs.caInputs.showHindCycle = false;
mInputs.caInputs.showShortCycle = false;
mInputs.caInputs.showFiboLevel1 = true;
mInputs.caInputs.showFiboLevel2 = false;
mInputs.caInputs.showFiboLevel3 = true;
mInputs.caInputs.showMediumCycle = false;
mInputs.caInputs.showPeaksAndVales = false;
mInputs.caInputs.showPeakAndValeGolden = false;
mInputs.caInputs.showSupportAndResistance = true;
//
// Initialize Helper ...
helper = new XCXCAEAHelper();
result = helper.Init(
_Symbol,
_Period,
mInputs //
);
if (!result)
{
return result;
}
//
// Initialize Bar Tracker ...
result = mBarTracker.Init(
_Symbol,
_Period //
);
if (!result)
{
return result;
}
//
return result;
}
/**
* Handle Logic of Script ...
*/
void HandleLogic()
{
//
// Defining Requirements ...
//
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int p2IDX = pIDX + 1;
//
bool has = false;
//
// Reading Required Values ...
//
// PEAK ...
double zPeak = mConditions.peakBuffer[zIDX];
double cPeak = mConditions.peakBuffer[cIDX];
double pPeak = mConditions.peakBuffer[pIDX];
double p2Peak = mConditions.peakBuffer[p2IDX];
//
// VALE ...
double zVale = mConditions.valeBuffer[zIDX];
double cVale = mConditions.valeBuffer[cIDX];
double pVale = mConditions.valeBuffer[pIDX];
double p2Vale = mConditions.valeBuffer[p2IDX];
//
// SAR ...
double zSar = mConditions.sarBuffer[zIDX];
double cSar = mConditions.sarBuffer[cIDX];
double pSar = mConditions.sarBuffer[pIDX];
double p2Sar = mConditions.sarBuffer[p2IDX];
//
// KI ...
double zKI = mConditions.kiBuffer[zIDX];
double cKI = mConditions.kiBuffer[cIDX];
double pKI = mConditions.kiBuffer[pIDX];
double p2KI = mConditions.kiBuffer[p2IDX];
//
// KI State ...
double zKIState = mConditions.kiStateBuffer[zIDX];
double cKIState = mConditions.kiStateBuffer[cIDX];
double pKIState = mConditions.kiStateBuffer[pIDX];
double p2KIState = mConditions.kiStateBuffer[p2IDX];
//
// TKI ...
double zTKI = mConditions.tkiBuffer[zIDX];
double cTKI = mConditions.tkiBuffer[cIDX];
double pTKI = mConditions.tkiBuffer[pIDX];
double p2TKI = mConditions.tkiBuffer[p2IDX];
//
// TKI State ...
double zTKIState = mConditions.tkiStateBuffer[zIDX];
double cTKIState = mConditions.tkiStateBuffer[cIDX];
double pTKIState = mConditions.tkiStateBuffer[pIDX];
double p2TKIState = mConditions.tkiStateBuffer[p2IDX];
//
// MAH ...
double zMAH = mConditions.mahBuffer[zIDX];
double cMAH = mConditions.mahBuffer[cIDX];
double pMAH = mConditions.mahBuffer[pIDX];
double p2MAH = mConditions.mahBuffer[p2IDX];
//
// MAL ...
double zMAL = mConditions.malBuffer[zIDX];
double cMAL = mConditions.malBuffer[cIDX];
double pMAL = mConditions.malBuffer[pIDX];
double p2MAL = mConditions.malBuffer[p2IDX];
//
// MAC ...
double zMAC = mConditions.macBuffer[zIDX];
double cMAC = mConditions.macBuffer[cIDX];
double pMAC = mConditions.macBuffer[pIDX];
double p2MAC = mConditions.macBuffer[p2IDX];
//
// TREND ...
double zTrend = mConditions.trendBuffer[zIDX];
double cTrend = mConditions.trendBuffer[cIDX];
double pTrend = mConditions.trendBuffer[pIDX];
double p2Trend = mConditions.trendBuffer[p2IDX];
//
// TREND State ...
double zTrendState = mConditions.trendStateBuffer[zIDX];
double cTrendState = mConditions.trendStateBuffer[cIDX];
double pTrendState = mConditions.trendStateBuffer[pIDX];
double p2TrendState = mConditions.trendStateBuffer[p2IDX];
//
// RESISTANCE ...
double zResistance = mConditions.resistanceBuffer[zIDX];
double cResistance = mConditions.resistanceBuffer[cIDX];
double pResistance = mConditions.resistanceBuffer[pIDX];
double p2Resistance = mConditions.resistanceBuffer[p2IDX];
//
// SUPPORT ...
double zSupport = mConditions.supportBuffer[zIDX];
double cSupport = mConditions.supportBuffer[cIDX];
double pSupport = mConditions.supportBuffer[pIDX];
double p2Support = mConditions.supportBuffer[p2IDX];
//
// VIDYA ...
double zVIDYA = mConditions.vidyaBuffer[zIDX];
double cVIDYA = mConditions.vidyaBuffer[cIDX];
double pVIDYA = mConditions.vidyaBuffer[pIDX];
double p2VIDYA = mConditions.vidyaBuffer[p2IDX];
//
// VIDYA State ...
double zVIDYAState = mConditions.vidyaStateBuffer[zIDX];
double cVIDYAState = mConditions.vidyaStateBuffer[cIDX];
double pVIDYAState = mConditions.vidyaStateBuffer[pIDX];
double p2VIDYAState = mConditions.vidyaStateBuffer[p2IDX];
//
// SWING Low ...
double zSwingLow = mConditions.swingLowBuffer[zIDX];
double cSwingLow = mConditions.swingLowBuffer[cIDX];
double pSwingLow = mConditions.swingLowBuffer[pIDX];
double p2SwingLow = mConditions.swingLowBuffer[p2IDX];
//
// SWING High ...
double zSwingHigh = mConditions.swingHighBuffer[zIDX];
double cSwingHigh = mConditions.swingHighBuffer[cIDX];
double pSwingHigh = mConditions.swingHighBuffer[pIDX];
double p2SwingHigh = mConditions.swingHighBuffer[p2IDX];
//
// FIBO Level 1 ...
double zFiboLevel1 = mConditions.fiboLevel1Buffer[zIDX];
double cFiboLevel1 = mConditions.fiboLevel1Buffer[cIDX];
double pFiboLevel1 = mConditions.fiboLevel1Buffer[pIDX];
double p2FiboLevel1 = mConditions.fiboLevel1Buffer[p2IDX];
//
// FIBO Level 2 ...
double zFiboLevel2 = mConditions.fiboLevel2Buffer[zIDX];
double cFiboLevel2 = mConditions.fiboLevel2Buffer[cIDX];
double pFiboLevel2 = mConditions.fiboLevel2Buffer[pIDX];
double p2FiboLevel2 = mConditions.fiboLevel2Buffer[p2IDX];
//
// FIBO Level 3 ...
double zFiboLevel3 = mConditions.fiboLevel3Buffer[zIDX];
double cFiboLevel3 = mConditions.fiboLevel3Buffer[cIDX];
double pFiboLevel3 = mConditions.fiboLevel3Buffer[pIDX];
double p2FiboLevel3 = mConditions.fiboLevel3Buffer[p2IDX];
//
// X3MA ...
//
// FAST ...
//
double z3MAFast = mConditions.fastBuffer[zIDX];
double c3MAFast = mConditions.fastBuffer[cIDX];
double p3MAFast = mConditions.fastBuffer[pIDX];
double p23MAFast = mConditions.fastBuffer[p2IDX];
//
double z3MAFastState = mConditions.fastStateBuffer[zIDX];
double c3MAFastState = mConditions.fastStateBuffer[cIDX];
double p3MAFastState = mConditions.fastStateBuffer[pIDX];
double p23MAFastState = mConditions.fastStateBuffer[p2IDX];
//
// MEDIUM ...
//
double z3MAMedium = mConditions.mediumBuffer[zIDX];
double c3MAMedium = mConditions.mediumBuffer[cIDX];
double p3MAMedium = mConditions.mediumBuffer[pIDX];
double p23MAMedium = mConditions.mediumBuffer[p2IDX];
//
double z3MAMediumState = mConditions.mediumStateBuffer[zIDX];
double c3MAMediumState = mConditions.mediumStateBuffer[cIDX];
double p3MAMediumState = mConditions.mediumStateBuffer[pIDX];
double p23MAMediumState = mConditions.mediumStateBuffer[p2IDX];
//
// SLOW ...
//
double z3MASlow = mConditions.slowBuffer[zIDX];
double c3MASlow = mConditions.slowBuffer[cIDX];
double p3MASlow = mConditions.slowBuffer[pIDX];
double p23MASlow = mConditions.slowBuffer[p2IDX];
//
double z3MASlowState = mConditions.slowStateBuffer[zIDX];
double c3MASlowState = mConditions.slowStateBuffer[cIDX];
double p3MASlowState = mConditions.slowStateBuffer[pIDX];
double p23MASlowState = mConditions.slowStateBuffer[p2IDX];
//
// RSI ...
double zRSI = mConditions.rsiBuffer[zIDX];
double cRSI = mConditions.rsiBuffer[cIDX];
double pRSI = mConditions.rsiBuffer[pIDX];
double p2RSI = mConditions.rsiBuffer[p2IDX];
//
// Reading Bars ...
//
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
XOHCL p2Bar;
XOHCL p3Bar;
XOHCL p4Bar;
has = zBar.Init(
_Symbol,
_Period,
zIDX //
);
has =
has &&
zBar.GetPreviousBar(cBar);
has =
has &&
cBar.GetPreviousBar(pBar);
has =
has &&
pBar.GetPreviousBar(p2Bar);
has =
has &&
p2Bar.GetPreviousBar(p3Bar);
has =
has &&
p3Bar.GetPreviousBar(p4Bar);
if (!has)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
p2Bar.Clean();
p3Bar.Clean();
p4Bar.Clean();
//
return;
}
//
// Reading Bars Related Data ...
//
// Score ...
//
double bullishScore = 0;
double bearishScore = 0;
mConditions.GenerateScore(
bullishScore,
bearishScore //
);
//
bool isScoreBullish =
bullishScore > bearishScore;
//
bool isScoreBearish =
bearishScore > bullishScore;
//
// Generating Conditions Summary ...
string summary =
mConditions
.GenerateSummary();
//
// Calculating Range Volumes ...
//
double bullishVolume = 0;
double bearishVolume = 0;
int volumeRangeLoopback = 5;
helper.barAnalyser.CalculateRangeVolume(
cBar,
bullishVolume,
bearishVolume,
volumeRangeLoopback //
);
//
double rangeVolume = bullishVolume = bearishVolume;
double rangeVolumeAvg = rangeVolume / volumeRangeLoopback;
//
// Preparing Complex Conditions ...
//
bool isRSIBullish =
cRSI > pRSI &&
!mConditions.isRSIOB;
//
bool isRSIBearish =
cRSI < pRSI &&
!mConditions.isRSIOS;
//
bool isVolumeBullish = bullishVolume > bearishVolume;
bool isVolumeBearish = bullishVolume < bearishVolume;
bool isVolumeOverLast = cBar.volume > pBar.volume;
bool isVolumeOverAvg = cBar.volume > rangeVolumeAvg;
//
// Cond2 ...
//
bool isCond2Bullish =
//
mConditions.isUnderMal &&
mConditions.isValeIsPivot &&
// mConditions.swingLowBuffer[cIDX] > mConditions.valeBuffer[cIDX] &&
mConditions.swingLowBuffer[cIDX] < mConditions.fiboLevel3Buffer[cIDX]
//
;
//
bool isCond2Bearish =
//
false // &&
//
;
//
bool isCond2 = isCond2Bullish ||
isCond2Bearish;
if (isCond2)
{
//
// Print("Cond2");
// isCond2Bullish = false;
// isCond2Bearish = false;
}
//
// Check Results ...
//
bool isBullish = isCond2Bullish;
bool isBearish = isCond2Bearish;
//
bool result = isBullish ||
isBearish;
if (result)
{
//
datetime time = zBar.time;
//
ENUM_X_DIRECTION iDir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Handle Works ...
if (isCond2)
{
//
string name = "Cond2_" + ToString(iDir);
//
color clr = isBullish
? clrAqua
: clrMagenta;
//
CChartObjectHLine *iObj;
iObj = new CChartObjectHLine();
has = iObj.Create(
0,
name,
0,
time //
);
if (has)
{
//
// Style Object ...
iObj.Width(1);
iObj.Color(clr);
iObj.Style(STYLE_DOT);
//
// Store Object ...
mObjects.Add(iObj);
}
}
}
}
//