last ...
This commit is contained in:
@@ -1941,145 +1941,67 @@ class XC121SMCCycleHelper : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Pivots ...
|
||||
if (isNewPeak || isNewVale)
|
||||
{
|
||||
//
|
||||
mActivePivot.symbol = symbol;
|
||||
mActivePivot.period = period;
|
||||
// //
|
||||
// // Calculate Pivots ...
|
||||
// if (isNewPeak || isNewVale)
|
||||
// {
|
||||
// //
|
||||
// if (!mActivePivot.IsValid())
|
||||
// {
|
||||
// //
|
||||
// mActivePivot.symbol = symbol;
|
||||
// mActivePivot.period = period;
|
||||
|
||||
//
|
||||
if (!IsValid(mActivePivot.from))
|
||||
{
|
||||
//
|
||||
mActivePivot.from = cTime;
|
||||
// //
|
||||
// mActivePivot.upper = peak;
|
||||
// mActivePivot.lower = vale;
|
||||
|
||||
//
|
||||
Add(
|
||||
PIVOT_STARTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
mActivePivot.to = cTime;
|
||||
// //
|
||||
// mActivePivot.from = cTime;
|
||||
// mActivePivot.to = cTime;
|
||||
|
||||
//
|
||||
if (mActivePivot.upper <= 0)
|
||||
{
|
||||
//
|
||||
if (isNewPeakUnderLast)
|
||||
{
|
||||
mActivePivot.upper = conditions.x121Conditions.peaksBuffer[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
mActivePivot.upper = conditions.x121Conditions.peaksBuffer[1];
|
||||
}
|
||||
}
|
||||
// //
|
||||
// mActivePivot.type =
|
||||
// isNewPeak
|
||||
// ? XPV_VALE
|
||||
// : XPV_PEAK;
|
||||
// mActivePivot.repetition++;
|
||||
|
||||
//
|
||||
if (mActivePivot.lower <= 0)
|
||||
{
|
||||
//
|
||||
if (isNewValeOverLast)
|
||||
{
|
||||
mActivePivot.lower = conditions.x121Conditions.valesBuffer[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
mActivePivot.lower = conditions.x121Conditions.valesBuffer[1];
|
||||
}
|
||||
}
|
||||
// //
|
||||
// Add(
|
||||
// PIVOT_STARTED,
|
||||
// events //
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //
|
||||
// mActivePivot.to = cTime;
|
||||
|
||||
//
|
||||
mActivePivot.type =
|
||||
isNewPeak
|
||||
? XPV_VALE
|
||||
: XPV_PEAK;
|
||||
mActivePivot.repetition++;
|
||||
// //
|
||||
// mActivePivot.repetition++;
|
||||
|
||||
//
|
||||
if (mActivePivot.to > mActivePivot.from)
|
||||
{
|
||||
//
|
||||
FillPivotState(mActivePivot);
|
||||
// //
|
||||
// if (mActivePivot.to > mActivePivot.from)
|
||||
// {
|
||||
// FillPivotState(mActivePivot);
|
||||
// }
|
||||
|
||||
//
|
||||
// Check Active Pivot has State and Ticks Zone ...
|
||||
if (mActivePivot.state.IsValid() &&
|
||||
mActivePivot.state.ticksZone != NULL &&
|
||||
mActivePivot.state.ticksZone.IsValid())
|
||||
{
|
||||
//
|
||||
// Here We Have to Calculate Ticks Level Volume and Percents ...
|
||||
// Liquidity ...
|
||||
|
||||
//
|
||||
// Select Current TickZone which Price is Inside ...
|
||||
int cTZoneIDX = -1;
|
||||
int count = mActivePivot.state.ticksZone.Count();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCTickZone *iTZ = mActivePivot.state.ticksZone.GetZone(i);
|
||||
|
||||
//
|
||||
double pivot =
|
||||
isNewPeak
|
||||
? peak
|
||||
: vale;
|
||||
bool isPivotInsideZone =
|
||||
pivot >= iTZ.low &&
|
||||
pivot <= iTZ.high;
|
||||
if (isPivotInsideZone)
|
||||
{
|
||||
//
|
||||
cTZoneIDX = i;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBarInside =
|
||||
changeBar.low >= iTZ.low &&
|
||||
changeBar.high <= iTZ.high;
|
||||
// if (isBarInside)
|
||||
// {
|
||||
// //
|
||||
// cTZoneIDX = i;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
// Last Zone ...
|
||||
// We Can Break Active Zone ...
|
||||
if (IsValidIndex(cTZoneIDX) && cTZoneIDX == count - 1)
|
||||
{
|
||||
//
|
||||
Print("ZoneIndex: ", cTZoneIDX);
|
||||
|
||||
//
|
||||
AddRef(
|
||||
mActivePivot,
|
||||
mPivots //
|
||||
);
|
||||
|
||||
//
|
||||
Add(
|
||||
PIVOT_ENDED,
|
||||
events //
|
||||
);
|
||||
|
||||
//
|
||||
mActivePivot.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// //
|
||||
// // Check Ticks Zone is Valid ...
|
||||
// bool isTicksZoneValid =
|
||||
// //
|
||||
// mActivePivot.state.IsValid() &&
|
||||
// mActivePivot.state.ticksZone != NULL &&
|
||||
// mActivePivot.state.ticksZone.IsValid()
|
||||
// //
|
||||
// ;
|
||||
// if (isTicksZoneValid) {
|
||||
// //
|
||||
// Print("Has Valid Ticks Zone ...");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user