///////////////////////////////////////////////////////////////////////////////////////////////////// else if (isPriceRejected) { // bool hasRejectedOB = rejectedOB != NULL; bool hasRejectedFVG = rejectedFVG != NULL; // // // if (hasRejectedOB) // { // // // DrawX121SMCXSupDemOBSOrderBlock( // rejectedOB, // consolidationCycleHelper.mPOIDrawer // // ); // } // // // if (hasRejectedFVG) // { // // // DrawX121SMCXSupDemOBSFairValueGap( // rejectedFVG, // consolidationCycleHelper.mPOIDrawer // // ); // } // // // if (!hasRejectedOB && // !hasRejectedFVG) // { // // // if (hasInsideSupDemZone) // { // // // double min = 0; // double max = 0; // bool canSetMin = false; // bool canSetMax = false; // // // if (swingBar.IsValid()) // { // // // canSetMin = // min == 0 || min > swingBar.low; // if (canSetMin) // { // min = swingBar.low; // } // // // canSetMax = // max == 0 || max < swingBar.high; // if (canSetMax) // { // max = swingBar.high; // } // } // // // if (rejectBar.IsValid()) // { // // // canSetMin = // min == 0 || min > rejectBar.low; // if (canSetMin) // { // min = rejectBar.low; // } // // // canSetMax = // max == 0 || max < rejectBar.high; // if (canSetMax) // { // max = rejectBar.high; // } // } // // // if (breakerBar.IsValid()) // { // // // canSetMin = // min == 0 || min > breakerBar.low; // if (canSetMin) // { // min = breakerBar.low; // } // // // canSetMax = // max == 0 || max < breakerBar.high; // if (canSetMax) // { // max = breakerBar.high; // } // } // // // if (momentumBar.IsValid()) // { // // // canSetMin = // min == 0 || min > momentumBar.low; // if (canSetMin) // { // min = momentumBar.low; // } // // // canSetMax = // max == 0 || max < momentumBar.high; // if (canSetMax) // { // max = momentumBar.high; // } // } // // // upper = max; // lower = min; // // // if (hasInsideSupplyZone) // { // // // isInsideZoneDirectionBullish = false; // isInsideZoneDirectionBearish = true; // // // lower = GetEntry( // conditions.symbol, // POSITION_TYPE_SELL // // ); // } // // // if (hasInsideDemandZone) // { // // // isInsideZoneDirectionBullish = true; // isInsideZoneDirectionBearish = false; // // // upper = GetEntry( // conditions.symbol, // POSITION_TYPE_BUY // // ); // } // } // } } ///////////////////////////////////////////////////////////////////////////////////////////////////// // if (!hasInsideZone && !hasRejectedZone && hasInsideSupDemZone) { // // Check Supply and Demand Zone Rejection ... if (hasInsideSupplyZone) { // isPriceRejected = IsReject( X_DIRECTION_BEARISH, decisionZBar, insideSupplyZone, decisionState, swingBar, rejectBar, breakerBar, momentumBar, false // ); } else if (hasInsideDemandZone) { // isPriceRejected = IsReject( X_DIRECTION_BULLISH, decisionZBar, insideDemandZone, decisionState, swingBar, rejectBar, breakerBar, momentumBar, false // ); } } ///////////////////////////////////////////////////////////////////////////////////////////////////// // // // // Detect Overal Trend ... // ENUM_X_DIRECTION trend; // bool hasTrend = mConditions.DetectTrend( // trend, // zIndex // // ); // bool hasBullishTrend = // // // hasTrend && // IsBullish(trend) // // // ; // bool hasBearishTrend = // // // hasTrend && // IsBearish(trend) // // // ; // result = hasTrend; // if (!result) // { // return result; // } // // // // Now We Have to Detect at least One OrderBlock with FVG ... // // for Trend Approvement ... // bool hasOrderBlock = mConditions.HasOrderBlock(); // bool hasFairValueGap = mConditions.HasFairValueGap(); // if (!hasOrderBlock && // !hasFairValueGap) // { // // // int count = 0; // bool has = false; // // // XCFVG *fvg = NULL; // XCOrderBlock *ob = NULL; // // // if (hasBullishTrend) // { // // // has = consolidationState.HasBullishOrderBlocks(); // count = consolidationState.CountBullishOrderBlocks(); // // // if (has) // { // // // // Check Order Block ... // for (int i = 0; i < count; i++) // { // // // XCOrderBlock *iOB = consolidationState.bullishOrderBlocks[i]; // // // iOB.To(cTime); // // // // Check From Passes ... // bool isFromPassed = iOB.From() > mConditions.demandZone.From(); // if (!isFromPassed) // { // continue; // } // // // // Must inside DemandZone ... // bool isInsideDemand = IsInsideDiff( // iOB, // mConditions.demandZone // // ); // if (!isInsideDemand) // { // continue; // } // // // // Check Started ... // XOHCL startedBar; // ENUM_X_DIRECTION startedDir; // bool isStarted = iOB.IsStarted( // X_DIRECTION_BULLISH, // startedBar, // startedDir // // ); // if (!isStarted) // { // // // startedBar.Clean(); // continue; // } // // // // Converts to Box ... // XBoxZone obBox; // bool hasOBBox = ToBox( // obBox, // iOB // // ); // if (!hasOBBox) // { // // // obBox.Clean(); // startedBar.Clean(); // continue; // } // // // // Check Zone Must not Used before ... // bool isUsed = IsBoxUsed( // obBox, // startedBar.Index() - 1, // zIndex // // ); // if (isUsed) // { // // // obBox.Clean(); // startedBar.Clean(); // continue; // } // // // ob = iOB; // // // obBox.Clean(); // startedBar.Clean(); // // // break; // } // // // // Detect Fair Value Gap ... // if (ob != NULL && // ob.IsValid()) // { // // // has = analyseState.HasBullishFairValueGaps(); // count = analyseState.CountBullishFairValueGaps(); // if (has) // { // // // // Check Fir Value Gap ... // for (int i = 0; i < count; i++) // { // // // XCFVG *iFVG = analyseState.bullishFairValueGaps[i]; // // // iFVG.To(cTime); // // // // Check From Passes ... // bool isFromPassed = iFVG.From() > ob.From(); // if (!isFromPassed) // { // continue; // } // // // // Check Started ... // XOHCL startedBar; // ENUM_X_DIRECTION startedDir; // bool isStarted = iFVG.IsStarted( // X_DIRECTION_BULLISH, // startedBar, // startedDir // // ); // if (!isStarted) // { // // // startedBar.Clean(); // continue; // } // // // // Converts to Box ... // XBoxZone fvgBox; // bool hasFVGBox = ToBox( // fvgBox, // iFVG // // ); // if (!hasFVGBox) // { // // // fvgBox.Clean(); // startedBar.Clean(); // continue; // } // // // // Check Inside Order Block ... // bool isInside = IsInsideDiff( // iFVG, // ob, // true // Force Side Out ... // ); // if (!isInside) // { // continue; // } // // // fvg = iFVG; // // // fvgBox.Clean(); // startedBar.Clean(); // // // break; // } // } // else // { // // // ob = NULL; // } // } // } // } // else if (hasBearishTrend) // { // // // has = consolidationState.HasBearishOrderBlocks(); // count = consolidationState.CountBearishOrderBlocks(); // // // if (has) // { // // // // Check Order Block ... // for (int i = 0; i < count; i++) // { // // // XCOrderBlock *iOB = consolidationState.bearishOrderBlocks[i]; // // // iOB.To(cTime); // // // // Check From Passes ... // bool isFromPassed = iOB.From() > mConditions.supplyZone.From(); // if (!isFromPassed) // { // continue; // } // // // // Must inside DemandZone ... // bool isInsideDemand = IsInsideDiff( // iOB, // mConditions.supplyZone // // ); // if (!isInsideDemand) // { // continue; // } // // // // Check Started ... // XOHCL startedBar; // ENUM_X_DIRECTION startedDir; // bool isStarted = iOB.IsStarted( // X_DIRECTION_BEARISH, // startedBar, // startedDir // // ); // if (!isStarted) // { // // // startedBar.Clean(); // continue; // } // // // // Converts to Box ... // XBoxZone obBox; // bool hasOBBox = ToBox( // obBox, // iOB // // ); // if (!hasOBBox) // { // // // obBox.Clean(); // startedBar.Clean(); // continue; // } // // // // Check Zone Must not Used before ... // bool isUsed = IsBoxUsed( // obBox, // startedBar.Index() - 1, // zIndex // // ); // if (isUsed) // { // // // obBox.Clean(); // startedBar.Clean(); // continue; // } // // // ob = iOB; // // // obBox.Clean(); // startedBar.Clean(); // // // break; // } // // // // Detect Fair Value Gap ... // if (ob != NULL && // ob.IsValid()) // { // // // has = analyseState.HasBearishFairValueGaps(); // count = analyseState.CountBearishFairValueGaps(); // if (has) // { // // // // Check Fir Value Gap ... // for (int i = 0; i < count; i++) // { // // // XCFVG *iFVG = analyseState.bearishFairValueGaps[i]; // // // iFVG.To(cTime); // // // // Check From Passes ... // bool isFromPassed = iFVG.From() > ob.From(); // if (!isFromPassed) // { // continue; // } // // // // Check Started ... // XOHCL startedBar; // ENUM_X_DIRECTION startedDir; // bool isStarted = iFVG.IsStarted( // X_DIRECTION_BEARISH, // startedBar, // startedDir // // ); // if (!isStarted) // { // // // startedBar.Clean(); // continue; // } // // // // Converts to Box ... // XBoxZone fvgBox; // bool hasFVGBox = ToBox( // fvgBox, // iFVG // // ); // if (!hasFVGBox) // { // // // fvgBox.Clean(); // startedBar.Clean(); // continue; // } // // // // Check Inside Order Block ... // bool isInside = IsInsideDiff( // iFVG, // ob, // true // Force Side Out ... // ); // if (!isInside) // { // continue; // } // // // fvg = iFVG; // // // fvgBox.Clean(); // startedBar.Clean(); // // // break; // } // } // else // { // // // ob = NULL; // } // } // } // } // // // if (ob != NULL && // fvg != NULL) // { // // // mConditions.orderBlock = ob; // mConditions.fairValueGap = fvg; // } // // // hasOrderBlock = mConditions.HasOrderBlock(); // hasFairValueGap = mConditions.HasFairValueGap(); // } // // // bool isTrendApproved = hasOrderBlock && // hasFairValueGap; // result = isTrendApproved; // if (!result) // { // return result; // } // // // mConditions.UpdateTo(cTime); // // // // TODO: Remove ... // RemoveDraws(); // DrawConditions( // mConditions, // visionCycleHelper.mPOIDrawer // // ); // // // // Now We have to Detect Start Zones ... // int count = 0; // bool has = false; // // // // XBoxZone targetBoxes[]; // if (hasBullishTrend) // { // // // // // } // else if (hasBearishTrend) // { // // // // Demand Zones ... // has = consolidationState.HasDemandZones(); // count = consolidationState.CountDemandZones(); // XBoxZone demandBox; // // // if (has) // { // // // XCDemandZone *demands[]; // for (int i = 0; i < count; i++) // { // // // XCDemandZone *iZone = consolidationState.demandZones[i]; // // // iZone.To(cTime); // // // // Check Price ... // bool isPricePassed = decisionCBar.low > iZone.Upper(); // if (!isPricePassed) // { // continue; // } // // // XBoxZone iBox; // bool hasBox = ToBox( // iBox, // iZone // // ); // if (!hasBox) // { // // // iBox.Clean(); // continue; // } // // // // // XCDemandZoneObject *iObj; // // bool isCreated = visionCycleHelper // // .mPOIDrawer // // .CreateDemandZone( // // iZone, // // iObj // // // ); // // // Add( // iZone, // demands // // ); // // // // AddRef( // // iBox, // // targetBoxes // // // ); // // // iBox.Clean(); // } // // // count = ArraySize(demands); // has = IsValidSize(count); // if (has) // { // // // int lowestIDX = GetLowest(demands); // int highestIDX = GetHighest(demands); // int youngestIDX = GetYoungest(demands); // bool hasHighAndLow = // IsValidIndex(lowestIDX) && // IsValidIndex(highestIDX) && // IsValidIndex(youngestIDX); // if (hasHighAndLow) // { // // // XBoxZone box; // // // box.symbol = demands[highestIDX].GetSymbol(); // box.period = demands[highestIDX].GetPeriod(); // // // box.to = cTime; // box.dir = X_DIRECTION_BULLISH; // box.from = demands[youngestIDX].From(); // box.type = demands[highestIDX].TypeAsString(); // // // box.upper = demands[highestIDX].Upper(); // box.lower = demands[lowestIDX].Lower(); // // // bool isValid = box.IsValid(); // if (isValid) // { // // // // // XCBoxObject *iBoxObj; // // bool isCreated = visionCycleHelper // // .mPOIDrawer // // .CreateBox( // // box, // // iBoxObj // // // ); // // // // // if (isCreated) // // { // // // // // color boxColor = // // IsBullish(box.dir) // // ? clrAqua // // : clrMagenta; // // // // // ENUM_LINE_STYLE boxStyle = STYLE_DOT; // // // // // iBoxObj.BoxColor(boxColor); // // iBoxObj.BoxStyle(boxStyle); // // // // // Print("BOX ..."); // // } // // // demandBox = box; // } // // // box.Clean(); // } // } // } // // // // Bullish Order Blocks ... // // has = consolidationState.HasBullishOrderBlocks(); // // count = consolidationState.CountBullishOrderBlocks(); // // // // if (has) // // { // // // // // for (int i = 0; i < count; i++) // // { // // // // // XCOrderBlock *iZone = consolidationState.bullishOrderBlocks[i]; // // // // // iZone.To(cTime); // // // // // // Check Price ... // // bool isPricePassed = decisionCBar.low > iZone.Upper(); // // if (!isPricePassed) // // { // // continue; // // } // // // // // XBoxZone iBox; // // bool hasBox = ToBox( // // iBox, // // iZone // // // ); // // if (!hasBox) // // { // // // // // iBox.Clean(); // // continue; // // } // // // // // AddRef( // // iBox, // // targetBoxes // // // ); // // // // // iBox.Clean(); // // } // // } // // // // Bullish Fair Value Gaps ... // // has = consolidationState.HasBullishFairValueGaps(); // // count = consolidationState.CountBullishFairValueGaps(); // // // // if (has) // // { // // // // // for (int i = 0; i < count; i++) // // { // // // // // XCFVG *iZone = consolidationState.bullishFairValueGaps[i]; // // // // // iZone.To(cTime); // // // // // // Check Price ... // // bool isPricePassed = decisionCBar.low > iZone.Upper(); // // if (!isPricePassed) // // { // // continue; // // } // // // // // XBoxZone iBox; // // bool hasBox = ToBox( // // iBox, // // iZone // // // ); // // if (!hasBox) // // { // // // // // iBox.Clean(); // // continue; // // } // // // // // AddRef( // // iBox, // // targetBoxes // // // ); // // // // // iBox.Clean(); // // } // // } // } // // // count = ArraySize(targetBoxes); // has = IsValidSize(count); // if (has) // { // // // for (int i = 0; i < count; i++) // { // // // XBoxZone iBox = targetBoxes[i]; // // // XCBoxObject *iBoxObj; // bool isCreated = visionCycleHelper // .mPOIDrawer // .CreateBox( // iBox, // iBoxObj // // ); // // // iBox.Clean(); // } // } ///////////////////////////////////////////////////////////////////////////////////////////////////// // // When FVg is Worked ... else { // XCFVG *fvgs[]; if (isBullish) { // Copy( analyseState.bullishFairValueGaps, fvgs // ); } else { // Copy( analyseState.bearishFairValueGaps, fvgs // ); } // // int count = ArraySize(fvgs); // bool has = IsValidSize(count); // if (has) // { // // // for (int i = 0; i < count; i++) // { // // // XCBaseObject *iObj; // bool isCreate = visionCycleHelper // .mPOIDrawer // .CreateFairValueGap( // fvgs[i], // iObj // // ); // } // } // // Extract UnActivated FVGs ... int fvgsCount = FilterZones( // fvgs, // trend, NULL, // For Period ... workerBar.time, // // Start ... XZONE_STATE_IGNORED, true, // Force Body Out ... // // Activation ... XZONE_STATE_FAILED, false, // Force Body Out ... // // Breaktion ... XZONE_STATE_IGNORED, false, // Force Body Out ... // // Works ... XZONE_STATE_IGNORED, false, // Body Out ... // true, // Apply Sorting ... true // Ignore Inside ... ); // bool has = IsValidSize(fvgsCount); if (has) { // int youngestIDX = GetYoungest(fvgs); has = IsValidIndex(youngestIDX); if (has) { // workingZone .orderFlow[youngestOBFVGIDX] .fvg = fvgs[youngestIDX]; // workingZone.UpdateTo(cTime); // XCBaseObject *iFVGObj; bool isCreated = visionCycleHelper .mPOIDrawer.CreateFairValueGap( fvgs[youngestIDX], iFVGObj // ); if (isCreated) { Print(""); } } } } ///////////////////////////////////////////////////////////////////////////////////////////////////// // // TODO: Neews to Review ... else if ( isOBWorked && isFVGWorked && isOBActivated && isFVGActivated && fvgActivationBar.time >= obActivationBar.time && fvgActivationBar.time <= obActivationBar.NextAt() && obWorkerBar.time > fvgWorkerBar.time) { // XOHCL iBar; bool isBarPassed = iBar.Init( symbol, period, zIndex // ); // if (isBarPassed) { // bool isBarInsideFVG = isBullish ? ( // iBar.low < workingZone.orderFlow[youngestOBFVGIDX].fvg.Upper() && iBar.high > workingZone.orderFlow[youngestOBFVGIDX].fvg.Lower() && // consolidationZBar.low < workingZone.orderFlow[youngestOBFVGIDX].fvg.Upper() // ) : ( // iBar.high > workingZone.orderFlow[youngestOBFVGIDX].fvg.Lower() && iBar.low < workingZone.orderFlow[youngestOBFVGIDX].fvg.Upper() && // consolidationZBar.high > workingZone.orderFlow[youngestOBFVGIDX].fvg.Lower() // ); if (isBarInsideFVG) { Print(""); } } // iBar.Clean(); } ///////////////////////////////////////////////////////////////////////////////////////////////////// // // TODO: // Remove Drawn Objects ... // // // if (hasNewOB) // { // // // XCBaseObject *iObj; // bool isCreated = visionCycleHelper // .mPOIDrawer // .CreateOrderBlock( // newOB, // iObj // // ); // Print("New OB"); // } // // // if (hasNewFVG) // { // // // XCBaseObject *iObj; // bool isCreated = visionCycleHelper // .mPOIDrawer // .CreateFairValueGap( // newFVG, // iObj // // ); // Print("New FVG"); // } // // // if (hasNewAnalyseOB) // { // // // XCBaseObject *iObj; // bool isCreated = analyseCycleHelper // .mPOIDrawer // .CreateOrderBlock( // newAnalyseOB, // iObj // // ); // Print("New OB"); // } // // // if (hasNewAnalyseFVG) // { // // // XCBaseObject *iObj; // bool isCreated = analyseCycleHelper // .mPOIDrawer // .CreateFairValueGap( // newAnalyseFVG, // iObj // // ); // Print("New FVG"); // } ///////////////////////////////////////////////////////////////////////////////////////////////////// // XPoint llPoint; llPoint.value = iLL; llPoint.at = iLLTime; // // // XPoint hhPoint; hhPoint.value = iHH; hhPoint.at = iHHTime; // XPoint llSwings[]; AddRef( llPoint, llSwings // ); // llPoint.at = iHHTime; AddRef( llPoint, llSwings // ); // // // XPoint hhSwings[]; // hhPoint.at = iLLTime; AddRef( hhPoint, hhSwings // ); // hhPoint.at = iHHTime; AddRef( hhPoint, hhSwings // ); // XCTrendObject *llTrendObj; bool isCreated = mXWZPOIDrawer.CreateTrend( llSwings, llTrendObj // ); if (isCreated) { mXWZDrawnObjects.Add(llTrendObj); } // XCTrendObject *hhTrendObj; isCreated = mXWZPOIDrawer.CreateTrend( hhSwings, hhTrendObj // ); if (isCreated) { mXWZDrawnObjects.Add(hhTrendObj); } // // // Clean(llSwings); Clean(hhSwings); llPoint.Clean(); hhPoint.Clean(); ///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////