This commit is contained in:
2024-10-28 05:47:15 +03:30
parent 093e868ba6
commit 2284831018
+244 -26
View File
@@ -479,21 +479,21 @@ class XCX121SMCStrategy : public XSCBaseAlert
// //
bool isSoImportantLong = bool isSoImportantLong =
conditions.demandZone.IsValid() && iConditions.demandZone.IsValid() &&
conditions.bullishFVG.IsValid() && iConditions.bullishFVG.IsValid() &&
conditions.bullishOrderBlock.IsValid(); iConditions.bullishOrderBlock.IsValid();
// //
bool isImportantLong = bool isImportantLong =
conditions.demandZone.IsValid() && iConditions.demandZone.IsValid() &&
(conditions.bullishFVG.IsValid() || (iConditions.bullishFVG.IsValid() ||
conditions.bullishOrderBlock.IsValid()); iConditions.bullishOrderBlock.IsValid());
// //
bool isRiskyLong = bool isRiskyLong =
conditions.demandZone.IsValid() && iConditions.demandZone.IsValid() &&
(conditions.bullishFVG.IsValid() || (iConditions.bullishFVG.IsValid() ||
conditions.bullishOrderBlock.IsValid()); iConditions.bullishOrderBlock.IsValid());
// //
bool hasLongConditions = isSoImportantLong || bool hasLongConditions = isSoImportantLong ||
@@ -511,10 +511,50 @@ class XCX121SMCStrategy : public XSCBaseAlert
// - [] Momentum Bar; // - [] Momentum Bar;
// //
removeIDX = i; // Price Must Breakout the Upper of Demand ...
DrawConditions(conditions); bool isBreakout =
Print("hasLongConditions"); //
// break; cBar.IsBullish() &&
zBar.low > conditions.demandZone.upper &&
cBar.high > conditions.demandZone.upper &&
cBar.close > conditions.demandZone.upper &&
(cBar.open < conditions.demandZone.upper ||
cBar.low < conditions.demandZone.upper)
//
;
//
// Price Must have Bullish Trend and Momentum on Ticks ...
bool isTicksBullishMomentum =
IsTicksBullish() &&
IsTicksHasMomentum();
//
bool hasMpmentumBar =
//
cBar.
//
;
//
hasLongConditions =
hasLongConditions &&
//
isBreakout &&
isTicksBullishMomentum
//
;
//
if (hasLongConditions)
{
//
removeIDX = i;
conditions = iConditions;
DrawConditions(iConditions);
Print("hasLongConditions");
break;
}
} }
// //
@@ -522,21 +562,21 @@ class XCX121SMCStrategy : public XSCBaseAlert
// //
bool isSoImportantShort = bool isSoImportantShort =
conditions.supplyZone.IsValid() && iConditions.supplyZone.IsValid() &&
conditions.bearishFVG.IsValid() && iConditions.bearishFVG.IsValid() &&
conditions.bearishOrderBlock.IsValid(); iConditions.bearishOrderBlock.IsValid();
// //
bool isImportantShort = bool isImportantShort =
conditions.supplyZone.IsValid() && iConditions.supplyZone.IsValid() &&
(conditions.bearishFVG.IsValid() || (iConditions.bearishFVG.IsValid() ||
conditions.bearishOrderBlock.IsValid()); iConditions.bearishOrderBlock.IsValid());
// //
bool isRiskyShort = bool isRiskyShort =
conditions.supplyZone.IsValid() && iConditions.supplyZone.IsValid() &&
(!conditions.bearishFVG.IsValid() && (!iConditions.bearishFVG.IsValid() &&
!conditions.bearishOrderBlock.IsValid()); !iConditions.bearishOrderBlock.IsValid());
// //
bool hasShortConditions = isSoImportantShort || bool hasShortConditions = isSoImportantShort ||
@@ -553,11 +593,14 @@ class XCX121SMCStrategy : public XSCBaseAlert
// - [] Rejection Bar; // - [] Rejection Bar;
// - [] Momentum Bar; // - [] Momentum Bar;
//
// //
removeIDX = i; removeIDX = i;
DrawConditions(conditions); conditions = iConditions;
DrawConditions(iConditions);
Print("hasShortConditions"); Print("hasShortConditions");
// break; break;
} }
// //
@@ -572,7 +615,8 @@ class XCX121SMCStrategy : public XSCBaseAlert
ArrayRemove( ArrayRemove(
mConditions, mConditions,
removeIDX, removeIDX,
1); 1 //
);
} }
// //
@@ -613,8 +657,8 @@ class XCX121SMCStrategy : public XSCBaseAlert
double mVolume; // Static Volume Per Trades ... double mVolume; // Static Volume Per Trades ...
// //
MqlTick mLastTick; // Last Issued Tick ...
XTick mTicks[]; // Hold Ticks Data ... XTick mTicks[]; // Hold Ticks Data ...
MqlTick mLastTick; // Last Issued Tick ...
/** /**
* Cleanup Ticks Size ... * Cleanup Ticks Size ...
@@ -675,6 +719,180 @@ class XCX121SMCStrategy : public XSCBaseAlert
); );
} }
/**
* Calculate Ticks Param for Looping through Last n items ...
*
* @param start: Integer Reference to Start ...
* @param end: Integer Reference to End ...
* @param numOfLastTicks: Integer Max Number of Required N Last Ticks ...
*/
void CalculateTicksParams(
int &start,
int &end,
int numOfLastTicks = 5 //
)
{
//
start = -1;
end = -1;
//
int count = ArraySize(mTicks);
//
start = count - numOfLastTicks;
if (start < 0)
{
start = 0;
}
//
end = start + numOfLastTicks;
if (end > count)
{
end = count;
}
}
/**
* Check Ticks is Bullish or not ...
*
* @return ( bool )
*/
bool IsTicksBullish()
{
//
bool result = false;
//
int start = -1;
int end = -1;
CalculateTicksParams(
start,
end //
);
result = IsValidIndex(start) &&
IsValidIndex(end);
if (!result)
{
return result;
}
//
result = true;
for (int i = start + 1; i < end; i++)
{
//
XTick iTick = mTicks[i];
XTick prevTick = mTicks[i - 1];
//
bool isBullish = iTick.bid >= prevTick.bid;
result = result && isBullish;
if (!result)
{
break;
}
}
//
return result;
}
/**
* Check Ticks is Bearish or not ...
*
* @return ( bool )
*/
bool IsTicksBearish()
{
//
bool result = false;
//
int start = -1;
int end = -1;
CalculateTicksParams(
start,
end //
);
result = IsValidIndex(start) &&
IsValidIndex(end);
if (!result)
{
return result;
}
//
result = true;
for (int i = start + 1; i < end; i++)
{
//
XTick iTick = mTicks[i];
XTick prevTick = mTicks[i - 1];
//
bool isBearish = iTick.bid <= prevTick.bid;
result = result && isBearish;
if (!result)
{
break;
}
}
//
return result;
}
/**
* Check Ticks Has Momentum or not ...
*
* @return ( bool )
*/
bool IsTicksHasMomentum()
{
//
bool result = false;
//
int start = -1;
int end = -1;
CalculateTicksParams(
start,
end //
);
result = IsValidIndex(start) &&
IsValidIndex(end);
if (!result)
{
return result;
}
//
result = true;
int lastDiff = 0;
for (int i = start + 1; i < end; i++)
{
//
XTick iTick = mTicks[i];
XTick prevTick = mTicks[i - 1];
//
int timeDiff = MathAbs((int)iTick.time - (int)prevTick.bid);
result = result && timeDiff >= lastDiff;
if (!result)
{
break;
}
//
lastDiff = timeDiff;
}
//
return result;
}
// //
XBarTracker mBarTracker; // Strategy Time Tracker ... XBarTracker mBarTracker; // Strategy Time Tracker ...