//+------------------------------------------------------------------+ //| Test.mq5 | //| Copyright 2025, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" // #include "../Classes/x-saherelm.x-bar.analyser.class.mq5" #include "../Classes/x-saherelm.x-poi.class.mq5" #include "../Classes/x-saherelm.x-poi.drawer.class.mq5" // XCPOIDrawer *mPOIDrawer; XCPOIDetector *mPOIDetector; XCBarAnalyser *mBarAnalyser; // XBarTracker mBarTracker; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- mPOIDetector = new XCPOIDetector( _Symbol, _Period // ); mPOIDetector.Init(); //--- mPOIDrawer = new XCPOIDrawer(); //--- mBarAnalyser = new XCBarAnalyser(); //--- mBarTracker.Init( _Symbol, _Period // ); //--- return (INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- ZeroMemory(mPOIDrawer); ZeroMemory(mBarAnalyser); ZeroMemory(mPOIDetector); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { // bool isNewBar = mBarTracker.IsNewBar(); if (!isNewBar) { return; } // ENUM_XPOI_EVENTS mPOIEvents[]; mPOIDetector.Update(mPOIEvents); // XPOIState mPOIState; mPOIDetector.GetState(mPOIState); // bool has = Contains( X_BULLISH_FVG_DETECTED, mPOIEvents // ) || Contains( X_BEARISH_FVG_DETECTED, mPOIEvents // ); if (has) { // XCFVG *fvg; int idx = GetYoungest(mPOIState.fairValueGaps); has = IsValidIndex(idx); if (has) { // fvg = mPOIState.fairValueGaps[idx]; // XCBaseObject *iObj; has = mPOIDrawer.CreateFairValueGap( fvg, iObj // ); // if (has) { // Print("New Fair Value Gap ..."); } } } // // // bool has = mPOIState.HasFairValueGaps(); // if (has) // { // // // int count = mPOIState.CountFairValueGaps(); // for (int i = 0; i < count; i++) // { // // // mPOIState.fairValueGaps[i].To(TimeCurrent()); // // // XCBaseObject *iObj; // bool isCreated = mPOIDrawer.CreateFairValueGap( // mPOIState.fairValueGaps[i], // iObj // // ); // } // // Print("Salam"); // return; // // // XOHCL bar; // bool isInited = bar.Init( // _Symbol, // _Period, // 0 // // ); // if (!isInited) // { // return; // } // // // int index = 0; // ENUM_X_DIRECTION sameBarDir; // bool hasSameBars = mBarAnalyser.HasSameBars( // bar, // sameBarDir, // index, // 3 // // ); // if (hasSameBars) // { // } // // // // Detect Fair Value Gap ... // XOHCL fvgEndBar; // XOHCL fvgStartBar; // ENUM_X_DIRECTION fvgDir; // bool hasFVG = mBarAnalyser.HasFairValueGap( // bar, // fvgStartBar, // fvgEndBar, // fvgDir, // 3 // // ); // if (hasFVG) // { // // // XCFVG *fvg; // fvg = new XCFVG(); // bool isInit = fvg.Init( // fvgStartBar, // fvgEndBar, // fvgDir // // ); // // if (isInit) // // { // // // // // XCBaseObject *iObj; // // bool isCreated = mPOIDrawer.CreateFairValueGap( // // fvg, // // iObj // // // ); // // // // // // // if (isCreated) // // { // // } // // } // } // // // XOHCL obBar; // ENUM_X_DIRECTION obDir; // bool hasOB = mBarAnalyser.HasOrderBlock( // bar, // obBar, // obDir, // 3 // // ); // if (hasOB) // { // // // XCOrderBlock *ob; // ob = new XCOrderBlock(); // bool isInit = ob.Init( // obBar, // obDir // // ); // if (isInit) // { // // // // // XCBaseObject *iObj; // // bool isCreated = mPOIDrawer.CreateOrderBlock( // // ob, // // iObj // // // ); // // // // // if (isCreated) // // { // // Print("Order Block ..."); // // } // // } // } // // // } } //+------------------------------------------------------------------+