last ...
This commit is contained in:
@@ -1053,3 +1053,994 @@ bool IsReject(
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
bool HasConditions(
|
||||
ENUM_X_DIRECTION &conditionsDir,
|
||||
XPOIState &state,
|
||||
int barIndex = 0,
|
||||
ENUM_TIMEFRAMES forPeriod = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
conditionsDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
if (forPeriod == NULL)
|
||||
{
|
||||
forPeriod = period;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValid(symbol) &&
|
||||
IsValid(period) &&
|
||||
state.IsValid() &&
|
||||
HasWorkingZone() &&
|
||||
state.HasChild()
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = false;
|
||||
|
||||
//
|
||||
// Detect Conditions Based On Start Zones ...
|
||||
bool hasStartZones = HasStartZones();
|
||||
if (hasStartZones)
|
||||
{
|
||||
//
|
||||
int count = CountStartZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
X121SMCXWZZone iStartZone = startZones[i];
|
||||
|
||||
//
|
||||
XBoxZone insideBox;
|
||||
bool isPriceInside = iStartZone.IsPriceInside(
|
||||
insideBox,
|
||||
barIndex,
|
||||
forPeriod //
|
||||
);
|
||||
if (!isPriceInside)
|
||||
{
|
||||
//
|
||||
iStartZone.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Print("PriceInside ...");
|
||||
|
||||
//
|
||||
bool hasConditions = iStartZone.HasCondition(
|
||||
insideBox,
|
||||
state,
|
||||
barIndex,
|
||||
forPeriod //
|
||||
);
|
||||
if (!hasConditions)
|
||||
{
|
||||
//
|
||||
iStartZone.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
iStartZone.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Conditions Based On Working Zones ...
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
// Detect Result Based On WorkingZone ...
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
bool HasCondition(
|
||||
XBoxZone &box,
|
||||
XPOIState &state,
|
||||
int barIndex = 0,
|
||||
ENUM_TIMEFRAMES forPeriod = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
|
||||
//
|
||||
result = IsValid() &&
|
||||
box.IsValid() &&
|
||||
HasDirection() &&
|
||||
state.IsValid() &&
|
||||
state.HasChild();
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string symbol = box.symbol;
|
||||
if (!IsValid(forPeriod))
|
||||
{
|
||||
forPeriod = box.period;
|
||||
}
|
||||
datetime cTime = iTime(
|
||||
symbol,
|
||||
forPeriod,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION forDir = box.dir;
|
||||
bool isBullish = IsBullish(forDir);
|
||||
|
||||
//
|
||||
int supportsCount = 0;
|
||||
bool hasSupports = false;
|
||||
XCSupportZone *supports[];
|
||||
|
||||
//
|
||||
int resistancesCount = 0;
|
||||
bool hasResistances = false;
|
||||
XCResistanceZone *resistances[];
|
||||
|
||||
//
|
||||
XBoxZone supResBoxes[];
|
||||
int supresBoxesCount = 0;
|
||||
bool hasSupResBoxes = false;
|
||||
|
||||
//
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
has = state.HasSupportZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = state.CountSupportZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *iZone = state.supportZones[i];
|
||||
|
||||
//
|
||||
iZone.To(cTime);
|
||||
|
||||
//
|
||||
XBoxZone iBox;
|
||||
bool hasBox = ToBox(
|
||||
iBox,
|
||||
iZone //
|
||||
);
|
||||
if (!hasBox)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check From ...
|
||||
bool isInside = IsBoxInside(
|
||||
iBox,
|
||||
box //
|
||||
);
|
||||
if (!isInside)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
supports //
|
||||
);
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iBox,
|
||||
supResBoxes //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
supportsCount = ArraySize(supports);
|
||||
hasSupports = IsValidSize(supportsCount);
|
||||
|
||||
//
|
||||
supresBoxesCount = ArraySize(supResBoxes);
|
||||
hasSupResBoxes = IsValidSize(supresBoxesCount);
|
||||
}
|
||||
|
||||
//
|
||||
has = state.HasResistanceZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = state.CountResistanceZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *iZone = state.resistanceZones[i];
|
||||
|
||||
//
|
||||
iZone.To(cTime);
|
||||
|
||||
//
|
||||
XBoxZone iBox;
|
||||
bool hasBox = ToBox(
|
||||
iBox,
|
||||
iZone //
|
||||
);
|
||||
if (!hasBox)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check From ...
|
||||
bool isInside = IsBoxInside(
|
||||
iBox,
|
||||
box //
|
||||
);
|
||||
if (!isInside)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
resistances //
|
||||
);
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iBox,
|
||||
supResBoxes //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
resistancesCount = ArraySize(resistances);
|
||||
hasResistances = IsValidSize(resistancesCount);
|
||||
|
||||
//
|
||||
supresBoxesCount = ArraySize(supResBoxes);
|
||||
hasSupResBoxes = IsValidSize(supresBoxesCount);
|
||||
}
|
||||
|
||||
//
|
||||
result = hasSupResBoxes;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(supports);
|
||||
Clean(resistances);
|
||||
Clean(supResBoxes);
|
||||
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
// //
|
||||
// AddRef(
|
||||
// box,
|
||||
// supResBoxes //
|
||||
// );
|
||||
|
||||
//
|
||||
// Detect Bars ...
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = zBar.Init(
|
||||
symbol,
|
||||
forPeriod,
|
||||
barIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
zBar.Clean();
|
||||
Clean(supports);
|
||||
Clean(resistances);
|
||||
Clean(supResBoxes);
|
||||
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = zBar.GetPreviousBar(cBar);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
Clean(supports);
|
||||
Clean(resistances);
|
||||
Clean(supResBoxes);
|
||||
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = cBar.GetPreviousBar(pBar);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
Clean(supports);
|
||||
Clean(resistances);
|
||||
Clean(supResBoxes);
|
||||
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL ppBar;
|
||||
result = pBar.GetPreviousBar(ppBar);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
ppBar.Clean();
|
||||
Clean(supports);
|
||||
Clean(resistances);
|
||||
Clean(supResBoxes);
|
||||
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions ...
|
||||
|
||||
//
|
||||
// Detect Start Senario ...
|
||||
|
||||
//
|
||||
double fiboPressureLevel = GetFiboLevelValue(X_FIBO_LEVEL_382);
|
||||
|
||||
//
|
||||
double fiboUpDown = GetFibonacciLevel(
|
||||
pBar.high,
|
||||
pBar.low,
|
||||
X_FIBO_LEVEL_382,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
double fiboDownUp = GetFibonacciLevel(
|
||||
pBar.high,
|
||||
pBar.low,
|
||||
X_FIBO_LEVEL_382,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool hasFiboToUpPressure =
|
||||
fiboDownUp > 0 &&
|
||||
fiboDownUp <= pBar.GetDown();
|
||||
bool hasFiboToDownPressure =
|
||||
fiboUpDown > 0 &&
|
||||
fiboUpDown >= pBar.GetUp();
|
||||
|
||||
//
|
||||
int selectedBoxIDX = -1;
|
||||
for (int j = 0; j < supresBoxesCount; j++)
|
||||
{
|
||||
//
|
||||
double appliedPrice =
|
||||
isBullish
|
||||
? supResBoxes[j].lower
|
||||
: supResBoxes[j].upper;
|
||||
|
||||
//
|
||||
// Check Swing Low ...
|
||||
bool isSwingLow =
|
||||
//
|
||||
pBar.low < ppBar.low &&
|
||||
pBar.low < cBar.low &&
|
||||
zBar.open > pBar.low &&
|
||||
//
|
||||
appliedPrice > pBar.low &&
|
||||
appliedPrice < pBar.GetDown()
|
||||
//
|
||||
;
|
||||
bool isPressuredSwingLow =
|
||||
isSwingLow &&
|
||||
hasFiboToUpPressure;
|
||||
bool isPressuredStrongSwingLow =
|
||||
pBar.IsBullish() &&
|
||||
isPressuredSwingLow;
|
||||
|
||||
//
|
||||
bool isSwingHigh =
|
||||
//
|
||||
pBar.high > ppBar.high &&
|
||||
pBar.high > cBar.high &&
|
||||
zBar.open < pBar.high &&
|
||||
//
|
||||
appliedPrice < pBar.high &&
|
||||
appliedPrice > pBar.GetUp()
|
||||
//
|
||||
;
|
||||
bool isPressuredSwingHigh =
|
||||
isSwingHigh &&
|
||||
hasFiboToDownPressure;
|
||||
bool isPressuredStrongSwingHigh =
|
||||
pBar.IsBearish() &&
|
||||
isPressuredSwingHigh;
|
||||
|
||||
//
|
||||
bool hasValidSwing =
|
||||
isBullish
|
||||
? isSwingLow
|
||||
: isSwingHigh;
|
||||
bool hasValidPressuredSwing =
|
||||
isBullish
|
||||
? isPressuredSwingLow
|
||||
: isPressuredSwingHigh;
|
||||
bool hasValidPressuredStrongSwing =
|
||||
isBullish
|
||||
? isPressuredStrongSwingLow
|
||||
: isPressuredStrongSwingHigh;
|
||||
if (hasValidSwing)
|
||||
{
|
||||
swingBar = pBar;
|
||||
}
|
||||
if (hasValidPressuredSwing)
|
||||
{
|
||||
swingBar = pBar;
|
||||
}
|
||||
if (hasValidPressuredStrongSwing)
|
||||
{
|
||||
swingBar = pBar;
|
||||
}
|
||||
|
||||
//
|
||||
bool isCBarBreaked = IsBarBreak(
|
||||
appliedPrice,
|
||||
forDir,
|
||||
cBar //
|
||||
);
|
||||
if (isCBarBreaked)
|
||||
{
|
||||
breakerBar = cBar;
|
||||
}
|
||||
bool isPBarBreaked = IsBarBreak(
|
||||
appliedPrice,
|
||||
forDir,
|
||||
pBar //
|
||||
);
|
||||
if (!isCBarBreaked && isPBarBreaked)
|
||||
{
|
||||
breakerBar = pBar;
|
||||
}
|
||||
else
|
||||
{
|
||||
isPBarBreaked = false;
|
||||
}
|
||||
bool isPPBarBreaked = IsBarBreak(
|
||||
appliedPrice,
|
||||
forDir,
|
||||
ppBar //
|
||||
);
|
||||
if (!isCBarBreaked &&
|
||||
!isPBarBreaked &&
|
||||
isPPBarBreaked)
|
||||
{
|
||||
breakerBar = ppBar;
|
||||
}
|
||||
else
|
||||
{
|
||||
isPPBarBreaked = false;
|
||||
}
|
||||
bool isBoxBreaked = isCBarBreaked ||
|
||||
isPBarBreaked ||
|
||||
isPPBarBreaked;
|
||||
|
||||
//
|
||||
bool isCBarRejected = IsBarReject(
|
||||
appliedPrice,
|
||||
forDir,
|
||||
cBar //
|
||||
);
|
||||
if (isCBarRejected)
|
||||
{
|
||||
rejectionBar = cBar;
|
||||
}
|
||||
bool isPBarRejected = IsBarReject(
|
||||
appliedPrice,
|
||||
forDir,
|
||||
pBar //
|
||||
);
|
||||
if (!isCBarRejected && isPBarRejected)
|
||||
{
|
||||
rejectionBar = pBar;
|
||||
}
|
||||
else
|
||||
{
|
||||
isPBarRejected = false;
|
||||
}
|
||||
bool isPPBarRejected = IsBarReject(
|
||||
appliedPrice,
|
||||
forDir,
|
||||
ppBar //
|
||||
);
|
||||
if (!isCBarRejected &&
|
||||
!isPBarRejected &&
|
||||
isPPBarRejected)
|
||||
{
|
||||
rejectionBar = ppBar;
|
||||
}
|
||||
else
|
||||
{
|
||||
isPPBarRejected = false;
|
||||
}
|
||||
bool isBoxRejected = isCBarRejected ||
|
||||
isPBarRejected ||
|
||||
isPPBarRejected;
|
||||
|
||||
//
|
||||
bool hasRejectionBar = false;
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
count = state.CountBullishRejectionBars();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *iZone = state.bullishRejectionBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iZone.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = iBar.Index();
|
||||
|
||||
//
|
||||
hasRejectionBar =
|
||||
//
|
||||
(iBarIndex == cBar.Index() ||
|
||||
iBarIndex == pBar.Index())
|
||||
//
|
||||
;
|
||||
if (hasRejectionBar)
|
||||
{
|
||||
//
|
||||
if (!rejectionBar.IsValid())
|
||||
{
|
||||
rejectionBar = iBar;
|
||||
}
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
count = state.CountBearishRejectionBars();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *iZone = state.bearishRejectionBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iZone.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = iBar.Index();
|
||||
|
||||
//
|
||||
hasRejectionBar =
|
||||
//
|
||||
(iBarIndex == cBar.Index() ||
|
||||
iBarIndex == pBar.Index())
|
||||
//
|
||||
;
|
||||
if (hasRejectionBar)
|
||||
{
|
||||
//
|
||||
if (!rejectionBar.IsValid())
|
||||
{
|
||||
rejectionBar = iBar;
|
||||
}
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasMomentumBar = false;
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
count = state.CountBullishMomentumBars();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *iZone = state.bullishMomentumBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iZone.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = iBar.Index();
|
||||
|
||||
//
|
||||
hasMomentumBar =
|
||||
//
|
||||
(iBarIndex == cBar.Index() ||
|
||||
iBarIndex == pBar.Index())
|
||||
//
|
||||
;
|
||||
if (hasMomentumBar)
|
||||
{
|
||||
//
|
||||
if (!momentumBar.IsValid())
|
||||
{
|
||||
momentumBar = iBar;
|
||||
}
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
count = state.CountBearishMomentumBars();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *iZone = state.bearishMomentumBars[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iZone.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = iBar.Index();
|
||||
|
||||
//
|
||||
hasMomentumBar =
|
||||
//
|
||||
(iBarIndex == cBar.Index() ||
|
||||
iBarIndex == pBar.Index())
|
||||
//
|
||||
;
|
||||
if (hasMomentumBar)
|
||||
{
|
||||
//
|
||||
if (!momentumBar.IsValid())
|
||||
{
|
||||
momentumBar = iBar;
|
||||
}
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasSwing = false;
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
count = state.CountSwingLows();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *iSwing = state.swingLows[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iSwing.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = iBar.Index();
|
||||
|
||||
//
|
||||
hasSwing =
|
||||
//
|
||||
(iBarIndex == cBar.Index() ||
|
||||
iBarIndex == pBar.Index())
|
||||
//
|
||||
;
|
||||
if (hasSwing)
|
||||
{
|
||||
//
|
||||
if (!swingBar.IsValid())
|
||||
{
|
||||
swingBar = iBar;
|
||||
}
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
count = state.CountSwingHighs();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *iSwing = state.swingHighs[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = iSwing.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = iBar.Index();
|
||||
|
||||
//
|
||||
hasSwing =
|
||||
//
|
||||
(iBarIndex == cBar.Index() ||
|
||||
iBarIndex == pBar.Index())
|
||||
//
|
||||
;
|
||||
if (hasSwing)
|
||||
{
|
||||
//
|
||||
if (!swingBar.IsValid())
|
||||
{
|
||||
swingBar = iBar;
|
||||
}
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasRequiredValidations =
|
||||
//
|
||||
(hasRejectionBar ||
|
||||
hasMomentumBar)
|
||||
//
|
||||
||
|
||||
//
|
||||
(hasRejectionBar ||
|
||||
hasSwing)
|
||||
//
|
||||
||
|
||||
//
|
||||
(hasMomentumBar ||
|
||||
hasSwing)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
(isBoxBreaked &&
|
||||
(hasRequiredValidations ||
|
||||
hasValidPressuredSwing))
|
||||
//
|
||||
||
|
||||
//
|
||||
(isBoxRejected &&
|
||||
(hasRequiredValidations ||
|
||||
hasValidPressuredSwing))
|
||||
//
|
||||
;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
selectedBoxIDX = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
result &&
|
||||
(isBullish
|
||||
? zBar.open >= box.upper
|
||||
: zBar.open <= box.lower) &&
|
||||
IsValidIndex(selectedBoxIDX);
|
||||
if (result)
|
||||
{
|
||||
appliedBox = supResBoxes[selectedBoxIDX];
|
||||
}
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
ppBar.Clean();
|
||||
Clean(supports);
|
||||
Clean(resistances);
|
||||
Clean(supResBoxes);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
ulong chartID = visionCycleHelper.mPOIDrawer.ChartIdentification();
|
||||
int subWindow = visionCycleHelper.mPOIDrawer.SubWindowIdentification();
|
||||
|
||||
//
|
||||
if (pivot > 0)
|
||||
{
|
||||
//
|
||||
string name = "Pivot_" + symbol + ToString(period) + ToString(pivot) + "_";
|
||||
CChartObjectHLine *iObj;
|
||||
iObj = new CChartObjectHLine();
|
||||
bool isCreated = iObj.Create(
|
||||
chartID,
|
||||
name,
|
||||
subWindow,
|
||||
pivot //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
iObj.Color(clrLime);
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (point > 0)
|
||||
{
|
||||
//
|
||||
string name = "Point_" + symbol + ToString(period) + ToString(pivot) + "_";
|
||||
CChartObjectHLine *iObj;
|
||||
iObj = new CChartObjectHLine();
|
||||
bool isCreated = iObj.Create(
|
||||
chartID,
|
||||
name,
|
||||
subWindow,
|
||||
point //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
iObj.Color(clrLime);
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user