/////////////////////////////////////////////////////// // // 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 ... // // Implementations ... class XCXCAEAPOIDrawer : public XCBase { // // Public ... public: // // Props ... // bool ignoreUpdateOSCTos; // // Drawers ... bool drawTrendLine; bool drawTickPivots; bool drawVolumePivots; bool drawRSIPeakPivots; bool drawRSIValePivots; bool drawCCIPeakPivots; bool drawCCIValePivots; bool drawFVGBullishPivots; bool drawFVGBearishPivots; bool drawValeSupSWLPivots; bool drawPeakResSWHPivots; bool drawPVFVGBullishPivots; bool drawPVFVGBearishPivots; // // Colors ... // color defaultBullishColor; color defaultBearishColor; // color tickPivotsColor; color volumePivotsColor; color rsiPeakPivotsColor; color rsiValePivotsColor; color cciPeakPivotsColor; color cciValePivotsColor; color fvgBullishPivotsColor; color fvgBearishPivotsColor; color valeSupSWLPivotsColor; color peakResSWHPivotsColor; color trendLineBullishColor; color trendLineBearishColor; color pvFVGBullishPivotsColor; color pvFVGBearishPivotsColor; // // Width ... // int defaultBullishWidth; int defaultBearishWidth; // int tickPivotsWidth; int volumePivotsWidth; int rsiPeakPivotsWidth; int rsiValePivotsWidth; int cciPeakPivotsWidth; int cciValePivotsWidth; int fvgBullishPivotsWidth; int fvgBearishPivotsWidth; int valeSupSWLPivotsWidth; int peakResSWHPivotsWidth; int trendLineBullishWidth; int trendLineBearishWidth; int pvFVGBullishPivotsWidth; int pvFVGBearishPivotsWidth; // // Style ... // ENUM_LINE_STYLE defaultBullishStyle; ENUM_LINE_STYLE defaultBearishStyle; // ENUM_LINE_STYLE tickPivotsStyle; ENUM_LINE_STYLE volumePivotsStyle; ENUM_LINE_STYLE rsiPeakPivotsStyle; ENUM_LINE_STYLE rsiValePivotsStyle; ENUM_LINE_STYLE cciPeakPivotsStyle; ENUM_LINE_STYLE cciValePivotsStyle; ENUM_LINE_STYLE fvgBullishPivotsStyle; ENUM_LINE_STYLE fvgBearishPivotsStyle; ENUM_LINE_STYLE valeSupSWLPivotsStyle; ENUM_LINE_STYLE peakResSWHPivotsStyle; ENUM_LINE_STYLE trendLineBullishStyle; ENUM_LINE_STYLE trendLineBearishStyle; ENUM_LINE_STYLE pvFVGBullishPivotsStyle; ENUM_LINE_STYLE pvFVGBearishPivotsStyle; // // Colorize Props ... // // Width Props ... // // Style Props ... // // Constructors ... XCXCAEAPOIDrawer( XCXCAEAPOIDetector *_detector // ) { // detector = _detector; drawer = new XCPOIDrawer(); // Default(); } // // De Constructors ... ~XCXCAEAPOIDrawer() { // Clear(); // ZeroMemory(drawer); ZeroMemory(detector); } // // Properties ... // // Tools ... // virtual void Default() { // ignoreUpdateOSCTos = true; // drawTrendLine = false; drawTickPivots = false; drawVolumePivots = false; drawRSIPeakPivots = false; drawRSIValePivots = false; drawCCIPeakPivots = false; drawCCIValePivots = false; drawFVGBullishPivots = false; drawFVGBearishPivots = false; drawValeSupSWLPivots = false; drawPeakResSWHPivots = false; drawPVFVGBullishPivots = false; drawPVFVGBearishPivots = false; // defaultBullishColor = clrLime; defaultBearishColor = clrRed; // tickPivotsColor = defaultBullishColor; volumePivotsColor = defaultBearishColor; // rsiValePivotsColor = defaultBullishColor; cciValePivotsColor = defaultBullishColor; fvgBullishPivotsColor = defaultBullishColor; valeSupSWLPivotsColor = defaultBullishColor; trendLineBullishColor = defaultBullishColor; pvFVGBullishPivotsColor = defaultBullishColor; // rsiPeakPivotsColor = defaultBearishColor; cciPeakPivotsColor = defaultBearishColor; fvgBearishPivotsColor = defaultBearishColor; peakResSWHPivotsColor = defaultBearishColor; trendLineBearishColor = defaultBearishColor; pvFVGBearishPivotsColor = defaultBearishColor; // defaultBullishWidth = 1; defaultBearishWidth = 1; // tickPivotsWidth = defaultBullishWidth; volumePivotsWidth = defaultBearishWidth; // rsiValePivotsWidth = defaultBullishWidth; cciValePivotsWidth = defaultBullishWidth; fvgBullishPivotsWidth = defaultBullishWidth; valeSupSWLPivotsWidth = defaultBullishWidth; trendLineBullishWidth = defaultBullishWidth; pvFVGBullishPivotsWidth = defaultBullishWidth; // rsiPeakPivotsWidth = defaultBearishWidth; cciPeakPivotsWidth = defaultBearishWidth; fvgBearishPivotsWidth = defaultBearishWidth; peakResSWHPivotsWidth = defaultBearishWidth; trendLineBearishWidth = defaultBearishWidth; pvFVGBearishPivotsWidth = defaultBearishWidth; // defaultBullishStyle = STYLE_SOLID; defaultBearishStyle = STYLE_SOLID; // tickPivotsStyle = defaultBullishStyle; volumePivotsStyle = defaultBearishStyle; // rsiValePivotsStyle = defaultBullishStyle; cciValePivotsStyle = defaultBullishStyle; fvgBullishPivotsStyle = defaultBullishStyle; valeSupSWLPivotsStyle = defaultBullishStyle; trendLineBullishStyle = defaultBullishStyle; pvFVGBullishPivotsStyle = defaultBullishStyle; // rsiPeakPivotsStyle = defaultBearishStyle; cciPeakPivotsStyle = defaultBearishStyle; fvgBearishPivotsStyle = defaultBearishStyle; peakResSWHPivotsStyle = defaultBearishStyle; trendLineBearishStyle = defaultBearishStyle; pvFVGBearishPivotsStyle = defaultBearishStyle; } // void Draw(datetime to = NULL) { // DrawTrendLine(); DrawTickPivots(to); DrawVolumePivots(to); DrawRSIPeakPivots(to); DrawRSIValePivots(to); DrawCCIPeakPivots(to); DrawCCIValePivots(to); DrawFVGBullishPivots(to); DrawFVGBearishPivots(to); DrawValeSupSWLPivots(to); DrawPeakResSWHPivots(to); DrawPVFVGBullishPivots(to); DrawPVFVGBearishPivots(to); } // void Clear() { // mTrendLineObjects.Clear(); mTickPivotObjects.Clear(); mVolumePivotObjects.Clear(); mRSIPeakPivotObjects.Clear(); mRSIValePivotObjects.Clear(); mCCIPeakPivotObjects.Clear(); mCCIValePivotObjects.Clear(); mFVGBullishPivotObjects.Clear(); mFVGBearishPivotObjects.Clear(); mValeSupSWLPivotObjects.Clear(); mPeakResSWHPivotObjects.Clear(); mPVFVGBullishPivotObjects.Clear(); mPVFVGBearishPivotObjects.Clear(); } // // // // void DrawTrendLine() { // if (!drawTrendLine) { return; } // ENUM_X_DIRECTION trend = X_DIRECTION_NONE; bool has = detector.MarketTrend(trend); if (!has) { return; } // long chartID = drawer.ChartIdentification(); int subWindow = drawer.SubWindowIdentification(); // bool hasBullishTrend = IsBullish(trend); // double pPrice = hasBullishTrend ? detector.trendPivotP.lower : detector.trendPivotP.upper; // datetime pTime = detector.trendPivotC.from; // double cPrice = hasBullishTrend ? detector.trendPivotC.lower : detector.trendPivotC.upper; // datetime cTime = detector.trendPivotC.from; // string tlName = ToString(trend) + "_TL_" + ToString(pPrice) + "_" + ToString(cPrice); // int tlWidth = hasBullishTrend ? trendLineBullishWidth : trendLineBearishWidth; // color tlColor = hasBullishTrend ? trendLineBullishColor : trendLineBearishColor; // ENUM_LINE_STYLE tlStyle = hasBullishTrend ? trendLineBullishStyle : trendLineBearishStyle; // CChartObjectTrend *iObj; iObj = new CChartObjectTrend(); has = iObj.Create( chartID, tlName, subWindow, pTime, pPrice, cTime, cPrice // ); if (has) { // // Style Object ... iObj.Color(tlColor); iObj.Width(tlWidth); iObj.Style(tlStyle); // // Store Object ... mTrendLineObjects.Add(iObj); } // ZeroMemory(iObj); } // void DrawTickPivots(datetime to = NULL) { // bool has = drawTickPivots; if (!has) { return; } // has = detector.HasTickPivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountTickPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.tickPivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Pivot ... iObj.BoxColor(tickPivotsColor); iObj.BoxWidth(tickPivotsWidth); iObj.BoxStyle(tickPivotsStyle); // // Store Pivot ... mTickPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawVolumePivots(datetime to = NULL) { // bool has = drawVolumePivots; if (!has) { return; } // has = detector.HasVolumePivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountVolumePivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.volumePivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Pivot ... iObj.BoxColor(volumePivotsColor); iObj.BoxWidth(volumePivotsWidth); iObj.BoxStyle(volumePivotsStyle); // // Store Pivot ... mVolumePivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawRSIPeakPivots(datetime to = NULL) { // bool has = drawRSIPeakPivots; if (!has) { return; } // has = detector.HasRSIPeakPivots(); if (!has) { return; } // if (ignoreUpdateOSCTos) { to = NULL; } bool canUpdateTo = IsValid(to); // int count = detector.CountRSIPeakPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.rsiPeakPivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(rsiPeakPivotsColor); iObj.BoxWidth(rsiPeakPivotsWidth); iObj.BoxStyle(rsiPeakPivotsStyle); // // Store Object ... mRSIPeakPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawRSIValePivots(datetime to = NULL) { // bool has = drawRSIValePivots; if (!has) { return; } // has = detector.HasRSIValePivots(); if (!has) { return; } // if (ignoreUpdateOSCTos) { to = NULL; } bool canUpdateTo = IsValid(to); // int count = detector.CountRSIValePivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.rsiValePivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(rsiValePivotsColor); iObj.BoxWidth(rsiValePivotsWidth); iObj.BoxStyle(rsiValePivotsStyle); // // Store Object ... mRSIValePivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawCCIPeakPivots(datetime to = NULL) { // bool has = drawCCIPeakPivots; if (!has) { return; } // has = detector.HasCCIPeakPivots(); if (!has) { return; } // if (ignoreUpdateOSCTos) { to = NULL; } bool canUpdateTo = IsValid(to); // int count = detector.CountCCIPeakPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.cciPeakPivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(cciPeakPivotsColor); iObj.BoxWidth(cciPeakPivotsWidth); iObj.BoxStyle(cciPeakPivotsStyle); // // Store Object ... mCCIPeakPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawCCIValePivots(datetime to = NULL) { // bool has = drawCCIValePivots; if (!has) { return; } // has = detector.HasCCIValePivots(); if (!has) { return; } // if (ignoreUpdateOSCTos) { to = NULL; } bool canUpdateTo = IsValid(to); // int count = detector.CountCCIValePivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.cciValePivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(cciValePivotsColor); iObj.BoxWidth(cciValePivotsWidth); iObj.BoxStyle(cciValePivotsStyle); // // Store Object ... mCCIValePivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawFVGBullishPivots(datetime to = NULL) { // bool has = drawFVGBullishPivots; if (!has) { return; } // has = detector.HasFVGBullishPivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountFVGBullishPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.fvgBullishPivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(fvgBullishPivotsColor); iObj.BoxWidth(fvgBullishPivotsWidth); iObj.BoxStyle(fvgBullishPivotsStyle); // // Store Object ... mFVGBullishPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawFVGBearishPivots(datetime to = NULL) { // bool has = drawFVGBearishPivots; if (!has) { return; } // has = detector.HasFVGBearishPivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountFVGBearishPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.fvgBearishPivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(fvgBearishPivotsColor); iObj.BoxWidth(fvgBearishPivotsWidth); iObj.BoxStyle(fvgBearishPivotsStyle); // // Store Object ... mFVGBearishPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawValeSupSWLPivots(datetime to = NULL) { // bool has = drawValeSupSWLPivots; if (!has) { return; } // has = detector.HasValeSupSWLPivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountValeSupSWLPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.valeSupSWLPivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(valeSupSWLPivotsColor); iObj.BoxWidth(valeSupSWLPivotsWidth); iObj.BoxStyle(valeSupSWLPivotsStyle); // // Store Object ... mValeSupSWLPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawPeakResSWHPivots(datetime to = NULL) { // bool has = drawPeakResSWHPivots; if (!has) { return; } // has = detector.HasPeakResSWHPivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountPeakResSWHPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox = detector.peakResSWHPivots[i]; // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); if (has) { // // Style Object ... iObj.BoxColor(peakResSWHPivotsColor); iObj.BoxWidth(peakResSWHPivotsWidth); iObj.BoxStyle(peakResSWHPivotsStyle); // // Store Object ... mPeakResSWHPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawPVFVGBullishPivots(datetime to = NULL) { // bool has = drawPVFVGBullishPivots; if (!has) { return; } // has = detector.HasPVFVGBullishPivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountPVFVGBullishPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox; has = detector.pvFVGBullishPivots[i].GetSelectedFVG(iBox); if (!has) { // iBox.Clean(); continue; } // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); // if (has) { // // Style Object ... iObj.BoxColor(pvFVGBullishPivotsColor); iObj.BoxWidth(pvFVGBullishPivotsWidth); iObj.BoxStyle(pvFVGBullishPivotsStyle); // // Store Object ... mPVFVGBullishPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // void DrawPVFVGBearishPivots(datetime to = NULL) { // bool has = drawPVFVGBearishPivots; if (!has) { return; } // has = detector.HasPVFVGBearishPivots(); if (!has) { return; } // bool canUpdateTo = IsValid(to); // int count = detector.CountPVFVGBearishPivots(); for (int i = 0; i < count; i++) { // XBoxZone iBox; has = detector.pvFVGBearishPivots[i].GetSelectedFVG(iBox); if (!has) { // iBox.Clean(); continue; } // if (canUpdateTo) { iBox.to = to; } // XCBoxObject *iObj; has = drawer.DrawBox( iBox, iObj // ); // if (has) { // // Style Object ... iObj.BoxColor(pvFVGBearishPivotsColor); iObj.BoxWidth(pvFVGBearishPivotsWidth); iObj.BoxStyle(pvFVGBearishPivotsStyle); // // Store Object ... mPVFVGBearishPivotObjects.Add(iObj); } // iBox.Clean(); ZeroMemory(iObj); } } // // Protected ... protected: // // Props ... // // Prrivate ... private: // // Props ... // XCPOIDrawer *drawer; XCXCAEAPOIDetector *detector; // CArrayObj mTickPivotObjects; CArrayObj mTrendLineObjects; CArrayObj mVolumePivotObjects; CArrayObj mRSIPeakPivotObjects; CArrayObj mRSIValePivotObjects; CArrayObj mCCIPeakPivotObjects; CArrayObj mCCIValePivotObjects; CArrayObj mFVGBullishPivotObjects; CArrayObj mFVGBearishPivotObjects; CArrayObj mValeSupSWLPivotObjects; CArrayObj mPeakResSWHPivotObjects; CArrayObj mPVFVGBullishPivotObjects; CArrayObj mPVFVGBearishPivotObjects; // }; //