complete support and resistance zones ...

This commit is contained in:
2025-03-17 21:42:38 +03:30
parent b8eaf9ffa8
commit 48c78e1256
3 changed files with 104 additions and 88 deletions
+81 -66
View File
@@ -229,7 +229,7 @@ class XCBarAnalyser : public XCBase
// //
bool has = IsValid(type) && bool has = IsValid(type) &&
bar.IsValid(); bar.IsValid();
if (!has) if (!has)
{ {
return result; return result;
@@ -1033,22 +1033,12 @@ class XCBarAnalyser : public XCBase
} }
// //
int barIndex = bar.Index() + range; int supportIDX = bar.Index() + range;
result = IsValidIndex(barIndex);
if (!result)
{
//
supportBar.Clean();
return result;
}
result = supportBar.Init( result = supportBar.Init(
bar.symbol, bar.symbol,
bar.period, bar.period,
barIndex // supportIDX //
); );
//
result = supportBar.low < supportBar.GetDown();
if (!result) if (!result)
{ {
// //
@@ -1057,11 +1047,7 @@ class XCBarAnalyser : public XCBase
} }
// //
double selectedValue = supportBar.GetDown(); result = bar.low > supportBar.low;
//
int llIDX = bar.FindLowestIndex(range - 1, MODE_LOW);
result = IsValidIndex(llIDX);
if (!result) if (!result)
{ {
// //
@@ -1070,23 +1056,46 @@ class XCBarAnalyser : public XCBase
} }
// //
double llValue = iLow( // Validate Point ...
bar.symbol, for (int i = 1; i < range; i++)
bar.period,
llIDX //
);
//
result = llValue >= selectedValue;
if (!result)
{ {
// //
supportBar.Clean(); XOHCL iPBar;
return result; XOHCL iNBar;
} bool iHas = false;
// //
result = supportBar.IsValid(); iHas = iPBar.Init(
bar.symbol,
bar.period,
supportIDX + i //
);
result = iHas;
if (!result)
{
break;
}
//
iHas = iNBar.Init(
bar.symbol,
bar.period,
supportIDX - i //
);
result = iHas;
if (!result)
{
break;
}
//
result = supportBar.low < iPBar.low &&
supportBar.low < iNBar.low;
if (!result)
{
break;
}
}
// //
return result; return result;
@@ -1110,9 +1119,6 @@ class XCBarAnalyser : public XCBase
// //
bool result = false; bool result = false;
//
resistanceBar.Clean();
// //
result = bar.IsValid(); result = bar.IsValid();
if (!result) if (!result)
@@ -1121,22 +1127,12 @@ class XCBarAnalyser : public XCBase
} }
// //
int barIndex = bar.Index() + range; int resistanceIDX = bar.Index() + range;
result = IsValidIndex(barIndex);
if (!result)
{
//
resistanceBar.Clean();
return result;
}
result = resistanceBar.Init( result = resistanceBar.Init(
bar.symbol, bar.symbol,
bar.period, bar.period,
barIndex // resistanceIDX //
); );
//
result = resistanceBar.low < resistanceBar.GetDown();
if (!result) if (!result)
{ {
// //
@@ -1145,11 +1141,7 @@ class XCBarAnalyser : public XCBase
} }
// //
double selectedValue = resistanceBar.GetUp(); result = bar.high < resistanceBar.high;
//
int hhIDX = bar.FindHighestIndex(range - 1, MODE_HIGH);
result = IsValidIndex(hhIDX);
if (!result) if (!result)
{ {
// //
@@ -1158,23 +1150,46 @@ class XCBarAnalyser : public XCBase
} }
// //
double hhValue = iHigh( // Validate Point ...
bar.symbol, for (int i = 1; i < range; i++)
bar.period,
hhIDX //
);
//
result = hhValue >= selectedValue;
if (!result)
{ {
// //
resistanceBar.Clean(); XOHCL iPBar;
return result; XOHCL iNBar;
} bool iHas = false;
// //
result = resistanceBar.IsValid(); iHas = iPBar.Init(
bar.symbol,
bar.period,
resistanceIDX + i //
);
result = iHas;
if (!result)
{
break;
}
//
iHas = iNBar.Init(
bar.symbol,
bar.period,
resistanceIDX - i //
);
result = iHas;
if (!result)
{
break;
}
//
result = resistanceBar.high > iPBar.high &&
resistanceBar.high > iNBar.high;
if (!result)
{
break;
}
}
// //
return result; return result;
+16 -16
View File
@@ -832,17 +832,17 @@ class XCPOIDetector : public XCBaseAlert
// //
// Support ... // Support ...
// DetectSupportZone( DetectSupportZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
// //
// Resistance ... // Resistance ...
// DetectResistanceZone( DetectResistanceZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
// //
// Supply ... // Supply ...
@@ -1051,10 +1051,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// Support ... // Support ...
// has = DetectSupportZone( has = DetectSupportZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
if (has) if (has)
{ {
// //
@@ -1066,10 +1066,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// Resistance ... // Resistance ...
// has = DetectResistanceZone( has = DetectResistanceZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
if (has) if (has)
{ {
// //
+7 -6
View File
@@ -344,10 +344,10 @@ void DetectPOIState()
// Bullish ... // Bullish ...
showBullishPOIs && true, // SwingLows showBullishPOIs && true, // SwingLows
showBullishPOIs && true, // DemandZones showBullishPOIs && true, // DemandZones
showBullishPOIs && true, // SupportZones showBullishPOIs && false, // SupportZones
showBullishPOIs && true, // BullishSharps showBullishPOIs && true, // BullishSharps
showBullishPOIs && true, // BullishSpikes showBullishPOIs && true, // BullishSpikes
showBullishPOIs && false, // BullishPullbacks showBullishPOIs && true, // BullishPullbacks
showBullishPOIs && true, // BullishMomentums showBullishPOIs && true, // BullishMomentums
showBullishPOIs && true, // BullishRejections showBullishPOIs && true, // BullishRejections
showBullishPOIs && true, // BullishOrderBlocks showBullishPOIs && true, // BullishOrderBlocks
@@ -357,10 +357,10 @@ void DetectPOIState()
// Bearish ... // Bearish ...
showBearishPOIs && true, // SwingHighs showBearishPOIs && true, // SwingHighs
showBearishPOIs && true, // SupplyZones showBearishPOIs && true, // SupplyZones
showBearishPOIs && true, // ResistanceZones showBearishPOIs && false, // ResistanceZones
showBearishPOIs && true, // BearishSharps showBearishPOIs && true, // BearishSharps
showBearishPOIs && true, // BearishSpikes showBearishPOIs && true, // BearishSpikes
showBearishPOIs && false, // BearishPullbacks showBearishPOIs && true, // BearishPullbacks
showBearishPOIs && true, // BearishMomentums showBearishPOIs && true, // BearishMomentums
showBearishPOIs && true, // BearishRejections showBearishPOIs && true, // BearishRejections
showBearishPOIs && true, // BearishOrderBlocks showBearishPOIs && true, // BearishOrderBlocks
@@ -369,9 +369,10 @@ void DetectPOIState()
); );
// //
if (poiEventNotifier.hasNewPullback) if (poiEventNotifier.hasNewSupportZone ||
poiEventNotifier.hasNewResistanceZone)
{ {
Print("Pullback ..."); Print("Support/Resistance ...");
} }
// //