some cleanups, refactor unnecessary requirements, implement rejected checkers and also counters ...
ass support for PV and KISuperSlow and MASuper Slow in KI Indicator and also Helper and implement them in BackTester ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,320 @@
|
|||||||
|
|
||||||
|
// #region Signals ...
|
||||||
|
|
||||||
|
// #region POI ...
|
||||||
|
bool IsBullishPOILongEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// IMPORTANT: Use near Support/Resistance ...
|
||||||
|
bool result = poiDetector.IsBullishPOI(barIndex) &&
|
||||||
|
kiParser.IsSafeBullishEntry(barIndex) &&
|
||||||
|
IsTFBullishPattern(barIndex, lowerTF);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsBearishPOIShortEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// IMPORTANT: Use near Support/Resistance ...
|
||||||
|
bool result = poiDetector.IsBearishPOI(barIndex) &&
|
||||||
|
kiParser.IsSafeBearishEntry(barIndex) &&
|
||||||
|
IsTFBearishPattern(barIndex, lowerTF);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitBullishPOILong(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBearishReversalPOI(barIndex) ||
|
||||||
|
poiDetector.IsBearishBreakoutPOI(barIndex) ||
|
||||||
|
poiDetector.IsBearishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitBearishPOIShort(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBullishReversalPOI(barIndex) ||
|
||||||
|
poiDetector.IsBullishBreakoutPOI(barIndex) ||
|
||||||
|
poiDetector.IsBullishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Breakout ...
|
||||||
|
bool IsBreakoutLongEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
kiParser.IsVolatilityHigh(barIndex) &&
|
||||||
|
IsTFBullishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBullishBreakoutPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsBreakoutShortEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
kiParser.IsVolatilityHigh(barIndex) &&
|
||||||
|
IsTFBearishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBearishBreakoutPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitBreakoutLong(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBearishReversalPOI(barIndex) ||
|
||||||
|
poiDetector.IsBearishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitBreakoutShort(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBullishReversalPOI(barIndex) ||
|
||||||
|
poiDetector.IsBullishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Reversal ...
|
||||||
|
bool IsReversalLongEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
kiParser.IsRSIBullish(barIndex) &&
|
||||||
|
IsTFBullishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBullishReversalPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsReversalShortEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
kiParser.IsRSIBearish(barIndex) &&
|
||||||
|
IsTFBearishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBearishReversalPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitReversalLong(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBearishBreakoutPOI(barIndex) ||
|
||||||
|
poiDetector.IsBearishContinuationPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitReversalShort(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBullishBreakoutPOI(barIndex) ||
|
||||||
|
poiDetector.IsBullishContinuationPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Continuation ...
|
||||||
|
bool IsContinuationLongEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
IsTFBullishPattern(barIndex, lowerTF) &&
|
||||||
|
kiParser.IsTrendStrongBullish(barIndex) &&
|
||||||
|
poiDetector.IsBullishContinuationPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsContinuationShortEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
IsTFBearishPattern(barIndex, lowerTF) &&
|
||||||
|
kiParser.IsTrendStrongBearish(barIndex) &&
|
||||||
|
poiDetector.IsBearishContinuationPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitContinuationLong(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBearishReversalPOI(barIndex) ||
|
||||||
|
poiDetector.IsBearishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitContinuationShort(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBullishReversalPOI(barIndex) ||
|
||||||
|
poiDetector.IsBullishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Exhaustion ...
|
||||||
|
bool IsExhaustionLongEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
IsTFBullishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBearishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsExhaustionShortEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
IsTFBearishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBullishExhaustionPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitExhaustionLong(int barIndex = 0)
|
||||||
|
{
|
||||||
|
return poiDetector.IsBearishBreakoutPOI(barIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitExhaustionShort(int barIndex = 0)
|
||||||
|
{
|
||||||
|
return poiDetector.IsBullishBreakoutPOI(barIndex);
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Trend Exhaustion ...
|
||||||
|
bool IsTrendExhaustionLongEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
IsTFBullishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBearishTrendExhaustedPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsTrendExhaustionShortEntry(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
IsTFBearishPattern(barIndex, lowerTF) &&
|
||||||
|
poiDetector.IsBullishTrendExhaustedPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitTrendExhaustionLong(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBearishBreakoutPOI(barIndex) ||
|
||||||
|
poiDetector.IsBearishContinuationPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExitTrendExhaustionShort(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
poiDetector.IsBullishBreakoutPOI(barIndex) ||
|
||||||
|
poiDetector.IsBullishContinuationPOI(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #endregion
|
||||||
@@ -0,0 +1,458 @@
|
|||||||
|
|
||||||
|
int CounteZoneTouches(
|
||||||
|
XBoxZone &zone,
|
||||||
|
double threshold = 10,
|
||||||
|
int loopback = 100 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize ...
|
||||||
|
loopback = NormalizeInt(loopback, 50);
|
||||||
|
threshold = NormalizeDouble(threshold, 10);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!zone.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL tmpBar;
|
||||||
|
int start = zone.ToIndex();
|
||||||
|
bool isUpperTouched = false;
|
||||||
|
bool isLowerTouched = false;
|
||||||
|
double points = GetPoints(zone.symbol);
|
||||||
|
double distance = points * threshold;
|
||||||
|
int end = MathMin(start + loopback, zone.FromIndex());
|
||||||
|
for (int i = start; i < end; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (tmpBar.Init(zone.symbol, zone.period, i))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isUpperTouched = MathAbs(tmpBar.high - zone.upper) <= distance;
|
||||||
|
isLowerTouched = MathAbs(tmpBar.low - zone.lower) <= distance;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (
|
||||||
|
(zone.IsBullish() &&
|
||||||
|
(isLowerTouched ||
|
||||||
|
MathAbs(tmpBar.close - zone.lower) <= distance)) ||
|
||||||
|
(zone.IsBearish() &&
|
||||||
|
(isUpperTouched ||
|
||||||
|
MathAbs(tmpBar.close - zone.upper) <= distance)))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result++;
|
||||||
|
Add(
|
||||||
|
tmpBar.time,
|
||||||
|
zone.tests //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpBar.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasNearZone(
|
||||||
|
int &index,
|
||||||
|
double price,
|
||||||
|
double threshold,
|
||||||
|
XBoxZone &zones[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
index = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = HasChild(zones) &&
|
||||||
|
NotEmptyZero(price) &&
|
||||||
|
NotEmptyZero(threshold) &&
|
||||||
|
price > 0 &&
|
||||||
|
threshold > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double points = GetPoints(zones[0].symbol);
|
||||||
|
double distance = points * threshold;
|
||||||
|
for (int i = 0; i < ArraySize(zones); i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Price Distance by Upper ...
|
||||||
|
result = price >= zones[i].lower - distance &&
|
||||||
|
price <= zones[i].upper + distance;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValidIndex(index);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsNearZone(
|
||||||
|
double price,
|
||||||
|
XBoxZone &zone,
|
||||||
|
double threshold = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
zone.IsValid() &&
|
||||||
|
NotEmptyZero(price);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double points = GetPoints(zone.symbol);
|
||||||
|
double distance = points * threshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = price >= zone.lower - distance &&
|
||||||
|
price <= zone.upper + distance;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check Recently Pattern Zone is Touched or not ...
|
||||||
|
*
|
||||||
|
* @param zone: XBoxZone, Touched Zone ...
|
||||||
|
* @param patterns: ENUM_X_BAR_PATTERN, Allowed to Check Patterns ...
|
||||||
|
* @param patternsDir: ENUM_X_DIRECTION, Allowed Directions ...
|
||||||
|
* @param price: double, a Price to Check Toch or Reject ...
|
||||||
|
* @param barIndex: int, Bar Index to Start Checking ...
|
||||||
|
* @param loopback: int, Loopback for Pattern Formations ...
|
||||||
|
* @param threshold: double, threshold for Pattern touch ...
|
||||||
|
* @param forPeriod: ENUM_TIMEFRAMES, Time Frame to Check Patterns ...
|
||||||
|
* @param forDir: ENUM_X_DIRECTION, Directions for Pattern's Formation Check ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool HasRecentPatternTouched(
|
||||||
|
XBoxZone &zone,
|
||||||
|
ENUM_X_BAR_PATTERN &patterns[],
|
||||||
|
ENUM_X_DIRECTION &patternsDir[],
|
||||||
|
double price,
|
||||||
|
int barIndex = 0,
|
||||||
|
int loopback = 5,
|
||||||
|
double threshold = 5,
|
||||||
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||||
|
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
zone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result =
|
||||||
|
HasChild(patterns) &&
|
||||||
|
NotEmptyZero(price) &&
|
||||||
|
HasChild(patternsDir) &&
|
||||||
|
ArraySize(patterns) == ArraySize(patternsDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize ...
|
||||||
|
loopback = NormalizeInt(loopback, 2);
|
||||||
|
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||||
|
if (IsXValid(forPeriod))
|
||||||
|
{
|
||||||
|
forPeriod = period;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool has = false;
|
||||||
|
int iBullishIDX = -1;
|
||||||
|
int iBearishIDX = -1;
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
XBoxZone iBullishZones[];
|
||||||
|
XBoxZone iBearishZones[];
|
||||||
|
XPatternAnalysis iAnalysis;
|
||||||
|
XPatternAnalysisConfig iConfig;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Preparing Pattern Analysis Config ...
|
||||||
|
iConfig.Default();
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
patterns,
|
||||||
|
iConfig.allowedPatterns //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
patternsDir,
|
||||||
|
iConfig.allowedDirs //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// XAUUSD ...
|
||||||
|
iConfig.AddPattern(X_BAR_PATTERN_FVG);
|
||||||
|
iConfig.AddPattern(X_BAR_PATTERN_PIERCING);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Looping Back ...
|
||||||
|
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Initialize Bar ...
|
||||||
|
has = iBar.Init(symbol, forPeriod, i);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse Patterns ...
|
||||||
|
has = AnalyseBarPatterns(iBar, iAnalysis, iConfig);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
has = iAnalysis.Count(X_DIRECTION_BULLISH) > 0;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iAnalysis.GetPatterns(iBullishZones, X_DIRECTION_BULLISH);
|
||||||
|
has = HasChild(iBullishZones);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = HasNearZone(
|
||||||
|
iBullishIDX,
|
||||||
|
price,
|
||||||
|
threshold,
|
||||||
|
iBullishZones //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
isBullish = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
has = iAnalysis.Count(X_DIRECTION_BEARISH) > 0;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iAnalysis.GetPatterns(iBearishZones, X_DIRECTION_BEARISH);
|
||||||
|
has = HasChild(iBearishZones);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = HasNearZone(
|
||||||
|
iBearishIDX,
|
||||||
|
price,
|
||||||
|
threshold,
|
||||||
|
iBearishZones //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
isBearish = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Summarizing Result ...
|
||||||
|
has =
|
||||||
|
HasDirection(forDir)
|
||||||
|
? (isBullish && !isBearish && IsXBullish(forDir)) ||
|
||||||
|
(isBearish && !isBullish && IsXBearish(forDir))
|
||||||
|
: (isBullish && !isBearish) || (isBearish && !isBullish);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Fill Zones ...
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
zone = iBullishZones[iBullishIDX];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zone = iBearishZones[iBearishIDX];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resource ...
|
||||||
|
iBar.Clean();
|
||||||
|
iAnalysis.Clean();
|
||||||
|
XClean(iBullishZones);
|
||||||
|
XClean(iBearishZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
iBar.Clean();
|
||||||
|
iConfig.Clean();
|
||||||
|
iAnalysis.Clean();
|
||||||
|
XClean(iBullishZones);
|
||||||
|
XClean(iBearishZones);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ValidateZones(
|
||||||
|
XBoxZone &zones[],
|
||||||
|
int barIndex = 0,
|
||||||
|
int minimumRetests = 2,
|
||||||
|
double retestThreshold = 10,
|
||||||
|
int retestLoopback = 100,
|
||||||
|
ENUM_X_BOUNDARY_PRICE forPriceType = X_BOUNDARY_PRICE_UP_DOWN //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validation ...
|
||||||
|
has = HasChild(zones) &&
|
||||||
|
IsXValid(forPriceType);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalizetion ...
|
||||||
|
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||||
|
minimumRetests = NormalizeInt(minimumRetests, 0);
|
||||||
|
retestLoopback = NormalizeInt(retestLoopback, 50);
|
||||||
|
retestThreshold = NormalizeDouble(retestThreshold, 5, 10);
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL tmpBar;
|
||||||
|
XBoxZone tmp;
|
||||||
|
XBoxZone tmps[];
|
||||||
|
double tmpValue = 0;
|
||||||
|
for (int i = 0; i < ArraySize(zones); i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmp = zones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (minimumRetests > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int retests = CounteZoneTouches(tmp, retestThreshold, retestLoopback);
|
||||||
|
if (retests < minimumRetests)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Zone ...
|
||||||
|
has = false;
|
||||||
|
for (int j = barIndex; j < tmp.FromIndex(); j++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Initial Bar ...
|
||||||
|
if (tmpBar.Init(tmp.symbol, tmp.period, j))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
tmpValue = forPriceType == X_BOUNDARY_PRICE_UP_DOWN
|
||||||
|
? tmp.IsBullish()
|
||||||
|
? tmpBar.GetDown()
|
||||||
|
: tmpBar.GetUp()
|
||||||
|
: forPriceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||||
|
? tmp.IsBullish()
|
||||||
|
? tmpBar.low
|
||||||
|
: tmpBar.high
|
||||||
|
: EMPTY_VALUE;
|
||||||
|
if (NotEmptyZero(tmpValue))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Break ...
|
||||||
|
has = tmp.IsBullish()
|
||||||
|
? tmpValue < tmp.lower
|
||||||
|
: tmpValue > tmp.upper;
|
||||||
|
|
||||||
|
//
|
||||||
|
// If Breakes ...
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
tmpBar.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Not Breaked ...
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
tmp,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
tmp.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Zones ...
|
||||||
|
XClean(zones);
|
||||||
|
Copy(
|
||||||
|
tmps,
|
||||||
|
zones //
|
||||||
|
);
|
||||||
|
XClean(tmps);
|
||||||
|
}
|
||||||
@@ -78,8 +78,10 @@ input bool showBarTime = true; // Show Bar Time
|
|||||||
input group "Calculation";
|
input group "Calculation";
|
||||||
input int kiFastLength = 26; // KI Fast Length
|
input int kiFastLength = 26; // KI Fast Length
|
||||||
input int kiSlowLength = 104; // KI Slow Length
|
input int kiSlowLength = 104; // KI Slow Length
|
||||||
input int maFastLength = 9; // MA Fast Length
|
input int kiSuperSlowLength = 208; // KI Super Slow Length
|
||||||
input int maSlowLength = 26; // MA Slow Length
|
input int maFastLength = 26; // MA Fast Length
|
||||||
|
input int maSlowLength = 104; // MA Slow Length
|
||||||
|
input int maSuperSlowLength = 208; // MA Super Slow Length
|
||||||
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Mode
|
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Mode
|
||||||
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||||
input int rsiLength = 14; // RSI Length
|
input int rsiLength = 14; // RSI Length
|
||||||
@@ -97,13 +99,16 @@ input ENUM_X_PRICE atrLowerPriceType = X_PRICE_LOW; // ATR Lower Price T
|
|||||||
//
|
//
|
||||||
// Presentation ...
|
// Presentation ...
|
||||||
input group "Presentation";
|
input group "Presentation";
|
||||||
input bool showKIFast = true; // Show KI Fast
|
input bool showPV = true; // Show PV
|
||||||
input bool showKISlow = true; // Show KI Slow
|
input bool showKIFast = true; // Show KI Fast
|
||||||
input bool showMaFast = true; // Show Ma Fast
|
input bool showKISlow = true; // Show KI Slow
|
||||||
input bool showMaSlow = true; // Show MA Slow
|
input bool showKISuperSlow = true; // Show KI Super Slow
|
||||||
input bool showKIWave = true; // Show KI Wave
|
input bool showMaFast = true; // Show Ma Fast
|
||||||
input bool showKIUpper = true; // Show KI Upper
|
input bool showMaSlow = true; // Show MA Slow
|
||||||
input bool showKILower = true; // Show KI Lower
|
input bool showMaSuperSlow = true; // Show MA Super Slow
|
||||||
|
input bool showKIWave = true; // Show KI Wave
|
||||||
|
input bool showKIUpper = true; // Show KI Upper
|
||||||
|
input bool showKILower = true; // Show KI Lower
|
||||||
|
|
||||||
//
|
//
|
||||||
input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
||||||
@@ -251,8 +256,10 @@ int OnInit()
|
|||||||
// Here we Attach Inputs to Indicator ...
|
// Here we Attach Inputs to Indicator ...
|
||||||
kiInputs.kiFastLength = kiFastLength;
|
kiInputs.kiFastLength = kiFastLength;
|
||||||
kiInputs.kiSlowLength = kiSlowLength;
|
kiInputs.kiSlowLength = kiSlowLength;
|
||||||
|
kiInputs.kiSuperSlowLength = kiSuperSlowLength;
|
||||||
kiInputs.maFastLength = maFastLength;
|
kiInputs.maFastLength = maFastLength;
|
||||||
kiInputs.maSlowLength = maSlowLength;
|
kiInputs.maSlowLength = maSlowLength;
|
||||||
|
kiInputs.maSuperSlowLength = maSuperSlowLength;
|
||||||
kiInputs.maMethod = maMethod;
|
kiInputs.maMethod = maMethod;
|
||||||
kiInputs.maAppliedTo = maAppliedTo;
|
kiInputs.maAppliedTo = maAppliedTo;
|
||||||
kiInputs.rsiLength = rsiLength;
|
kiInputs.rsiLength = rsiLength;
|
||||||
@@ -266,10 +273,13 @@ int OnInit()
|
|||||||
kiInputs.atrSmoothingMode = atrSmoothingMode;
|
kiInputs.atrSmoothingMode = atrSmoothingMode;
|
||||||
kiInputs.atrUpperPriceType = atrUpperPriceType;
|
kiInputs.atrUpperPriceType = atrUpperPriceType;
|
||||||
kiInputs.atrLowerPriceType = atrLowerPriceType;
|
kiInputs.atrLowerPriceType = atrLowerPriceType;
|
||||||
|
kiInputs.showPV = showPV;
|
||||||
kiInputs.showKIFast = showKIFast;
|
kiInputs.showKIFast = showKIFast;
|
||||||
kiInputs.showKISlow = showKISlow;
|
kiInputs.showKISlow = showKISlow;
|
||||||
|
kiInputs.showKISuperSlow = showKISuperSlow;
|
||||||
kiInputs.showMaFast = showMaFast;
|
kiInputs.showMaFast = showMaFast;
|
||||||
kiInputs.showMaSlow = showMaSlow;
|
kiInputs.showMaSlow = showMaSlow;
|
||||||
|
kiInputs.showMaSuperSlow = showMaSuperSlow;
|
||||||
kiInputs.showKIWave = showKIWave;
|
kiInputs.showKIWave = showKIWave;
|
||||||
kiInputs.showKIUpper = showKIUpper;
|
kiInputs.showKIUpper = showKIUpper;
|
||||||
kiInputs.showKILower = showKILower;
|
kiInputs.showKILower = showKILower;
|
||||||
|
|||||||
@@ -31,18 +31,23 @@ enum ENUM_X121_XKI_BUFFERS
|
|||||||
// KI Fast ...
|
// KI Fast ...
|
||||||
X121_XKI_KI_FAST_LINE = 0,
|
X121_XKI_KI_FAST_LINE = 0,
|
||||||
X121_XKI_KI_FAST_COLOR_LINE = 1,
|
X121_XKI_KI_FAST_COLOR_LINE = 1,
|
||||||
X121_XKI_KI_FAST_STATE_LINE = 10,
|
X121_XKI_KI_FAST_STATE_LINE = 15,
|
||||||
//
|
//
|
||||||
// KI Slow ...
|
// KI Slow ...
|
||||||
X121_XKI_KI_SLOW_LINE = 8,
|
X121_XKI_KI_SLOW_LINE = 8,
|
||||||
X121_XKI_KI_SLOW_COLOR_LINE = 9,
|
X121_XKI_KI_SLOW_COLOR_LINE = 9,
|
||||||
X121_XKI_KI_SLOW_STATE_LINE = 17,
|
X121_XKI_KI_SLOW_STATE_LINE = 22,
|
||||||
|
//
|
||||||
|
// KI Super Slow ...
|
||||||
|
X121_XKI_KI_SUPER_SLOW_LINE = 10,
|
||||||
|
X121_XKI_KI_SUPER_SLOW_COLOR_LINE = 11,
|
||||||
|
X121_XKI_KI_SUPER_SLOW_STATE_LINE = 24,
|
||||||
//
|
//
|
||||||
// KI Wave ...
|
// KI Wave ...
|
||||||
X121_XKI_KI_WAVE_LINE = 2,
|
X121_XKI_KI_WAVE_LINE = 2,
|
||||||
X121_XKI_KI_WAVE_RAW_LINE = 15,
|
X121_XKI_KI_WAVE_RAW_LINE = 20,
|
||||||
X121_XKI_KI_WAVE_COLOR_LINE = 3,
|
X121_XKI_KI_WAVE_COLOR_LINE = 3,
|
||||||
X121_XKI_KI_WAVE_STATE_LINE = 16,
|
X121_XKI_KI_WAVE_STATE_LINE = 21,
|
||||||
//
|
//
|
||||||
// Upper/Lower ...
|
// Upper/Lower ...
|
||||||
X121_XKI_KI_UPPER_LINE = 4,
|
X121_XKI_KI_UPPER_LINE = 4,
|
||||||
@@ -51,15 +56,20 @@ enum ENUM_X121_XKI_BUFFERS
|
|||||||
// MA Fast/Slow ...
|
// MA Fast/Slow ...
|
||||||
X121_XKI_MA_FAST_LINE = 6,
|
X121_XKI_MA_FAST_LINE = 6,
|
||||||
X121_XKI_MA_SLOW_LINE = 7,
|
X121_XKI_MA_SLOW_LINE = 7,
|
||||||
|
X121_XKI_MA_SUPER_SLOW_LINE = 12,
|
||||||
|
//
|
||||||
|
// PV ...
|
||||||
|
X121_XKI_PEAK_LINE = 13,
|
||||||
|
X121_XKI_VALE_LINE = 14,
|
||||||
//
|
//
|
||||||
// ATR ...
|
// ATR ...
|
||||||
X121_XKI_ATR_LINE = 11,
|
X121_XKI_ATR_LINE = 16,
|
||||||
X121_XKI_ATR_SMOOTHED_LINE = 18,
|
X121_XKI_ATR_SMOOTHED_LINE = 23,
|
||||||
X121_XKI_ATR_RAW_UPPER_LINE = 12,
|
X121_XKI_ATR_RAW_UPPER_LINE = 17,
|
||||||
X121_XKI_ATR_RAW_LOWER_LINE = 13,
|
X121_XKI_ATR_RAW_LOWER_LINE = 18,
|
||||||
//
|
//
|
||||||
// RSI ...
|
// RSI ...
|
||||||
X121_XKI_RSI_LINE = 14,
|
X121_XKI_RSI_LINE = 19,
|
||||||
};
|
};
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
@@ -70,8 +80,10 @@ struct X121XKIInputs
|
|||||||
// #region Calculations ...
|
// #region Calculations ...
|
||||||
int kiFastLength; // KI Fast Length
|
int kiFastLength; // KI Fast Length
|
||||||
int kiSlowLength; // KI Slow Length
|
int kiSlowLength; // KI Slow Length
|
||||||
|
int kiSuperSlowLength; // KI Super Slow Length
|
||||||
int maFastLength; // MA Fast Length
|
int maFastLength; // MA Fast Length
|
||||||
int maSlowLength; // MA Slow Length
|
int maSlowLength; // MA Slow Length
|
||||||
|
int maSuperSlowLength; // MA Super Slow Length
|
||||||
ENUM_MA_METHOD maMethod; // MA Mode
|
ENUM_MA_METHOD maMethod; // MA Mode
|
||||||
ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
||||||
int rsiLength; // RSI Length
|
int rsiLength; // RSI Length
|
||||||
@@ -88,16 +100,23 @@ struct X121XKIInputs
|
|||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Presentations ...
|
// #region Presentations ...
|
||||||
bool showKIFast; // Show KI
|
bool showPV; // Show PV
|
||||||
bool showKISlow; // Show Slow
|
bool showKIFast; // Show KI
|
||||||
bool showMaFast; // Show Ma Fast
|
bool showKISlow; // Show KI Slow
|
||||||
bool showMaSlow; // Show MA Slow
|
bool showKISuperSlow; // Show KI Super Slow
|
||||||
bool showKIWave; // Show KI Wave
|
bool showMaFast; // Show Ma Fast
|
||||||
bool showKIUpper; // Show KI Upper
|
bool showMaSlow; // Show MA Slow
|
||||||
bool showKILower; // Show KI Lower
|
bool showMaSuperSlow; // Show MA Super Slow
|
||||||
|
bool showKIWave; // Show KI Wave
|
||||||
|
bool showKIUpper; // Show KI Upper
|
||||||
|
bool showKILower; // Show KI Lower
|
||||||
|
|
||||||
//
|
//
|
||||||
int startCalculationForLastBars; // Calculate Last n Bars
|
int startCalculationForLastBars; // Calculate Last n Bars
|
||||||
|
|
||||||
|
//
|
||||||
|
int peakArrowCode; // Peaks Arrow Code
|
||||||
|
int valeArrowCode; // Vales Arrow Code
|
||||||
// #endregion
|
// #endregion
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
@@ -124,8 +143,10 @@ struct X121XKIInputs
|
|||||||
// Calculations ...
|
// Calculations ...
|
||||||
kiFastLength = 26;
|
kiFastLength = 26;
|
||||||
kiSlowLength = 104;
|
kiSlowLength = 104;
|
||||||
maFastLength = 9;
|
kiSuperSlowLength = 208;
|
||||||
maSlowLength = 26;
|
maFastLength = 26;
|
||||||
|
maSlowLength = 104;
|
||||||
|
maSuperSlowLength = 208;
|
||||||
maMethod = MODE_EMA;
|
maMethod = MODE_EMA;
|
||||||
maAppliedTo = PRICE_CLOSE;
|
maAppliedTo = PRICE_CLOSE;
|
||||||
rsiLength = 14;
|
rsiLength = 14;
|
||||||
@@ -142,16 +163,23 @@ struct X121XKIInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Presentations ...
|
// Presentations ...
|
||||||
|
showPV = true;
|
||||||
showKIFast = true;
|
showKIFast = true;
|
||||||
showKISlow = true;
|
showKISlow = true;
|
||||||
|
showKISuperSlow = true;
|
||||||
showMaFast = true;
|
showMaFast = true;
|
||||||
showMaSlow = true;
|
showMaSlow = true;
|
||||||
|
showMaSuperSlow = true;
|
||||||
showKIWave = true;
|
showKIWave = true;
|
||||||
showKIUpper = true;
|
showKIUpper = true;
|
||||||
showKILower = true;
|
showKILower = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
startCalculationForLastBars = 1500;
|
startCalculationForLastBars = 1500;
|
||||||
|
|
||||||
|
//
|
||||||
|
peakArrowCode = 159;
|
||||||
|
valeArrowCode = 159;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -160,10 +188,13 @@ struct X121XKIInputs
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Presentations ...
|
// Presentations ...
|
||||||
|
showPV = false;
|
||||||
showKIFast = false;
|
showKIFast = false;
|
||||||
showKISlow = false;
|
showKISlow = false;
|
||||||
|
showKISuperSlow = false;
|
||||||
showMaFast = false;
|
showMaFast = false;
|
||||||
showMaSlow = false;
|
showMaSlow = false;
|
||||||
|
showMaSuperSlow = false;
|
||||||
showKIWave = false;
|
showKIWave = false;
|
||||||
showKIUpper = false;
|
showKIUpper = false;
|
||||||
showKILower = false;
|
showKILower = false;
|
||||||
@@ -182,6 +213,12 @@ struct X121XKIInputs
|
|||||||
// KI ...
|
// KI ...
|
||||||
kiFastLength >= 5 &&
|
kiFastLength >= 5 &&
|
||||||
kiSlowLength > kiFastLength &&
|
kiSlowLength > kiFastLength &&
|
||||||
|
kiSuperSlowLength > kiSlowLength &&
|
||||||
|
//
|
||||||
|
// MA ...
|
||||||
|
maFastLength >= 2 &&
|
||||||
|
maSlowLength > maFastLength &&
|
||||||
|
maSuperSlowLength > maSlowLength &&
|
||||||
//
|
//
|
||||||
// ATR ...
|
// ATR ...
|
||||||
atrLength >= 5 &&
|
atrLength >= 5 &&
|
||||||
@@ -219,12 +256,18 @@ struct X121XKIConditions
|
|||||||
double kiSlowBuffer[];
|
double kiSlowBuffer[];
|
||||||
double kiSlowColorBuffer[];
|
double kiSlowColorBuffer[];
|
||||||
double kiSlowStateBuffer[];
|
double kiSlowStateBuffer[];
|
||||||
|
double kiSuperSlowBuffer[];
|
||||||
|
double kiSuperSlowColorBuffer[];
|
||||||
|
double kiSuperSlowStateBuffer[];
|
||||||
double kiWaveBuffer[];
|
double kiWaveBuffer[];
|
||||||
double kiWaveColorBuffer[];
|
double kiWaveColorBuffer[];
|
||||||
double kiUpperBuffer[];
|
double kiUpperBuffer[];
|
||||||
double kiLowerBuffer[];
|
double kiLowerBuffer[];
|
||||||
double maFastBuffer[];
|
double maFastBuffer[];
|
||||||
double maSlowBuffer[];
|
double maSlowBuffer[];
|
||||||
|
double maSuperSlowBuffer[];
|
||||||
|
double peakBuffer[];
|
||||||
|
double valeBuffer[];
|
||||||
double atrBuffer[];
|
double atrBuffer[];
|
||||||
double atrSmoothedBuffer[];
|
double atrSmoothedBuffer[];
|
||||||
double atrRawUpperBuffer[];
|
double atrRawUpperBuffer[];
|
||||||
@@ -265,12 +308,18 @@ struct X121XKIConditions
|
|||||||
XClean(kiSlowBuffer);
|
XClean(kiSlowBuffer);
|
||||||
XClean(kiSlowColorBuffer);
|
XClean(kiSlowColorBuffer);
|
||||||
XClean(kiSlowStateBuffer);
|
XClean(kiSlowStateBuffer);
|
||||||
|
XClean(kiSuperSlowBuffer);
|
||||||
|
XClean(kiSuperSlowColorBuffer);
|
||||||
|
XClean(kiSuperSlowStateBuffer);
|
||||||
XClean(kiWaveBuffer);
|
XClean(kiWaveBuffer);
|
||||||
XClean(kiWaveColorBuffer);
|
XClean(kiWaveColorBuffer);
|
||||||
XClean(kiUpperBuffer);
|
XClean(kiUpperBuffer);
|
||||||
XClean(kiLowerBuffer);
|
XClean(kiLowerBuffer);
|
||||||
XClean(maFastBuffer);
|
XClean(maFastBuffer);
|
||||||
XClean(maSlowBuffer);
|
XClean(maSlowBuffer);
|
||||||
|
XClean(maSuperSlowBuffer);
|
||||||
|
XClean(peakBuffer);
|
||||||
|
XClean(valeBuffer);
|
||||||
XClean(atrBuffer);
|
XClean(atrBuffer);
|
||||||
XClean(atrSmoothedBuffer);
|
XClean(atrSmoothedBuffer);
|
||||||
XClean(atrRawUpperBuffer);
|
XClean(atrRawUpperBuffer);
|
||||||
@@ -286,12 +335,18 @@ struct X121XKIConditions
|
|||||||
ArraySetAsSeries(kiSlowBuffer, true);
|
ArraySetAsSeries(kiSlowBuffer, true);
|
||||||
ArraySetAsSeries(kiSlowColorBuffer, true);
|
ArraySetAsSeries(kiSlowColorBuffer, true);
|
||||||
ArraySetAsSeries(kiSlowStateBuffer, true);
|
ArraySetAsSeries(kiSlowStateBuffer, true);
|
||||||
|
ArraySetAsSeries(kiSuperSlowBuffer, true);
|
||||||
|
ArraySetAsSeries(kiSuperSlowColorBuffer, true);
|
||||||
|
ArraySetAsSeries(kiSuperSlowStateBuffer, true);
|
||||||
ArraySetAsSeries(kiWaveBuffer, true);
|
ArraySetAsSeries(kiWaveBuffer, true);
|
||||||
ArraySetAsSeries(kiWaveColorBuffer, true);
|
ArraySetAsSeries(kiWaveColorBuffer, true);
|
||||||
ArraySetAsSeries(kiUpperBuffer, true);
|
ArraySetAsSeries(kiUpperBuffer, true);
|
||||||
ArraySetAsSeries(kiLowerBuffer, true);
|
ArraySetAsSeries(kiLowerBuffer, true);
|
||||||
ArraySetAsSeries(maFastBuffer, true);
|
ArraySetAsSeries(maFastBuffer, true);
|
||||||
ArraySetAsSeries(maSlowBuffer, true);
|
ArraySetAsSeries(maSlowBuffer, true);
|
||||||
|
ArraySetAsSeries(maSuperSlowBuffer, true);
|
||||||
|
ArraySetAsSeries(peakBuffer, true);
|
||||||
|
ArraySetAsSeries(valeBuffer, true);
|
||||||
ArraySetAsSeries(atrBuffer, true);
|
ArraySetAsSeries(atrBuffer, true);
|
||||||
ArraySetAsSeries(atrSmoothedBuffer, true);
|
ArraySetAsSeries(atrSmoothedBuffer, true);
|
||||||
ArraySetAsSeries(atrRawUpperBuffer, true);
|
ArraySetAsSeries(atrRawUpperBuffer, true);
|
||||||
@@ -368,8 +423,10 @@ class XCX121XKIHelper : public XCBaseHelper
|
|||||||
"", // Calculation ...
|
"", // Calculation ...
|
||||||
mInputs.kiFastLength,
|
mInputs.kiFastLength,
|
||||||
mInputs.kiSlowLength,
|
mInputs.kiSlowLength,
|
||||||
|
mInputs.kiSuperSlowLength,
|
||||||
mInputs.maFastLength,
|
mInputs.maFastLength,
|
||||||
mInputs.maSlowLength,
|
mInputs.maSlowLength,
|
||||||
|
mInputs.maSuperSlowLength,
|
||||||
mInputs.maMethod,
|
mInputs.maMethod,
|
||||||
mInputs.maAppliedTo,
|
mInputs.maAppliedTo,
|
||||||
mInputs.rsiLength,
|
mInputs.rsiLength,
|
||||||
@@ -384,14 +441,19 @@ class XCX121XKIHelper : public XCBaseHelper
|
|||||||
mInputs.atrUpperPriceType,
|
mInputs.atrUpperPriceType,
|
||||||
mInputs.atrLowerPriceType,
|
mInputs.atrLowerPriceType,
|
||||||
"", // Presentation ...
|
"", // Presentation ...
|
||||||
|
mInputs.showPV,
|
||||||
mInputs.showKIFast,
|
mInputs.showKIFast,
|
||||||
mInputs.showKISlow,
|
mInputs.showKISlow,
|
||||||
|
mInputs.showKISuperSlow,
|
||||||
mInputs.showMaFast,
|
mInputs.showMaFast,
|
||||||
mInputs.showMaSlow,
|
mInputs.showMaSlow,
|
||||||
|
mInputs.showMaSuperSlow,
|
||||||
mInputs.showKIWave,
|
mInputs.showKIWave,
|
||||||
mInputs.showKIUpper,
|
mInputs.showKIUpper,
|
||||||
mInputs.showKILower,
|
mInputs.showKILower,
|
||||||
mInputs.startCalculationForLastBars //
|
mInputs.startCalculationForLastBars,
|
||||||
|
mInputs.peakArrowCode,
|
||||||
|
mInputs.valeArrowCode //
|
||||||
);
|
);
|
||||||
result = mHandler != INVALID_HANDLE;
|
result = mHandler != INVALID_HANDLE;
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -506,6 +568,21 @@ class XCX121XKIHelper : public XCBaseHelper
|
|||||||
loopback,
|
loopback,
|
||||||
conditions.kiSlowStateBuffer //
|
conditions.kiSlowStateBuffer //
|
||||||
);
|
);
|
||||||
|
CopyKISuperSlow(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.kiSuperSlowBuffer //
|
||||||
|
);
|
||||||
|
CopyKISuperSlowColor(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.kiSuperSlowColorBuffer //
|
||||||
|
);
|
||||||
|
CopyKISuperSlowState(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.kiSuperSlowStateBuffer //
|
||||||
|
);
|
||||||
CopyKIWave(
|
CopyKIWave(
|
||||||
zIndex,
|
zIndex,
|
||||||
loopback,
|
loopback,
|
||||||
@@ -546,6 +623,21 @@ class XCX121XKIHelper : public XCBaseHelper
|
|||||||
loopback,
|
loopback,
|
||||||
conditions.maSlowBuffer //
|
conditions.maSlowBuffer //
|
||||||
);
|
);
|
||||||
|
CopyMASuperSlow(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.maSuperSlowBuffer //
|
||||||
|
);
|
||||||
|
CopyPeak(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.peakBuffer //
|
||||||
|
);
|
||||||
|
CopyVale(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.valeBuffer //
|
||||||
|
);
|
||||||
CopyRSI(
|
CopyRSI(
|
||||||
zIndex,
|
zIndex,
|
||||||
loopback,
|
loopback,
|
||||||
@@ -771,6 +863,102 @@ class XCX121XKIHelper : public XCBaseHelper
|
|||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region KI Super Slow ...
|
||||||
|
//
|
||||||
|
double GetKISuperSlow(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValue(
|
||||||
|
(int)X121_XKI_KI_SUPER_SLOW_LINE,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyKISuperSlow(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool asSeries = true // As Series Flag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValues(
|
||||||
|
buffer,
|
||||||
|
(int)X121_XKI_KI_SUPER_SLOW_LINE,
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
asSeries //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region KI Super Slow Color ...
|
||||||
|
//
|
||||||
|
double GetKISuperSlowColor(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValue(
|
||||||
|
(int)X121_XKI_KI_SUPER_SLOW_COLOR_LINE,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyKISuperSlowColor(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool asSeries = true // As Series Flag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValues(
|
||||||
|
buffer,
|
||||||
|
(int)X121_XKI_KI_SUPER_SLOW_COLOR_LINE,
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
asSeries //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region KI Super Slow State ...
|
||||||
|
//
|
||||||
|
double GetKISuperSlowState(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValue(
|
||||||
|
(int)X121_XKI_KI_SUPER_SLOW_STATE_LINE,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyKISuperSlowState(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool asSeries = true // As Series Flag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValues(
|
||||||
|
buffer,
|
||||||
|
(int)X121_XKI_KI_SUPER_SLOW_STATE_LINE,
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
asSeries //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region KI Wave ...
|
// #region KI Wave ...
|
||||||
//
|
//
|
||||||
double GetKIWave(
|
double GetKIWave(
|
||||||
@@ -1027,6 +1215,102 @@ class XCX121XKIHelper : public XCBaseHelper
|
|||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region MA Super Slow ...
|
||||||
|
//
|
||||||
|
double GetMASuperSlow(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValue(
|
||||||
|
(int)X121_XKI_MA_SUPER_SLOW_LINE,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyMASuperSlow(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool asSeries = true // As Series Flag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValues(
|
||||||
|
buffer,
|
||||||
|
(int)X121_XKI_MA_SUPER_SLOW_LINE,
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
asSeries //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Peak ...
|
||||||
|
//
|
||||||
|
double GetPeak(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValue(
|
||||||
|
(int)X121_XKI_PEAK_LINE,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyPeak(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool asSeries = true // As Series Flag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValues(
|
||||||
|
buffer,
|
||||||
|
(int)X121_XKI_PEAK_LINE,
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
asSeries //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Vale ...
|
||||||
|
//
|
||||||
|
double GetVale(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValue(
|
||||||
|
(int)X121_XKI_VALE_LINE,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyVale(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool asSeries = true // As Series Flag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ReadValues(
|
||||||
|
buffer,
|
||||||
|
(int)X121_XKI_VALE_LINE,
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
asSeries //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region RSI ...
|
// #region RSI ...
|
||||||
//
|
//
|
||||||
double GetRSI(
|
double GetRSI(
|
||||||
|
|||||||
@@ -35,8 +35,10 @@
|
|||||||
input group "Calculation";
|
input group "Calculation";
|
||||||
input int kiFastLength = 26; // KI Fast Length
|
input int kiFastLength = 26; // KI Fast Length
|
||||||
input int kiSlowLength = 104; // KI Slow Length
|
input int kiSlowLength = 104; // KI Slow Length
|
||||||
input int maFastLength = 9; // MA Fast Length
|
input int kiSuperSlowLength = 208; // KI Super Slow Length
|
||||||
input int maSlowLength = 26; // MA Slow Length
|
input int maFastLength = 26; // MA Fast Length
|
||||||
|
input int maSlowLength = 104; // MA Slow Length
|
||||||
|
input int maSuperSlowLength = 208; // MA Super Slow Length
|
||||||
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Mode
|
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Mode
|
||||||
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||||
input int rsiLength = 14; // RSI Length
|
input int rsiLength = 14; // RSI Length
|
||||||
@@ -54,16 +56,23 @@ input ENUM_X_PRICE atrLowerPriceType = X_PRICE_LOW; // ATR Lower Price T
|
|||||||
//
|
//
|
||||||
// Presentation ...
|
// Presentation ...
|
||||||
input group "Presentation";
|
input group "Presentation";
|
||||||
input bool showKIFast = true; // Show KI Fast
|
input bool showPV = true; // Show PV
|
||||||
input bool showKISlow = true; // Show KI Slow
|
input bool showKIFast = true; // Show KI Fast
|
||||||
input bool showMaFast = true; // Show Ma Fast
|
input bool showKISlow = true; // Show KI Slow
|
||||||
input bool showMaSlow = true; // Show MA Slow
|
input bool showKISuperSlow = true; // Show KI Super Slow
|
||||||
input bool showKIWave = true; // Show KI Wave
|
input bool showMaFast = true; // Show Ma Fast
|
||||||
input bool showKIUpper = true; // Show KI Upper
|
input bool showMaSlow = true; // Show MA Slow
|
||||||
input bool showKILower = true; // Show KI Lower
|
input bool showMaSuperSlow = true; // Show MA Super Slow
|
||||||
|
input bool showKIWave = true; // Show KI Wave
|
||||||
|
input bool showKIUpper = true; // Show KI Upper
|
||||||
|
input bool showKILower = true; // Show KI Lower
|
||||||
|
|
||||||
//
|
//
|
||||||
input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
||||||
|
|
||||||
|
//
|
||||||
|
input int peakArrowCode = 159; // Peaks Arrow Code
|
||||||
|
input int valeArrowCode = 159; // Vales Arrow Code
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Non Inputs ...
|
// #region Non Inputs ...
|
||||||
@@ -87,8 +96,8 @@ input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
|||||||
#property indicator_chart_window
|
#property indicator_chart_window
|
||||||
|
|
||||||
//
|
//
|
||||||
#property indicator_buffers 19
|
#property indicator_buffers 25
|
||||||
#property indicator_plots 7
|
#property indicator_plots 11
|
||||||
|
|
||||||
// #region Plot Buffers ...
|
// #region Plot Buffers ...
|
||||||
// #region KI ...
|
// #region KI ...
|
||||||
@@ -200,10 +209,72 @@ double kiSlowColorBuffer[];
|
|||||||
#property indicator_style7 STYLE_SOLID
|
#property indicator_style7 STYLE_SOLID
|
||||||
#property indicator_width7 2
|
#property indicator_width7 2
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region KI Super Slow ...
|
||||||
|
//
|
||||||
|
#define kiSuperSlowBufferIndex 10
|
||||||
|
#define kiSuperSlowBufferPlotIndex 7
|
||||||
|
double kiSuperSlowBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define kiSuperSlowColorBufferIndex 11
|
||||||
|
double kiSuperSlowColorBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_label8 "KI Super Slow"
|
||||||
|
#property indicator_type8 DRAW_COLOR_LINE
|
||||||
|
#property indicator_color8 CLR_NONE, clrAqua, clrMagenta, clrGray
|
||||||
|
#property indicator_style8 STYLE_SOLID
|
||||||
|
#property indicator_width8 2
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region MA Super Slow ...
|
||||||
|
//
|
||||||
|
#define maSuperSlowBufferIndex 12
|
||||||
|
#define maSuperSlowBufferPlotIndex 8
|
||||||
|
double maSuperSlowBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_label9 "MA Super Slow"
|
||||||
|
#property indicator_type9 DRAW_LINE
|
||||||
|
#property indicator_color9 clrMagenta
|
||||||
|
#property indicator_style9 STYLE_DOT
|
||||||
|
#property indicator_width9 1
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region PV ...
|
||||||
|
//
|
||||||
|
// PEAKS ...
|
||||||
|
|
||||||
|
//
|
||||||
|
#define peakBufferIndex 13
|
||||||
|
#define peakBufferPlotIndex 9
|
||||||
|
double peakBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_label10 "PEAK"
|
||||||
|
#property indicator_type10 DRAW_ARROW
|
||||||
|
#property indicator_color10 clrMagenta
|
||||||
|
#property indicator_width10 3
|
||||||
|
|
||||||
|
//
|
||||||
|
// VALES ...
|
||||||
|
|
||||||
|
//
|
||||||
|
#define valeBufferIndex 14
|
||||||
|
#define valeBufferPlotIndex 10
|
||||||
|
double valeBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_label11 "VALE"
|
||||||
|
#property indicator_type11 DRAW_ARROW
|
||||||
|
#property indicator_color11 clrAqua
|
||||||
|
#property indicator_width11 3
|
||||||
|
// #endregion
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
#define mLastBufferIndex 9
|
#define mLastBufferIndex 14
|
||||||
|
|
||||||
// #region Data Buffers ...
|
// #region Data Buffers ...
|
||||||
//
|
//
|
||||||
@@ -241,6 +312,10 @@ double kiSlowStateBuffer[];
|
|||||||
//
|
//
|
||||||
#define atrSmoothedBufferIndex mLastBufferIndex + 9
|
#define atrSmoothedBufferIndex mLastBufferIndex + 9
|
||||||
double atrSmoothedBuffer[];
|
double atrSmoothedBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define kiSuperSlowStateBufferIndex mLastBufferIndex + 10
|
||||||
|
double kiSuperSlowStateBuffer[];
|
||||||
// #endregion
|
// #endregion
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
@@ -260,6 +335,7 @@ int atrHandler = INVALID_HANDLE;
|
|||||||
int rsiHandler = INVALID_HANDLE;
|
int rsiHandler = INVALID_HANDLE;
|
||||||
int maFastHandler = INVALID_HANDLE;
|
int maFastHandler = INVALID_HANDLE;
|
||||||
int maSlowHandler = INVALID_HANDLE;
|
int maSlowHandler = INVALID_HANDLE;
|
||||||
|
int maSuperSlowHandler = INVALID_HANDLE;
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Event Handlers ...
|
// #region Event Handlers ...
|
||||||
@@ -353,12 +429,20 @@ void OnDeinit(const int reason)
|
|||||||
{
|
{
|
||||||
IndicatorRelease(maFastHandler);
|
IndicatorRelease(maFastHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// MA Slow ...
|
// MA Slow ...
|
||||||
if (maSlowHandler != INVALID_HANDLE)
|
if (maSlowHandler != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
IndicatorRelease(maSlowHandler);
|
IndicatorRelease(maSlowHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// MA Super Slow ...
|
||||||
|
if (maSuperSlowHandler != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
IndicatorRelease(maSuperSlowHandler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -416,6 +500,7 @@ int OnCalculate(
|
|||||||
// MA ...
|
// MA ...
|
||||||
int maFastCalculatedBars = BarsCalculated(maFastHandler);
|
int maFastCalculatedBars = BarsCalculated(maFastHandler);
|
||||||
int maSlowCalculatedBars = BarsCalculated(maSlowHandler);
|
int maSlowCalculatedBars = BarsCalculated(maSlowHandler);
|
||||||
|
int maSuperSlowCalculatedBars = BarsCalculated(maSuperSlowHandler);
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isPassedRequiredCalculatedBars =
|
bool isPassedRequiredCalculatedBars =
|
||||||
@@ -428,7 +513,8 @@ int OnCalculate(
|
|||||||
//
|
//
|
||||||
// MA ...
|
// MA ...
|
||||||
maFastCalculatedBars >= maxLength &&
|
maFastCalculatedBars >= maxLength &&
|
||||||
maSlowCalculatedBars >= maxLength
|
maSlowCalculatedBars >= maxLength &&
|
||||||
|
maSuperSlowCalculatedBars >= maxLength
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (!isPassedRequiredCalculatedBars)
|
if (!isPassedRequiredCalculatedBars)
|
||||||
@@ -456,6 +542,7 @@ int OnCalculate(
|
|||||||
// MA ...
|
// MA ...
|
||||||
int copiedMAFasts = CopyBuffer(maFastHandler, MAIN_LINE, 0, limit, maFastBuffer);
|
int copiedMAFasts = CopyBuffer(maFastHandler, MAIN_LINE, 0, limit, maFastBuffer);
|
||||||
int copiedMASlows = CopyBuffer(maSlowHandler, MAIN_LINE, 0, limit, maSlowBuffer);
|
int copiedMASlows = CopyBuffer(maSlowHandler, MAIN_LINE, 0, limit, maSlowBuffer);
|
||||||
|
int copiedMASuperSlows = CopyBuffer(maSuperSlowHandler, MAIN_LINE, 0, limit, maSuperSlowBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Copied Items ...
|
// Validate Copied Items ...
|
||||||
@@ -469,7 +556,8 @@ int OnCalculate(
|
|||||||
//
|
//
|
||||||
// MA ...
|
// MA ...
|
||||||
copiedMAFasts >= limit &&
|
copiedMAFasts >= limit &&
|
||||||
copiedMASlows >= limit
|
copiedMASlows >= limit &&
|
||||||
|
copiedMASuperSlows >= limit
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (!isPassedRequiredCopiedItems)
|
if (!isPassedRequiredCopiedItems)
|
||||||
@@ -527,6 +615,12 @@ bool ValidateInputs()
|
|||||||
// KI ...
|
// KI ...
|
||||||
kiFastLength >= 5 &&
|
kiFastLength >= 5 &&
|
||||||
kiSlowLength > kiFastLength &&
|
kiSlowLength > kiFastLength &&
|
||||||
|
kiSuperSlowLength > kiSlowLength &&
|
||||||
|
//
|
||||||
|
// MA ...
|
||||||
|
maFastLength >= 2 &&
|
||||||
|
maSlowLength > maFastLength &&
|
||||||
|
maSuperSlowLength > maSlowLength &&
|
||||||
//
|
//
|
||||||
// ATR ...
|
// ATR ...
|
||||||
atrLength >= 5 &&
|
atrLength >= 5 &&
|
||||||
@@ -552,8 +646,12 @@ int ExtractMaxLengthOfInputs()
|
|||||||
|
|
||||||
//
|
//
|
||||||
result = MathMax(kiFastLength, atrLength);
|
result = MathMax(kiFastLength, atrLength);
|
||||||
result = MathMax(result, kiSlowLength);
|
|
||||||
result = MathMax(result, rsiLength);
|
result = MathMax(result, rsiLength);
|
||||||
|
result = MathMax(result, kiSlowLength);
|
||||||
|
result = MathMax(result, maFastLength);
|
||||||
|
result = MathMax(result, maSlowLength);
|
||||||
|
result = MathMax(result, maSuperSlowLength);
|
||||||
|
result = MathMax(result, kiSuperSlowLength);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (atrSmoothingLength > 0)
|
if (atrSmoothingLength > 0)
|
||||||
@@ -610,6 +708,24 @@ void DefineBuffers()
|
|||||||
SetIndexBuffer(kiSlowStateBufferIndex, kiSlowStateBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(kiSlowStateBufferIndex, kiSlowStateBuffer, INDICATOR_CALCULATIONS);
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region KI Super Slow ...
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(kiSuperSlowBuffer, true);
|
||||||
|
SetIndexBuffer(kiSuperSlowBufferIndex, kiSuperSlowBuffer, INDICATOR_DATA);
|
||||||
|
|
||||||
|
//
|
||||||
|
PlotIndexSetInteger(kiSuperSlowBufferPlotIndex, PLOT_SHOW_DATA, showKISuperSlow);
|
||||||
|
PlotIndexSetDouble(kiSuperSlowBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(kiSuperSlowColorBuffer, true);
|
||||||
|
SetIndexBuffer(kiSuperSlowColorBufferIndex, kiSuperSlowColorBuffer, INDICATOR_COLOR_INDEX);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(kiSuperSlowStateBuffer, true);
|
||||||
|
SetIndexBuffer(kiSuperSlowStateBufferIndex, kiSuperSlowStateBuffer, INDICATOR_CALCULATIONS);
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region KI Upper ...
|
// #region KI Upper ...
|
||||||
//
|
//
|
||||||
ENUM_DRAW_TYPE kiUpperDrawType = showKIUpper ? DRAW_LINE : DRAW_NONE;
|
ENUM_DRAW_TYPE kiUpperDrawType = showKIUpper ? DRAW_LINE : DRAW_NONE;
|
||||||
@@ -666,6 +782,44 @@ void DefineBuffers()
|
|||||||
SetIndexBuffer(kiWaveStateBufferIndex, kiWaveStateBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(kiWaveStateBufferIndex, kiWaveStateBuffer, INDICATOR_CALCULATIONS);
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region PV ...
|
||||||
|
//
|
||||||
|
// PEAK / VALE ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_DRAW_TYPE pvDrawType = showPV ? DRAW_ARROW : DRAW_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// PEAK ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(peakBuffer, true);
|
||||||
|
SetIndexBuffer(peakBufferIndex, peakBuffer, INDICATOR_DATA);
|
||||||
|
|
||||||
|
//
|
||||||
|
PlotIndexSetInteger(peakBufferPlotIndex, PLOT_SHOW_DATA, showPV);
|
||||||
|
PlotIndexSetInteger(peakBufferPlotIndex, PLOT_DRAW_TYPE, pvDrawType);
|
||||||
|
|
||||||
|
//
|
||||||
|
PlotIndexSetDouble(peakBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||||
|
PlotIndexSetInteger(peakBufferPlotIndex, PLOT_ARROW, peakArrowCode);
|
||||||
|
|
||||||
|
//
|
||||||
|
// VALE ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(valeBuffer, true);
|
||||||
|
SetIndexBuffer(valeBufferIndex, valeBuffer, INDICATOR_DATA);
|
||||||
|
|
||||||
|
//
|
||||||
|
PlotIndexSetInteger(valeBufferPlotIndex, PLOT_SHOW_DATA, showPV);
|
||||||
|
PlotIndexSetInteger(valeBufferPlotIndex, PLOT_DRAW_TYPE, pvDrawType);
|
||||||
|
|
||||||
|
//
|
||||||
|
PlotIndexSetDouble(valeBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||||
|
PlotIndexSetInteger(valeBufferPlotIndex, PLOT_ARROW, valeArrowCode);
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region ATR ...
|
// #region ATR ...
|
||||||
//
|
//
|
||||||
ArraySetAsSeries(atrBuffer, true);
|
ArraySetAsSeries(atrBuffer, true);
|
||||||
@@ -714,6 +868,21 @@ void DefineBuffers()
|
|||||||
PlotIndexSetInteger(maSlowBufferPlotIndex, PLOT_DRAW_TYPE, maSlowDrawType);
|
PlotIndexSetInteger(maSlowBufferPlotIndex, PLOT_DRAW_TYPE, maSlowDrawType);
|
||||||
PlotIndexSetDouble(maSlowBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
PlotIndexSetDouble(maSlowBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region Super Slow ...
|
||||||
|
//
|
||||||
|
ENUM_DRAW_TYPE maSuperSlowDrawType = showMaSuperSlow ? DRAW_LINE : DRAW_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Slow ...
|
||||||
|
ArraySetAsSeries(maSuperSlowBuffer, true);
|
||||||
|
SetIndexBuffer(maSuperSlowBufferIndex, maSuperSlowBuffer, INDICATOR_DATA);
|
||||||
|
|
||||||
|
//
|
||||||
|
PlotIndexSetInteger(maSuperSlowBufferPlotIndex, PLOT_SHOW_DATA, showMaSuperSlow);
|
||||||
|
PlotIndexSetInteger(maSuperSlowBufferPlotIndex, PLOT_DRAW_TYPE, maSuperSlowDrawType);
|
||||||
|
PlotIndexSetDouble(maSuperSlowBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||||
|
// #endregion
|
||||||
// #endregion
|
// #endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,6 +942,7 @@ bool InitRequirements()
|
|||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// MA Slow ...
|
// MA Slow ...
|
||||||
maSlowHandler = iMA(
|
maSlowHandler = iMA(
|
||||||
@@ -789,6 +959,22 @@ bool InitRequirements()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// MA Super Slow ...
|
||||||
|
maSuperSlowHandler = iMA(
|
||||||
|
_Symbol,
|
||||||
|
_Period,
|
||||||
|
maSuperSlowLength,
|
||||||
|
0,
|
||||||
|
maMethod,
|
||||||
|
maAppliedTo //
|
||||||
|
);
|
||||||
|
result = maSuperSlowHandler != INVALID_HANDLE;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -904,6 +1090,19 @@ void CalculateValues(
|
|||||||
//
|
//
|
||||||
// Common Requirements ...
|
// Common Requirements ...
|
||||||
|
|
||||||
|
// #region PV ...
|
||||||
|
CalculatePV(
|
||||||
|
barIndex,
|
||||||
|
prevCalculated,
|
||||||
|
ratesTotal,
|
||||||
|
open,
|
||||||
|
high,
|
||||||
|
close,
|
||||||
|
low,
|
||||||
|
tickVolume //
|
||||||
|
);
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region KI ...
|
// #region KI ...
|
||||||
CalculateKI(
|
CalculateKI(
|
||||||
barIndex,
|
barIndex,
|
||||||
@@ -930,6 +1129,19 @@ void CalculateValues(
|
|||||||
);
|
);
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region KI Super Slow ...
|
||||||
|
CalculateKISuperSlow(
|
||||||
|
barIndex,
|
||||||
|
prevCalculated,
|
||||||
|
ratesTotal,
|
||||||
|
open,
|
||||||
|
high,
|
||||||
|
close,
|
||||||
|
low,
|
||||||
|
tickVolume //
|
||||||
|
);
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region ATR (Ki Upper/Lower) ...
|
// #region ATR (Ki Upper/Lower) ...
|
||||||
CalculateATR(
|
CalculateATR(
|
||||||
barIndex,
|
barIndex,
|
||||||
@@ -1147,6 +1359,185 @@ void CalculateKISlow(
|
|||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate KI Super Slow Bufer ...
|
||||||
|
*
|
||||||
|
* @param barIndex: int, Specified Bar Index ...
|
||||||
|
* @param prevCalculated: int, Provides Previous Calculated Bars ...
|
||||||
|
* @param ratesTotal: int, Provides All Availabled Bars ...
|
||||||
|
* @param open: double Collection, Provides Open Prices Time Series ...
|
||||||
|
* @param high: double Collection, Provides High Prices Time Series ...
|
||||||
|
* @param close: double Collection, Provides Close Prices Time Series ...
|
||||||
|
* @param low: double Collection, Provides Low Prices Time Series ...
|
||||||
|
* @param tickVolume: long Collection, Provides Ticks Volume Prices Time Series ...
|
||||||
|
*/
|
||||||
|
void CalculateKISuperSlow(
|
||||||
|
int barIndex,
|
||||||
|
const int prevCalculated,
|
||||||
|
const int ratesTotal,
|
||||||
|
const double &open[],
|
||||||
|
const double &high[],
|
||||||
|
const double &close[],
|
||||||
|
const double &low[],
|
||||||
|
const long &tickVolume[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int lastBarIndex = barIndex + 1;
|
||||||
|
bool isFirstBar =
|
||||||
|
startCalculationForLastBars > 0
|
||||||
|
? barIndex == startCalculationForLastBars
|
||||||
|
: barIndex == firstBarIndex;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isInited = iBar.Init(
|
||||||
|
_Symbol,
|
||||||
|
_Period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double iClose = close[barIndex];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate KI / Color ...
|
||||||
|
double lastKI =
|
||||||
|
isFirstBar
|
||||||
|
? emptyValue
|
||||||
|
: kiSuperSlowBuffer[lastBarIndex];
|
||||||
|
double iKI = lastKI;
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double iLLKI = iBar.FindLowest(kiSuperSlowLength, MODE_LOW);
|
||||||
|
double iHHKI = iBar.FindHighest(kiSuperSlowLength, MODE_HIGH);
|
||||||
|
|
||||||
|
//
|
||||||
|
iKI = (iHHKI + iLLKI) / 2;
|
||||||
|
if (iLLKI == 0 || iHHKI == 0)
|
||||||
|
{
|
||||||
|
iKI = lastKI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iKI = lastKI;
|
||||||
|
}
|
||||||
|
kiSuperSlowBuffer[barIndex] = iKI;
|
||||||
|
|
||||||
|
//
|
||||||
|
double iKIState = neuturalState;
|
||||||
|
double iKIColor = neuturalColorIDX;
|
||||||
|
if (iClose > iKI)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iKIState = bullishState;
|
||||||
|
iKIColor =
|
||||||
|
!showKISuperSlow
|
||||||
|
? hideColorIDX
|
||||||
|
: bullishColorIDX;
|
||||||
|
}
|
||||||
|
else if (iClose < iKI)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iKIState = bearishState;
|
||||||
|
iKIColor =
|
||||||
|
!showKISuperSlow
|
||||||
|
? hideColorIDX
|
||||||
|
: bearishColorIDX;
|
||||||
|
}
|
||||||
|
kiSuperSlowStateBuffer[barIndex] = iKIState;
|
||||||
|
kiSuperSlowColorBuffer[barIndex] = iKIColor;
|
||||||
|
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate PV Bufer ...
|
||||||
|
*
|
||||||
|
* @param barIndex: int, Specified Bar Index ...
|
||||||
|
* @param prevCalculated: int, Provides Previous Calculated Bars ...
|
||||||
|
* @param ratesTotal: int, Provides All Availabled Bars ...
|
||||||
|
* @param open: double Collection, Provides Open Prices Time Series ...
|
||||||
|
* @param high: double Collection, Provides High Prices Time Series ...
|
||||||
|
* @param close: double Collection, Provides Close Prices Time Series ...
|
||||||
|
* @param low: double Collection, Provides Low Prices Time Series ...
|
||||||
|
* @param tickVolume: long Collection, Provides Ticks Volume Prices Time Series ...
|
||||||
|
*/
|
||||||
|
void CalculatePV(
|
||||||
|
int barIndex,
|
||||||
|
const int prevCalculated,
|
||||||
|
const int ratesTotal,
|
||||||
|
const double &open[],
|
||||||
|
const double &high[],
|
||||||
|
const double &close[],
|
||||||
|
const double &low[],
|
||||||
|
const long &tickVolume[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int lastBarIndex = barIndex + 1;
|
||||||
|
bool isFirstBar =
|
||||||
|
startCalculationForLastBars > 0
|
||||||
|
? barIndex == startCalculationForLastBars
|
||||||
|
: barIndex == firstBarIndex;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isInited = iBar.Init(
|
||||||
|
_Symbol,
|
||||||
|
_Period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Peak ...
|
||||||
|
double lastPeak =
|
||||||
|
isFirstBar
|
||||||
|
? emptyValue
|
||||||
|
: peakBuffer[lastBarIndex];
|
||||||
|
double lastVale =
|
||||||
|
isFirstBar
|
||||||
|
? emptyValue
|
||||||
|
: valeBuffer[lastBarIndex];
|
||||||
|
double iPeak = lastPeak;
|
||||||
|
double iVale = lastVale;
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int length = maxLength;
|
||||||
|
|
||||||
|
//
|
||||||
|
double iLL = iBar.FindLowest(length, MODE_LOW);
|
||||||
|
double iHH = iBar.FindHighest(length, MODE_HIGH);
|
||||||
|
|
||||||
|
//
|
||||||
|
double iLL2 = iBar.FindLowest(length / 2, MODE_LOW);
|
||||||
|
double iHH2 = iBar.FindHighest(length / 2, MODE_HIGH);
|
||||||
|
|
||||||
|
//
|
||||||
|
iPeak = iHH == iHH2 ? iHH : lastPeak;
|
||||||
|
iVale = iLL == iLL2 ? iLL : lastVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
lastPeak = iPeak;
|
||||||
|
lastVale = iVale;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iPeak = lastPeak;
|
||||||
|
iVale = lastVale;
|
||||||
|
}
|
||||||
|
peakBuffer[barIndex] = iPeak;
|
||||||
|
valeBuffer[barIndex] = iVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate ATR and Ki Upper/Lower Buffers ...
|
* Calculate ATR and Ki Upper/Lower Buffers ...
|
||||||
*
|
*
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1067,8 +1067,51 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Conditions ...
|
// Summarize Result ...
|
||||||
result = isBullish || isBearish;
|
result = isBullish || isBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Count Touches ...
|
||||||
|
int bullishTouches = 0;
|
||||||
|
int bearishTouches = 0;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
kiParser.CountTouches(
|
||||||
|
bullishTouches,
|
||||||
|
bearishTouches,
|
||||||
|
barIndex,
|
||||||
|
4 // Loopback ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
bullishTouches >= bearishTouches;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
bearishTouches >= bullishTouches;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Summarize Result ...
|
||||||
|
result = isBullish || isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isBullish = false;
|
||||||
|
isBearish = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (bullishTouches > 0 || bearishTouches > 0)
|
||||||
|
{
|
||||||
|
// DebugBreak();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1617,326 +1660,6 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
|||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Signals ...
|
|
||||||
|
|
||||||
// #region POI ...
|
|
||||||
bool IsBullishPOILongEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// IMPORTANT: Use near Support/Resistance ...
|
|
||||||
bool result = poiDetector.IsBullishPOI(barIndex) &&
|
|
||||||
kiParser.IsSafeBullishEntry(barIndex) &&
|
|
||||||
IsTFBullishPattern(barIndex, lowerTF);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsBearishPOIShortEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// IMPORTANT: Use near Support/Resistance ...
|
|
||||||
bool result = poiDetector.IsBearishPOI(barIndex) &&
|
|
||||||
kiParser.IsSafeBearishEntry(barIndex) &&
|
|
||||||
IsTFBearishPattern(barIndex, lowerTF);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitBullishPOILong(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBearishReversalPOI(barIndex) ||
|
|
||||||
poiDetector.IsBearishBreakoutPOI(barIndex) ||
|
|
||||||
poiDetector.IsBearishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitBearishPOIShort(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBullishReversalPOI(barIndex) ||
|
|
||||||
poiDetector.IsBullishBreakoutPOI(barIndex) ||
|
|
||||||
poiDetector.IsBullishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Breakout ...
|
|
||||||
bool IsBreakoutLongEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
kiParser.IsVolatilityHigh(barIndex) &&
|
|
||||||
IsTFBullishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBullishBreakoutPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsBreakoutShortEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
kiParser.IsVolatilityHigh(barIndex) &&
|
|
||||||
IsTFBearishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBearishBreakoutPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitBreakoutLong(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBearishReversalPOI(barIndex) ||
|
|
||||||
poiDetector.IsBearishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitBreakoutShort(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBullishReversalPOI(barIndex) ||
|
|
||||||
poiDetector.IsBullishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Reversal ...
|
|
||||||
bool IsReversalLongEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
kiParser.IsRSIBullish(barIndex) &&
|
|
||||||
IsTFBullishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBullishReversalPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsReversalShortEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
kiParser.IsRSIBearish(barIndex) &&
|
|
||||||
IsTFBearishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBearishReversalPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitReversalLong(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBearishBreakoutPOI(barIndex) ||
|
|
||||||
poiDetector.IsBearishContinuationPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitReversalShort(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBullishBreakoutPOI(barIndex) ||
|
|
||||||
poiDetector.IsBullishContinuationPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Continuation ...
|
|
||||||
bool IsContinuationLongEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
IsTFBullishPattern(barIndex, lowerTF) &&
|
|
||||||
kiParser.IsTrendStrongBullish(barIndex) &&
|
|
||||||
poiDetector.IsBullishContinuationPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsContinuationShortEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
IsTFBearishPattern(barIndex, lowerTF) &&
|
|
||||||
kiParser.IsTrendStrongBearish(barIndex) &&
|
|
||||||
poiDetector.IsBearishContinuationPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitContinuationLong(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBearishReversalPOI(barIndex) ||
|
|
||||||
poiDetector.IsBearishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitContinuationShort(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBullishReversalPOI(barIndex) ||
|
|
||||||
poiDetector.IsBullishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Exhaustion ...
|
|
||||||
bool IsExhaustionLongEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
IsTFBullishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBearishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsExhaustionShortEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
IsTFBearishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBullishExhaustionPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitExhaustionLong(int barIndex = 0)
|
|
||||||
{
|
|
||||||
return poiDetector.IsBearishBreakoutPOI(barIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitExhaustionShort(int barIndex = 0)
|
|
||||||
{
|
|
||||||
return poiDetector.IsBullishBreakoutPOI(barIndex);
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Trend Exhaustion ...
|
|
||||||
bool IsTrendExhaustionLongEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
IsTFBullishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBearishTrendExhaustedPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsTrendExhaustionShortEntry(
|
|
||||||
int barIndex = 0,
|
|
||||||
ENUM_TIMEFRAMES lowerTF = PERIOD_M5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
IsTFBearishPattern(barIndex, lowerTF) &&
|
|
||||||
poiDetector.IsBullishTrendExhaustedPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitTrendExhaustionLong(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBearishBreakoutPOI(barIndex) ||
|
|
||||||
poiDetector.IsBearishContinuationPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExitTrendExhaustionShort(int barIndex = 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result =
|
|
||||||
poiDetector.IsBullishBreakoutPOI(barIndex) ||
|
|
||||||
poiDetector.IsBullishContinuationPOI(barIndex);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region TF Patterns ...
|
// #region TF Patterns ...
|
||||||
bool IsTFBullishPattern(
|
bool IsTFBullishPattern(
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user