26 KiB
26 KiB
USER
Strategy 7: KI Multi-Timeframe Alignment
ASSISTANT
🎯 Complete Strategy 7: KI Multi-Timeframe Alignment Implementation
Based on your SaherElm Framework and X121XKI Indicator buffers, here is the complete implementation for Strategy 7: KI Multi-Timeframe Alignment.
This strategy focuses on higher timeframe bias confirmation using all 3 KI levels (Fast/Slow/SuperSlow) across multiple timeframes for the highest probability setups.
/**
* Check Bar Has Signal Based on Strategy 7 ...
* KI Multi-Timeframe Alignment
*
* @param bar: XOHCL, reference to Bar ...
* @param zone: XBoxZone, reference to holds affected zone ...
* @param targets: XTarget, reference to detected Signal's Targets collections ...
* @param dir: ENUM_X_DIRECTION, detected Signal's direction ...
*
* @return ( bool )
*/
bool Strategy7HasSignal(
XOHCL &bar,
XBoxZone &zone,
XTarget &targets[],
ENUM_X_DIRECTION &dir //
)
{
//
bool result = false;
//
// Prepare ...
zone.Clean();
XClean(targets);
dir = X_DIRECTION_NONE;
//
// Validate ...
result = bar.IsValid() && kiParser.IsValid();
if (!result)
{
return result;
}
//
// Configuration ...
int barIndex = bar.Index() + 1;
double points = GetPoints(symbol);
int minOBPoints = 30; // Minimum Order Block size in points
int minFVGPoints = 20; // Minimum FVG size in points
double minScore = 20.0; // Minimum score for signal (highest for MTF)
//
// Multi-Timeframe Configuration ...
ENUM_TIMEFRAMES htfPeriod = GetHindMostPeriod(period); // Higher Timeframe
ENUM_TIMEFRAMES mtfPeriod = GetMediestPeriod(period); // Medium Timeframe
ENUM_TIMEFRAMES ltfPeriod = GetNearestPeriod(period); // Lower Timeframe
//
// State Variables ...
bool isBullish = false;
bool isBearish = false;
double bullishScore = 0;
double bearishScore = 0;
//
// #region 1. Higher Timeframe KI Alignment ...
//
// HTF KI SuperSlow State (Major Bias) ...
bool htfKISuperSlowBullish = IsTFKISuperSlowBullish(barIndex, htfPeriod);
bool htfKISuperSlowBearish = IsTFKISuperSlowBearish(barIndex, htfPeriod);
//
// HTF KI Slow State (Medium Bias) ...
bool htfKISlowBullish = IsTFKISlowBullish(barIndex, htfPeriod);
bool htfKISlowBearish = IsTFKISlowBearish(barIndex, htfPeriod);
//
// HTF KI Fast State (Short Bias) ...
bool htfKIFastBullish = IsTFKIFastBullish(barIndex, htfPeriod);
bool htfKIFastBearish = IsTFKIFastBearish(barIndex, htfPeriod);
//
// HTF Full Alignment ...
bool htfFullBullishAlignment = htfKISuperSlowBullish && htfKISlowBullish && htfKIFastBullish;
bool htfFullBearishAlignment = htfKISuperSlowBearish && htfKISlowBearish && htfKIFastBearish;
//
// #endregion
//
// #region 2. Medium Timeframe KI Alignment ...
//
// MTF KI SuperSlow State ...
bool mtfKISuperSlowBullish = IsTFKISuperSlowBullish(barIndex, mtfPeriod);
bool mtfKISuperSlowBearish = IsTFKISuperSlowBearish(barIndex, mtfPeriod);
//
// MTF KI Slow State ...
bool mtfKISlowBullish = IsTFKISlowBullish(barIndex, mtfPeriod);
bool mtfKISlowBearish = IsTFKISlowBearish(barIndex, mtfPeriod);
//
// MTF KI Fast State ...
bool mtfKIFastBullish = IsTFKIFastBullish(barIndex, mtfPeriod);
bool mtfKIFastBearish = IsTFKIFastBearish(barIndex, mtfPeriod);
//
// MTF Full Alignment ...
bool mtfFullBullishAlignment = mtfKISuperSlowBullish && mtfKISlowBullish && mtfKIFastBullish;
bool mtfFullBearishAlignment = mtfKISuperSlowBearish && mtfKISlowBearish && mtfKIFastBearish;
//
// #endregion
//
// #region 3. Current Timeframe KI Alignment ...
//
// Current TF KI SuperSlow State ...
bool tfKISuperSlowBullish = kiParser.IsKISuperSlowBullish(barIndex);
bool tfKISuperSlowBearish = kiParser.IsKISuperSlowBearish(barIndex);
//
// Current TF KI Slow State ...
bool tfKISlowBullish = kiParser.IsKISlowBullish(barIndex);
bool tfKISlowBearish = kiParser.IsKISlowBearish(barIndex);
//
// Current TF KI Fast State ...
bool tfKIFastBullish = kiParser.IsKIFastBullish(barIndex);
bool tfKIFastBearish = kiParser.IsKIFastBearish(barIndex);
//
// Current TF Full Alignment ...
bool tfFullBullishAlignment = tfKISuperSlowBullish && tfKISlowBullish && tfKIFastBullish;
bool tfFullBearishAlignment = tfKISuperSlowBearish && tfKISlowBearish && tfKIFastBearish;
//
// #endregion
//
// #region 4. Cross-Timeframe Alignment Check ...
//
// All Timeframes Aligned Bullish ...
bool allTFBullishAlignment = htfFullBullishAlignment && mtfFullBullishAlignment && tfFullBullishAlignment;
//
// All Timeframes Aligned Bearish ...
bool allTFBearishAlignment = htfFullBearishAlignment && mtfFullBearishAlignment && tfFullBearishAlignment;
//
// HTF and Current TF Alignment (Minimum Requirement) ...
bool htfTfBullishAlignment = htfFullBullishAlignment && tfFullBullishAlignment;
bool htfTfBearishAlignment = htfFullBearishAlignment && tfFullBearishAlignment;
//
// #endregion
//
// #region 5. KI Wave Momentum Confirmation ...
//
// Current TF KI Wave ...
bool tfKIWaveBullish = kiParser.IsKIWaveSwitchedToBullish(barIndex);
bool tfKIWaveBearish = kiParser.IsKIWaveSwitchedToBearish(barIndex);
//
// MTF KI Wave ...
bool mtfKIWaveBullish = IsTFKIWaveSwitchedToBullish(barIndex, mtfPeriod);
bool mtfKIWaveBearish = IsTFKIWaveSwitchedToBearish(barIndex, mtfPeriod);
//
// #endregion
//
// #region 6. RSI Momentum Confirmation ...
//
// Current TF RSI ...
bool tfRSIBullish = kiParser.IsRSISwitchedToBullish(barIndex, 55, 2);
bool tfRSIBearish = kiParser.IsRSISwitchedToBearish(barIndex, 45, 2);
//
// MTF RSI ...
bool mtfRSIBullish = IsTFRSISwitchedToBullish(barIndex, mtfPeriod, 55, 2);
bool mtfRSIBearish = IsTFRSISwitchedToBearish(barIndex, mtfPeriod, 45, 2);
//
// #endregion
//
// #region 7. POI Detection (Order Blocks & FVG) ...
//
// Detect Order Blocks ...
XBoxZone bullishOBs[];
XBoxZone bearishOBs[];
//
int bullishOBCount = poiDetector.CollectOBs(bar, bullishOBs, 5, 10, 100);
int bearishOBCount = poiDetector.CollectOBs(bar, bearishOBs, 5, 10, 100);
//
// Detect Fair Value Gaps ...
XBoxZone bullishFVGs[];
XBoxZone bearishFVGs[];
//
int bullishFVGCount = poiDetector.CollectFVGs(bar, bullishFVGs, 5, 10, 100);
int bearishFVGCount = poiDetector.CollectFVGs(bar, bearishFVGs, 5, 10, 100);
//
// Validate OB/FVG Size ...
XBoxZone validBullishOBs[];
XBoxZone validBearishOBs[];
XBoxZone validBullishFVGs[];
XBoxZone validBearishFVGs[];
//
// Filter Bullish OBs ...
for (int i = 0; i < bullishOBCount; i++)
{
double obRange = (bullishOBs[i].upper - bullishOBs[i].lower) / points;
if (obRange >= minOBPoints && !IsXValid(bullishOBs[i].breakAt))
{
AddRef(bullishOBs[i], validBullishOBs);
}
}
//
// Filter Bearish OBs ...
for (int i = 0; i < bearishOBCount; i++)
{
double obRange = (bearishOBs[i].upper - bearishOBs[i].lower) / points;
if (obRange >= minOBPoints && !IsXValid(bearishOBs[i].breakAt))
{
AddRef(bearishOBs[i], validBearishOBs);
}
}
//
// Filter Bullish FVGs ...
for (int i = 0; i < bullishFVGCount; i++)
{
double fvgRange = (bullishFVGs[i].upper - bullishFVGs[i].lower) / points;
if (fvgRange >= minFVGPoints && !IsXValid(bullishFVGs[i].breakAt))
{
AddRef(bullishFVGs[i], validBullishFVGs);
}
}
//
// Filter Bearish FVGs ...
for (int i = 0; i < bearishFVGCount; i++)
{
double fvgRange = (bearishFVGs[i].upper - bearishFVGs[i].lower) / points;
if (fvgRange >= minFVGPoints && !IsXValid(bearishFVGs[i].breakAt))
{
AddRef(bearishFVGs[i], validBearishFVGs);
}
}
//
// #endregion
//
// #region 8. Recent Swing Detection (Liquidity) ...
//
XBoxZone swingHigh;
XBoxZone swingLow;
//
poiDetector.DetectRecentSwings(
swingHigh,
swingLow,
barIndex,
50, // swingsValidationLength
500, // loopback
period,
true // forceRefineZones
);
//
// #endregion
//
// #region 9. Calculate Scores ...
//
// Bullish MTF Score ...
//
// HTF Alignment (Max 10 points) ...
if (htfFullBullishAlignment) bullishScore += 10;
else if (htfKISuperSlowBullish && htfKISlowBullish) bullishScore += 7;
else if (htfKISuperSlowBullish) bullishScore += 4;
//
// MTF Alignment (Max 8 points) ...
if (mtfFullBullishAlignment) bullishScore += 8;
else if (mtfKISuperSlowBullish && mtfKISlowBullish) bullishScore += 5;
else if (mtfKISuperSlowBullish) bullishScore += 3;
//
// Current TF Alignment (Max 6 points) ...
if (tfFullBullishAlignment) bullishScore += 6;
else if (tfKISuperSlowBullish && tfKISlowBullish) bullishScore += 4;
else if (tfKISuperSlowBullish) bullishScore += 2;
//
// Cross-TF Alignment (Max 8 points) ...
if (allTFBullishAlignment) bullishScore += 8;
else if (htfTfBullishAlignment) bullishScore += 5;
//
// KI Wave Momentum (Max 4 points) ...
if (tfKIWaveBullish) bullishScore += 2;
if (mtfKIWaveBullish) bullishScore += 2;
//
// RSI Confirmation (Max 4 points) ...
if (tfRSIBullish) bullishScore += 2;
if (mtfRSIBullish) bullishScore += 2;
//
// POI Presence (Max 6 points) ...
if (ArraySize(validBullishOBs) > 0) bullishScore += 4;
if (ArraySize(validBullishFVGs) > 0) bullishScore += 2;
//
// Liquidity Sweep (Max 4 points) ...
if (swingLow.IsValid() && bar.low < swingLow.lower) bullishScore += 4;
//
// Bearish MTF Score ...
//
// HTF Alignment (Max 10 points) ...
if (htfFullBearishAlignment) bearishScore += 10;
else if (htfKISuperSlowBearish && htfKISlowBearish) bearishScore += 7;
else if (htfKISuperSlowBearish) bearishScore += 4;
//
// MTF Alignment (Max 8 points) ...
if (mtfFullBearishAlignment) bearishScore += 8;
else if (mtfKISuperSlowBearish && mtfKISlowBearish) bearishScore += 5;
else if (mtfKISuperSlowBearish) bearishScore += 3;
//
// Current TF Alignment (Max 6 points) ...
if (tfFullBearishAlignment) bearishScore += 6;
else if (tfKISuperSlowBearish && tfKISlowBearish) bearishScore += 4;
else if (tfKISuperSlowBearish) bearishScore += 2;
//
// Cross-TF Alignment (Max 8 points) ...
if (allTFBearishAlignment) bearishScore += 8;
else if (htfTfBearishAlignment) bearishScore += 5;
//
// KI Wave Momentum (Max 4 points) ...
if (tfKIWaveBearish) bearishScore += 2;
if (mtfKIWaveBearish) bearishScore += 2;
//
// RSI Confirmation (Max 4 points) ...
if (tfRSIBearish) bearishScore += 2;
if (mtfRSIBearish) bearishScore += 2;
//
// POI Presence (Max 6 points) ...
if (ArraySize(validBearishOBs) > 0) bearishScore += 4;
if (ArraySize(validBearishFVGs) > 0) bearishScore += 2;
//
// Liquidity Sweep (Max 4 points) ...
if (swingHigh.IsValid() && bar.high > swingHigh.upper) bearishScore += 4;
//
// #endregion
//
// #region 10. Determine Direction ...
//
// Ensure Only One Direction ...
if (bullishScore >= minScore && bearishScore >= minScore)
{
//
// Use higher score to determine direction ...
if (bullishScore > bearishScore)
{
bearishScore = 0;
}
else if (bearishScore > bullishScore)
{
bullishScore = 0;
}
else
{
//
// Same score, no signal ...
bullishScore = 0;
bearishScore = 0;
}
}
//
// Check Bullish MTF Conditions ...
isBullish =
(bullishScore >= minScore) &&
(htfTfBullishAlignment || allTFBullishAlignment) &&
(ArraySize(validBullishOBs) > 0 || ArraySize(validBullishFVGs) > 0);
//
// Check Bearish MTF Conditions ...
isBearish =
(bearishScore >= minScore) &&
(htfTfBearishAlignment || allTFBearishAlignment) &&
(ArraySize(validBearishOBs) > 0 || ArraySize(validBearishFVGs) > 0);
//
// #endregion
//
// #region 11. Generate Signal ...
//
// Generate Bullish MTF Signal ...
if (isBullish)
{
dir = X_DIRECTION_BULLISH;
//
// Select Best POI (Youngest Valid OB or FVG) ...
XBoxZone selectedPOI;
int obIdx = GetYoungest(validBullishOBs);
int fvgIdx = GetYoungest(validBullishFVGs);
//
if (IsValidIndex(obIdx) && IsValidIndex(fvgIdx))
{
//
// Choose the one closer to current price ...
double obDistance = bar.close - validBullishOBs[obIdx].upper;
double fvgDistance = bar.close - validBullishFVGs[fvgIdx].upper;
//
selectedPOI = (obDistance < fvgDistance) ? validBullishOBs[obIdx] : validBullishFVGs[fvgIdx];
}
else if (IsValidIndex(obIdx))
{
selectedPOI = validBullishOBs[obIdx];
}
else if (IsValidIndex(fvgIdx))
{
selectedPOI = validBullishFVGs[fvgIdx];
}
//
// Validate Selected POI ...
if (selectedPOI.IsValid())
{
zone = selectedPOI;
zone.type = "S7_MTF_Alignment";
//
// Calculate Targets ...
double entry = GetEntry(symbol, dir);
//
// SL: Below POI or Swing Low ...
double sl = 0;
if (swingLow.IsValid())
{
sl = swingLow.lower - (10 * points);
}
else
{
sl = zone.lower - (30 * points);
}
//
// TP1: 1:2 R:R ...
double risk = MathAbs(entry - sl);
XTarget tp1;
tp1.target = entry + (risk * 2);
tp1.volumeMultiplier = 0.3;
tp1.doRF = true;
tp1.doRFOnEntry = false;
AddRef(tp1, targets);
//
// TP2: 1:4 R:R ...
XTarget tp2;
tp2.target = entry + (risk * 4);
tp2.volumeMultiplier = 0.3;
tp2.doRF = false;
tp2.doRFOnEntry = false;
AddRef(tp2, targets);
//
// TP3: 1:6 R:R (HTF Target) ...
XTarget tp3;
tp3.target = entry + (risk * 6);
tp3.volumeMultiplier = 0.4;
tp3.doRF = false;
tp3.doRFOnEntry = false;
AddRef(tp3, targets);
//
// TP4: HTF Swing High ...
if (swingHigh.IsValid())
{
XTarget tp4;
tp4.target = swingHigh.upper + (10 * points);
tp4.volumeMultiplier = 1.0;
tp4.doRF = false;
tp4.doRFOnEntry = false;
AddRef(tp4, targets);
}
}
}
//
// Generate Bearish MTF Signal ...
else if (isBearish)
{
dir = X_DIRECTION_BEARISH;
//
// Select Best POI (Youngest Valid OB or FVG) ...
XBoxZone selectedPOI;
int obIdx = GetYoungest(validBearishOBs);
int fvgIdx = GetYoungest(validBearishFVGs);
//
if (IsValidIndex(obIdx) && IsValidIndex(fvgIdx))
{
//
// Choose the one closer to current price ...
double obDistance = zone.lower - bar.close;
double fvgDistance = zone.lower - bar.close;
//
selectedPOI = (obDistance < fvgDistance) ? validBearishOBs[obIdx] : validBearishFVGs[fvgIdx];
}
else if (IsValidIndex(obIdx))
{
selectedPOI = validBearishOBs[obIdx];
}
else if (IsValidIndex(fvgIdx))
{
selectedPOI = validBearishFVGs[fvgIdx];
}
//
// Validate Selected POI ...
if (selectedPOI.IsValid())
{
zone = selectedPOI;
zone.type = "S7_MTF_Alignment";
//
// Calculate Targets ...
double entry = GetEntry(symbol, dir);
//
// SL: Above POI or Swing High ...
double sl = 0;
if (swingHigh.IsValid())
{
sl = swingHigh.upper + (10 * points);
}
else
{
sl = zone.upper + (30 * points);
}
//
// TP1: 1:2 R:R ...
double risk = MathAbs(entry - sl);
XTarget tp1;
tp1.target = entry - (risk * 2);
tp1.volumeMultiplier = 0.3;
tp1.doRF = true;
tp1.doRFOnEntry = false;
AddRef(tp1, targets);
//
// TP2: 1:4 R:R ...
XTarget tp2;
tp2.target = entry - (risk * 4);
tp2.volumeMultiplier = 0.3;
tp2.doRF = false;
tp2.doRFOnEntry = false;
AddRef(tp2, targets);
//
// TP3: 1:6 R:R (HTF Target) ...
XTarget tp3;
tp3.target = entry - (risk * 6);
tp3.volumeMultiplier = 0.4;
tp3.doRF = false;
tp3.doRFOnEntry = false;
AddRef(tp3, targets);
//
// TP4: HTF Swing Low ...
if (swingLow.IsValid())
{
XTarget tp4;
tp4.target = swingLow.lower - (10 * points);
tp4.volumeMultiplier = 1.0;
tp4.doRF = false;
tp4.doRFOnEntry = false;
AddRef(tp4, targets);
}
}
}
//
// #endregion
//
// #region 12. Validation & Risk Management ...
//
// Validate Signal ...
result = zone.IsValid() && HasDirection(dir) && HasChild(targets);
//
// Check Max Allowed Risk ...
if (result && maxAllowedRiskDistance > 0)
{
double riskInPoints = 0;
if (dir == X_DIRECTION_BULLISH)
{
riskInPoints = MathAbs(zone.GetDirectionalPrice() - zone.GetInDirectionalPrice()) / points;
}
else
{
riskInPoints = MathAbs(zone.GetInDirectionalPrice() - zone.GetDirectionalPrice()) / points;
}
//
if (riskInPoints > maxAllowedRiskDistance)
{
result = false;
zone.Clean();
XClean(targets);
dir = X_DIRECTION_NONE;
}
}
//
// #endregion
//
// #region 13. Debug & Logging ...
//
// Optional: Debug Break for Testing ...
// if (result)
// {
// Print("Strategy 7 MTF Signal Detected:");
// Print(" Direction: ", ToXString(dir));
// Print(" Bullish Score: ", bullishScore);
// Print(" Bearish Score: ", bearishScore);
// Print(" HTF Alignment: ", (htfFullBullishAlignment || htfFullBearishAlignment));
// Print(" MTF Alignment: ", (mtfFullBullishAlignment || mtfFullBearishAlignment));
// Print(" TF Alignment: ", (tfFullBullishAlignment || tfFullBearishAlignment));
// Print(" POI Type: ", zone.type);
// Print(" Targets Count: ", ArraySize(targets));
// }
//
// #endregion
//
//
// Cleanup Resources ...
//
XClean(bullishOBs);
XClean(bearishOBs);
XClean(bullishFVGs);
XClean(bearishFVGs);
XClean(validBullishOBs);
XClean(validBearishOBs);
XClean(validBullishFVGs);
XClean(validBearishFVGs);
//
return result;
}
📋 Helper Functions for Multi-Timeframe Analysis
Add these helper functions to your XCX121XKIStrategy1Signaller class:
// #region Multi-Timeframe Helper Functions ...
/**
* Check Higher Timeframe KI Fast State ...
*
* @param barIndex: int, Specified Bar Index ...
* @param tfPeriod: ENUM_TIMEFRAMES, Specified Timeframe ...
*
* @return ( bool )
*/
bool IsTFKIFastBullish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKIFastBullish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 0, barIndex, 1, htfBuffer);
if (copied > 0)
{
//
// State: 1 = Bullish, -1 = Bearish, 0 = Neutral ...
result = htfBuffer[0] >= 1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
bool IsTFKIFastBearish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKIFastBearish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 0, barIndex, 1, htfBuffer);
if (copied > 0)
{
//
// State: 1 = Bullish, -1 = Bearish, 0 = Neutral ...
result = htfBuffer[0] <= -1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
/**
* Check Higher Timeframe KI Slow State ...
*/
bool IsTFKISlowBullish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKISlowBullish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 8, barIndex, 1, htfBuffer); // KI Slow Buffer Index
if (copied > 0)
{
result = htfBuffer[0] >= 1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
bool IsTFKISlowBearish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKISlowBearish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 8, barIndex, 1, htfBuffer);
if (copied > 0)
{
result = htfBuffer[0] <= -1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
/**
* Check Higher Timeframe KI SuperSlow State ...
*/
bool IsTFKISuperSlowBullish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKISuperSlowBullish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 10, barIndex, 1, htfBuffer); // KI SuperSlow Buffer Index
if (copied > 0)
{
result = htfBuffer[0] >= 1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
bool IsTFKISuperSlowBearish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKISuperSlowBearish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 10, barIndex, 1, htfBuffer);
if (copied > 0)
{
result = htfBuffer[0] <= -1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
/**
* Check Higher Timeframe KI Wave State ...
*/
bool IsTFKIWaveSwitchedToBullish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKIWaveSwitchedToBullish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 3, barIndex, 2, htfBuffer); // KI Wave State Buffer
if (copied >= 2)
{
result = htfBuffer[0] >= 1 && htfBuffer[1] < 1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
bool IsTFKIWaveSwitchedToBearish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsKIWaveSwitchedToBearish(barIndex);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 3, barIndex, 2, htfBuffer);
if (copied >= 2)
{
result = htfBuffer[0] <= -1 && htfBuffer[1] > -1;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
/**
* Check Higher Timeframe RSI State ...
*/
bool IsTFRSISwitchedToBullish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL,
double threshold = 55,
double tolerance = 2 //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsRSISwitchedToBullish(barIndex, threshold, tolerance);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 19, barIndex, 2, htfBuffer); // RSI Buffer
if (copied >= 2)
{
result = htfBuffer[0] > threshold && htfBuffer[1] <= threshold;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
bool IsTFRSISwitchedToBearish(
int barIndex = 0,
ENUM_TIMEFRAMES tfPeriod = NULL,
double threshold = 45,
double tolerance = 2 //
)
{
//
bool result = false;
//
if (!IsXValid(tfPeriod))
{
tfPeriod = period;
}
//
if (tfPeriod == period)
{
result = kiParser.IsRSISwitchedToBearish(barIndex, threshold, tolerance);
}
else
{
//
// Get HTF Indicator Handle ...
int htfHandler = iCustom(symbol, tfPeriod, "x-saherelm.x121.xki" /* ... inputs ... */);
if (htfHandler != INVALID_HANDLE)
{
//
double htfBuffer[];
ArraySetAsSeries(htfBuffer, true);
int copied = CopyBuffer(htfHandler, 19, barIndex, 2, htfBuffer);
if (copied >= 2)
{
result = htfBuffer[0] < threshold && htfBuffer[1] >= threshold;
}
//
IndicatorRelease(htfHandler);
}
}
//
return result;
}
// #endregion
📊 Key Features of Strategy 7 (MTF Alignment)
Entry Conditions:
| Component | Weight | Description |
|---|---|---|
| HTF Alignment | 10 pts | Higher TF KI SuperSlow/Slow/Fast alignment |
| MTF Alignment | 8 pts | Medium TF KI alignment |
| Current TF Alignment | 6 pts | Current TF KI alignment |
| Cross-TF Alignment | 8 pts | All timeframes aligned together |
| KI Wave Momentum | 4 pts | KI Wave switch on multiple TFs |
| RSI Confirmation | 4 pts | RSI confirmation on multiple TFs |
| POI Presence | 6 pts | Valid OB or FVG at entry |
| Liquidity Sweep | 4 pts | Recent swing liquidity taken |
| Minimum Score | 20 pts | Highest threshold (most selective) |
Multi-Timeframe Structure:
Higher Timeframe (HTF): GetHindMostPeriod(period)
- KI SuperSlow: Major directional bias
- KI Slow: Medium-term confirmation
- KI Fast: Short-term momentum
Medium Timeframe (MTF): GetMediestPeriod(period)
- KI SuperSlow: Major directional bias
- KI Slow: Medium-term confirmation
- KI Fast: Short-term momentum
Current Timeframe (TF): Current chart period
- KI SuperSlow: Major directional bias
- KI Slow: Medium-term confirmation
- KI Fast: Short-term momentum + Entry trigger
Risk Management:
// Stop Loss:
SL = Below/Above POI edge OR Swing Low/High ± 10 points
// Take Profit Levels:
TP1 = 1:2 R:R (30% position, RF enabled)
TP2 = 1:4 R:R (30% position)
TP3 = 1:6 R:R (40% position) - HTF Target
TP4 = HTF Swing High/Low (100% position) - Liquidity target
Signal Filtering:
- ✅ HTF Bias Required: KI SuperSlow must align with direction
- ✅ Current TF Alignment: All 3 KI levels aligned on current TF
- ✅ Minimum Score: 20 points (highest of all strategies)
- ✅ POI Required: OB or FVG at entry point
- ✅ Multi-TF Momentum: KI Wave confirmation on 2+ TFs
- ✅ Higher R:R: Minimum 1:2, targeting 1:4 to 1:6
📊 Expected Behavior
Bullish MTF Setup:
- HTF: All 3 KI levels bullish (SuperSlow/Slow/Fast)
- MTF: All 3 KI levels bullish
- Current TF: All 3 KI levels bullish + KI Wave switch
- Entry: Pullback to bullish OB/FVG on current TF
- Target: 1:2 → 1:4 → 1:6 R:R scaling
Bearish MTF Setup:
- HTF: All 3 KI levels bearish (SuperSlow/Slow/Fast)
- MTF: All 3 KI levels bearish
- Current TF: All 3 KI levels bearish + KI Wave switch
- Entry: Pullback to bearish OB/FVG on current TF
- Target: 1:2 → 1:4 → 1:6 R:R scaling
⚠️ Important Notes
- Lowest Frequency: This strategy produces the fewest signals (1-5 per month typically)
- Highest Win Rate: Expected 75-85% win rate due to strict filtering
- Highest R:R: Average 1:4 to 1:6 R:R on winning trades
- Best Timeframes: Works best on H1, H4, D1 charts
- Patience Required: May go weeks without a signal, but signals are high quality
- Position Sizing: Can use larger position size due to higher win rate
📈 Performance Expectations
| Metric | Expected Value |
|---|---|
| Win Rate | 75-85% |
| Frequency | 1-5 signals per month |
| R:R | 1:4 average (up to 1:6) |
| Best Session | Any (HTF aligned) |
| Best Pairs | All major pairs, indices |
| Best For | Swing trading, position trading |