This commit is contained in:
2024-12-23 19:18:55 +03:30
parent 72430436bb
commit 7c4cfd4321
9 changed files with 7465 additions and 428 deletions
@@ -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 ...");
// }
// }
// }
}
//
File diff suppressed because it is too large Load Diff
@@ -487,6 +487,23 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
}
conditions.visionConditions.state = mVisionState;
// //
// XPVPivot triggerPivot;
// mTriggerCycleHelper.GetActivePivot(triggerPivot);
// result = triggerPivot.IsValid();
// if (!result)
// {
// return result;
// }
// //
// ClearDraws();
// DrawPivot(
// triggerPivot,
// true, // Draw State ...
// true // Filter By Price ...
// );
//
return result;
}
@@ -520,123 +537,127 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
string providerStr = ToString(provider);
//
XPVPivot triggerPivot;
mTriggerCycleHelper.GetActivePivot(triggerPivot);
result = triggerPivot.IsValid();
// Detect Setup Conditions ...
datetime setupTime = mTestConditions.setupTime;
bool isSetuped = mTestConditions.IsSetuped();
ENUM_X_DIRECTION setupDir = mTestConditions.dir;
if (!isSetuped)
{
//
// Detect Signal Setup ...
isSetuped = DetectX121SMCTestSiganlSetup(
symbol,
period,
mTestConditions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
result = isSetuped;
if (!result)
{
return result;
}
//
setupDir = mTestConditions.dir;
setupTime = mTestConditions.setupTime;
}
//
// Draw Conditions Active FVG ...
if (isSetuped)
{
//
XCFVG *iFVG = mTestConditions.activeFVG;
if (iFVG != NULL && iFVG.IsValid())
{
//
ClearDraws();
iFVG.To(cTime);
if (IsBullish(setupDir) && iFVG.IsBullish())
{
//
XCBullishFairValueGapObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishFairValueGap(
iFVG,
iObj //
);
if (isCreated)
{
AddObjectIfNotExists(iObj);
}
}
else if (IsBearish(setupDir) && iFVG.IsBearish())
{
//
XCBearishFairValueGapObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishFairValueGap(
iFVG,
iObj //
);
if (isCreated)
{
AddObjectIfNotExists(iObj);
}
}
}
}
//
// Detect Trigger Conditions ...
bool canTrigger = mTestConditions.CanTrigger();
datetime triggerTime = mTestConditions.triggerTime;
if (!canTrigger)
{
//
// Detect Signal Trigger ...
canTrigger = DetectX121SMCTestSiganlTrigger(
mTestConditions,
symbol,
period,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
result = canTrigger;
if (!result)
{
return result;
}
//
triggerTime = mTestConditions.triggerTime;
}
//
// Check Signal Direction ...
//
isBullish = IsBullish(setupDir);
isBearish = IsBearish(setupDir);
result = isBullish ||
isBearish;
if (!result)
{
return result;
}
//
ClearDraws();
DrawPivot(
triggerPivot,
true, // Draw State ...
true // Filter By Price ...
);
//
// Detect Setup Conditions ...
// datetime setupTime = mTestConditions.setupTime;
// bool isSetuped = mTestConditions.IsSetuped();
// ENUM_X_DIRECTION setupDir = mTestConditions.dir;
// if (!isSetuped)
// {
// //
// // Detect Signal Setup ...
// isSetuped = DetectX121SMCTestSiganlSetup(
// symbol,
// period,
// mTestConditions,
// mTriggerCycleHelper,
// mDecisionCycleHelper,
// mAnalyseCycleHelper,
// mVerificationCycleHelper,
// mConsolidationCycleHelper,
// mVisionCycleHelper //
// );
// //
// result = isSetuped;
// if (!result)
// {
// return result;
// }
// //
// setupTime = mTestConditions.setupTime;
// }
// //
// ClearDraws();
// CustomStateDrawing(
// mTriggerState,
// true // Filter By Price ...
// );
//
// Detect Trigger Conditions ...
// bool canTrigger = mTestConditions.CanTrigger();
// datetime triggerTime = mTestConditions.triggerTime;
// result = canTrigger;
// if (!canTrigger)
// {
// //
// // Detect Signal Trigger ...
// canTrigger = DetectX121SMCTestSiganlTrigger(
// mTestConditions,
// symbol,
// period,
// mTriggerCycleHelper,
// mDecisionCycleHelper,
// mAnalyseCycleHelper,
// mVerificationCycleHelper,
// mConsolidationCycleHelper,
// mVisionCycleHelper //
// );
// //
// result = canTrigger;
// if (!result)
// {
// return result;
// }
// //
// triggerTime = mTestConditions.triggerTime;
// }
//
// Check Signal Direction ...
// //
// isBullish = IsBullish(setupDir);
// isBearish = IsBearish(setupDir);
//
// result = isBullish ||
// isBearish;
// if (!result)
// {
// return result;
// }
// //
// if (cTime - setupTime > 2400)
// {
// //
// ClearDraws();
// //
// mTestConditions.Clean();
// }
// //
// // Issues Signal on Conditions ...
// conditions.signalDir = setupDir;
// conditions.provider = providerStr;
// conditions.sl = mTestConditions.sl;
// Issues Signal on Conditions ...
conditions.signalDir = setupDir;
conditions.provider = providerStr;
conditions.sl = mTestConditions.sl;
//
mTestConditions.Clean();