This commit is contained in:
2026-01-09 22:41:21 +03:30
parent 2829430c0c
commit 41fb71d63d
4 changed files with 4346 additions and 427 deletions
File diff suppressed because it is too large Load Diff
+945
View File
@@ -4038,6 +4038,951 @@ bool Strategy1HasSignal(
}
// #endregion
// #region PV ...
bool IsPeakSameAsLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsSame(
helper.GetPeak(barIndex),
helper.GetPeak(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsPeakOverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsOver(
helper.GetPeak(barIndex),
helper.GetPeak(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsPeakUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsUnder(
helper.GetPeak(barIndex),
helper.GetPeak(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsValeSameAsLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsSame(
helper.GetVale(barIndex),
helper.GetVale(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsValeOverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsOver(
helper.GetVale(barIndex),
helper.GetVale(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsValeUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsUnder(
helper.GetVale(barIndex),
helper.GetVale(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
// #endregion
// #region ATR ...
bool IsATRBreakoutUp(
int barIndex = 0,
ENUM_X_PRICE priceType = X_PRICE_CLOSE //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid() &&
IsXValid(priceType);
if (!result)
{
return result;
}
//
XOHCL bar;
result = bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
double price = bar.GetPrice(priceType);
result = price > helper.GetATRRawUpper(barIndex);
bar.Clean();
//
return result;
}
bool IsATRBreakoutDown(
int barIndex = 0,
ENUM_X_PRICE priceType = X_PRICE_CLOSE //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid() &&
IsXValid(priceType);
if (!result)
{
return result;
}
//
XOHCL bar;
result = bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
double price = bar.GetPrice(priceType);
result = price < helper.GetATRRawLower(barIndex);
bar.Clean();
//
return result;
}
bool IsATROverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsOver(
helper.GetATR(barIndex),
helper.GetATR(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsATRUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsUnder(
helper.GetATR(barIndex),
helper.GetATR(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsATRSwitchedOverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsATROverLast(barIndex, tolerance) &&
!IsATROverLast(barIndex + 1, tolerance);
//
return result;
}
bool IsATRSwitchedUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsATRUnderLast(barIndex, tolerance) &&
!IsATRUnderLast(barIndex + 1, tolerance);
//
return result;
}
bool IsATRSmoothedOverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsOver(
helper.GetATRSmoothed(barIndex),
helper.GetATRSmoothed(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsATRSmoothedUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsUnder(
helper.GetATRSmoothed(barIndex),
helper.GetATRSmoothed(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsATRSmoothedSwitchedOverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsATRSmoothedOverLast(barIndex, tolerance) &&
!IsATRSmoothedOverLast(barIndex + 1, tolerance);
//
return result;
}
bool IsATRSmoothedSwitchedUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsATRSmoothedUnderLast(barIndex, tolerance) &&
!IsATRSmoothedUnderLast(barIndex + 1, tolerance);
//
return result;
}
bool IsVolatilityHigh(int barIndex = 0)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
double atr = helper.GetATR(barIndex);
double atrMa = helper.GetATRSmoothed(barIndex);
result = atr > atrMa;
//
return result;
}
bool IsVolatilityLow(int barIndex = 0)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
double atr = helper.GetATR(barIndex);
double atrMa = helper.GetATRSmoothed(barIndex);
result = atr < atrMa;
//
return result;
}
bool IsVolatilitySwitchdToHigh(int barIndex = 0)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
double atr = helper.GetATR(barIndex);
double atrPrev = helper.GetATR(barIndex + 1);
double atrMa = helper.GetATRSmoothed(barIndex);
double atrMaPrev = helper.GetATRSmoothed(barIndex + 1);
//
result =
atr > atrMa &&
atrPrev <= atrMaPrev;
//
return result;
}
bool IsVolatilitySwitchdToLow(int barIndex = 0)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
double atr = helper.GetATR(barIndex);
double atrPrev = helper.GetATR(barIndex + 1);
double atrMa = helper.GetATRSmoothed(barIndex);
double atrMaPrev = helper.GetATRSmoothed(barIndex + 1);
//
result =
atr < atrMa &&
atrPrev >= atrMaPrev;
//
return result;
}
// #endregion
// #region RSI ...
bool IsRSIBullish(
int barIndex = 0,
double threshold = 55,
double tolerance = 2 //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
result = helper.GetRSI(barIndex) > threshold + (GetPoints(symbol) * tolerance) ||
helper.GetRSI(barIndex) > threshold - (GetPoints(symbol) * tolerance);
//
return result;
}
bool IsRSISwitchedToBullish(
int barIndex = 0,
double threshold = 55,
double tolerance = 2 //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
result =
IsRSIBullish(barIndex, threshold, tolerance) &&
!IsRSIBullish(barIndex + 1, threshold, tolerance);
//
return result;
}
bool IsRSIBearish(
int barIndex = 0,
double threshold = 45,
double tolerance = 2 //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
result = helper.GetRSI(barIndex) < threshold + (GetPoints(symbol) * tolerance) ||
helper.GetRSI(barIndex) < threshold - (GetPoints(symbol) * tolerance);
//
return result;
}
bool IsRSISwitchedToBearish(
int barIndex = 0,
double threshold = 45,
double tolerance = 2 //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
result =
IsRSIBearish(barIndex, threshold, tolerance) &&
!IsRSIBearish(barIndex + 1, threshold, tolerance);
//
return result;
}
bool IsRSIRising(int barIndex = 0)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
helper.GetRSI(barIndex) > helper.GetRSISmoothed(barIndex);
//
return result;
}
bool IsRSISwitchedToRising(int barIndex = 0)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsRSIRising(barIndex) &&
!IsRSIRising(barIndex + 1);
//
return result;
}
bool IsRSIFalling(int barIndex = 0)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
helper.GetRSI(barIndex) < helper.GetRSISmoothed(barIndex);
//
return result;
}
bool IsRSISwitchedToFalling(int barIndex = 0)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsRSIFalling(barIndex) &&
!IsRSIFalling(barIndex + 1);
//
return result;
}
bool IsRSIOverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsOver(
helper.GetRSI(barIndex),
helper.GetRSI(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsRSISwitchedOverLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsRSIOverLast(barIndex, tolerance) &&
!IsRSIOverLast(barIndex + 1, tolerance);
//
return result;
}
bool IsRSIUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsUnder(
helper.GetRSI(barIndex),
helper.GetRSI(barIndex + 1),
GetPoints(symbol) * tolerance //
);
//
return result;
}
bool IsRSISwitchedUnderLast(
int barIndex = 0,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsRSIUnderLast(barIndex, tolerance) &&
!IsRSIUnderLast(barIndex + 1, tolerance);
//
return result;
}
bool IsRSIOverbought(
int barIndex = 0,
double threshold = 70,
double tolerance = 2 //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
result = helper.GetRSI(barIndex) > threshold + (GetPoints(symbol) * tolerance) ||
helper.GetRSI(barIndex) > threshold - (GetPoints(symbol) * tolerance);
//
return result;
}
bool IsRSIOversold(
int barIndex = 0,
double threshold = 30,
double tolerance = 2 //
)
{
//
bool result = false;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
result = helper.GetRSI(barIndex) < threshold + (GetPoints(symbol) * tolerance) ||
helper.GetRSI(barIndex) < threshold - (GetPoints(symbol) * tolerance);
//
return result;
}
bool IsRSISwitchedToOversold(
int barIndex = 0,
double threshold = 30,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsRSIOversold(barIndex, threshold, tolerance) &&
!IsRSIOversold(barIndex + 1, threshold, tolerance);
//
return result;
}
bool IsRSISwitchedFromOversold(
int barIndex = 0,
double threshold = 30,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
!IsRSIOversold(barIndex, threshold, tolerance) &&
IsRSIOversold(barIndex + 1, threshold, tolerance);
//
return result;
}
bool IsRSISwitchedToOverbought(
int barIndex = 0,
double threshold = 70,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
IsRSIOverbought(barIndex, threshold, tolerance) &&
!IsRSIOverbought(barIndex + 1, threshold, tolerance);
//
return result;
}
bool IsRSISwitchedFromOverbought(
int barIndex = 0,
double threshold = 70,
double tolerance = 2 //
)
{
//
bool result = false;
//
barIndex = NormalizeBarIndex(barIndex);
//
result =
IsValid() &&
!IsRSIOverbought(barIndex, threshold, tolerance) &&
IsRSIOverbought(barIndex + 1, threshold, tolerance);
//
return result;
}
// #endregion
// #region Composite ...
bool IsKIHasTrend(