// // Configurations ... bool useSharpChange = false; bool useOrderBlockFVG = false; // // Select Order Blocks ... if (useOrderBlockFVG) { // if (obStateEvents.hasNewOrderBlock) { // idx = GetYoungest(obState.orderBlocks); has = IsValidIndex(idx); if (has) { // XCFVG *iFVG = NULL; XCOrderBlock *iOB = obState.orderBlocks[idx]; bool isBullish = iOB.IsBullish(); // // Detecting Inside FVG ... has = fvgState.HasFairValueGaps(); if (has) { // XCFVG *tmpFVGs[]; count = fvgState.CountFairValueGaps(); for (int i = 0; i < count; i++) { // XCFVG *jFVG = fvgState.fairValueGaps[i]; // bool isDirPassed = jFVG.GetDirection() == iOB.GetDirection(); bool isFromPassed = jFVG.From() >= iOB.From(); bool isPlacePassed = IsInsideOrDiff( jFVG, iOB, false // ); // has = isDirPassed && isFromPassed && isPlacePassed; if (has) { // Add( jFVG, tmpFVGs // ); } // ZeroMemory(jFVG); } // // Selecting iFVG Based on Direction of OB ... has = HasChild(tmpFVGs); if (has) { // idx = isBullish ? GetLowest(tmpFVGs) : GetHighest(tmpFVGs); has = IsValidIndex(idx); if (has) { iFVG = tmpFVGs[idx]; } } // Clean(tmpFVGs); } // XBoxZone iOBBox; XBoxZone iFVGBox; if (iFVG != NULL) { // has = ToBox( iFVGBox, iFVG // ); } // has = ToBox( iOBBox, iOB // ); // has = iOBBox.IsValid() && iFVGBox.IsValid(); if (has) { // XSignalBox iSignalBox; // iSignalBox.ob = iOBBox; iSignalBox.fvg = iFVGBox; // // Here We Check Waiting Box Contains Other Zones ... // Like Support/Resistances ... bool forceVerification = false; if (forceVerification) { // XBoxZone iVerificationBox; XBoxZone tmpBoxes[]; if (isBullish) { // ToBox( provider.decisionState.supportZones, tmpBoxes // ); } else { // ToBox( provider.decisionState.resistanceZones, tmpBoxes // ); } has = HasChild(tmpBoxes); if (has) { // while (HasChild(tmpBoxes)) { // idx = GetYoungest(tmpBoxes); has = IsValidIndex(idx); if (!has) { break; } // // Select Box ... XBoxZone iBox = tmpBoxes[idx]; ArrayRemove( tmpBoxes, idx, 1 // ); // // Validate Box ... bool isValidPassed = !IsBoxValid( iBox, barIndex // ); bool isDirPassed = iBox.dir == iOBBox.dir; bool isPlacePassed = IsBoxInside( iBox, iOBBox // ) // && // (!iFVGBox.IsValid() ? true : IsBoxInsideOr( iBox, iFVGBox // )); // has = isDirPassed && isValidPassed && isPlacePassed; if (has) { // iVerificationBox = iBox; iBox.Clean(); break; } // iBox.Clean(); } } has = iVerificationBox.IsValid(); Clean(tmpBoxes); iVerificationBox.Clean(); } // if (has) { // AddRef( iSignalBox, waitingBoxes // ); } // iSignalBox.Clean(); } // iOBBox.Clean(); iFVGBox.Clean(); ZeroMemory(iOB); ZeroMemory(iFVG); } } } // // Checking Other Senario for Waiting Boxes ... if (useSharpChange) { // if (obStateEvents.hasNewSharp) { // XBoxZone currSharp; XBoxZone prevSharp; XBoxZone sharpConsolidation; // // Retrieve Current Sharp ... XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; XBoxZone tmpBoxes[]; Copy( obState.sharps, tmpBoxes // ); idx = GetYoungest(tmpBoxes); has = IsValidIndex(idx); if (has) { // currSharp = tmpBoxes[idx]; bool isBullish = currSharp.IsBullish(); // ArrayRemove( tmpBoxes, idx, 1 // ); // while (HasChild(tmpBoxes)) { // idx = GetYoungest(tmpBoxes); has = IsValidIndex(idx); // if (!has) { break; } // XBoxZone iBox = tmpBoxes[idx]; ArrayRemove( tmpBoxes, idx, 1 // ); // if (iBox.dir == currSharp.dir) { // prevSharp = iBox; iBox.Clean(); break; } // iBox.Clean(); } // Clean(tmpBoxes); } Clean(tmpBoxes); // // Preparing Sharp Consolidation Box ... has = currSharp.IsValid() && prevSharp.IsValid() && prevSharp.lower < currSharp.upper; if (has) { // sharpConsolidation.type = "XSHCNZ"; sharpConsolidation.dir = currSharp.dir; sharpConsolidation.symbol = currSharp.symbol; sharpConsolidation.period = currSharp.period; // sharpConsolidation.from = prevSharp.to; sharpConsolidation.to = currSharp.from; // int toIDX = GetBarIndex( currSharp.symbol, currSharp.period, sharpConsolidation.to // ); int fromIDX = GetBarIndex( currSharp.symbol, currSharp.period, sharpConsolidation.from // ); int length = fromIDX - toIDX; // XOHCL toBar; has = toBar.Init( sharpConsolidation.symbol, sharpConsolidation.period, toIDX // ); // if (has) { // double upper = toBar.FindHighest( length, MODE_HIGH // ); // double lower = toBar.FindLowest( length, MODE_LOW // ); // sharpConsolidation.upper = upper; sharpConsolidation.lower = lower; } // has = sharpConsolidation.IsValid(); if (has) { // XSignalBox iBox; // iBox.ob = sharpConsolidation; // AddRef( iBox, waitingBoxes // ); // iBox.Clean(); // // // XCBoxObject *iCBoxObj; // XCBoxObject *iPBoxObj; // provider.visionCycleHelper.mPOIDrawer.DrawBox( // currSharp, // iCBoxObj // // ); // provider.visionCycleHelper.mPOIDrawer.DrawBox( // prevSharp, // iPBoxObj // // ); } // currSharp.Clean(); prevSharp.Clean(); sharpConsolidation.Clean(); } } // // Update Exists Box ... // XBoxZone fvgs[]; // count = ArraySize(waitingBoxes); // has = IsValidSize(count); // if (has) // { // // // for (int i = 0; i < count; i++) // { // // // bool isSharpBox = waitingBoxes[i].ob.type == "XSHCNZ"; // if (!isSharpBox) // { // continue; // } // // // bool isBullish = waitingBoxes[i].ob.IsBullish(); // // // // Extract Inside FVGS ... // if (isBullish) // { // // // ToBox( // fvgState.bullishFairValueGaps, // fvgs // // ); // } // else // { // // // ToBox( // fvgState.bearishFairValueGaps, // fvgs // // ); // } // has = HasChild(fvgs); // if (has) // { // // // int removeds[]; // int iFVGsCount = ArraySize(fvgs); // for (int j = 0; j < iFVGsCount; j++) // { // // // XBoxZone iFVGBox = fvgs[j]; // bool isFromPassed = iFVGBox.from >= waitingBoxes[i].ob.from; // bool isBoundaryPassed = // isBullish // ? iFVGBox.lower < waitingBoxes[i].ob.upper // : iFVGBox.upper > waitingBoxes[i].ob.lower; // // // has = isFromPassed && // isBoundaryPassed; // if (!has) // { // // // Add( // j, // removeds // // ); // } // } // // // CleanupArray( // removeds, // fvgs // // ); // Clean(removeds); // } // // // // Select FVG ... // has = HasChild(fvgs); // if (has) // { // // // idx = isBullish // ? GetLowest(fvgs) // : GetHighest(fvgs); // has = IsValidIndex(idx); // if (has) // { // waitingBoxes[i].fvg = fvgs[idx]; // } // } // else // { // waitingBoxes[i].fvg.Clean(); // } // } // } // // Clean(fvgs); } ///////////////////////////////////////////////////////////////////////////////////// if (signalProvider == X121SMC_XWZ_PROVIDER_XHKMA) { // iAtr = provider.decisionXConditions.atrBuffer[1]; iAtr *= 0; // // Prepare Box fro SL ... iSL = pivot; Add( iSL, sls // ); // // Fix rf Reward ... rfRewar = 2; } else if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX) { // iAtr = provider.decisionXConditions.atrBuffer[1]; iAtr *= 0; // Clean(sls); // // Prepare Box fro SL ... iSL = signalBox.lower + ((signalBox.upper - signalBox.lower) / 2); Add( iSL, sls // ); // // Fix rf Reward ... rfRewar = 2; } else if (signalProvider == X121SMC_XWZ_PROVIDER_XACTIVATED_BOX) { // iAtr = provider.decisionXConditions.atrBuffer[1]; iAtr *= 0; // Clean(sls); // // Prepare Box fro SL ... iSL = pivot; Add( iSL, sls // ); // // Fix rf Reward ... rfRewar = 2; } else if (signalProvider == X121SMC_XWZ_PROVIDER_XBREAKED_BOX) { // iAtr = provider.decisionXConditions.atrBuffer[1]; iAtr *= 0; // Clean(sls); // // Prepare Box fro SL ... iSL = pivot; Add( iSL, sls // ); // // Fix rf Reward ... rfRewar = 2; }