last ...
This commit is contained in:
@@ -197,6 +197,733 @@ else if (isPriceRejected)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// //
|
||||
// // 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();
|
||||
// }
|
||||
// }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user