last works ...
This commit is contained in:
+1576
-1044
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,825 @@
|
||||
|
||||
int CountKIFastTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetKIFast(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int CountKISlowTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetKISlow(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int CountKISuperSlowTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetKISuperSlow(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int CountKIUpperTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetKIUpper(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int CountKILowerTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetKILower(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int CountMAFastTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetMAFast(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int CountMASlowTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetMASlow(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int CountMASuperSlowTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetMASuperSlow(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,22 +8,21 @@
|
||||
{
|
||||
"id": "61ca33e6-05e4-4b44-b88d-3bc8ae5cba86",
|
||||
"title": "To Do",
|
||||
"cards": [
|
||||
{
|
||||
"id": "a59a73f4-1ab4-477b-893e-b2dfb71fe6ea",
|
||||
"listId": "61ca33e6-05e4-4b44-b88d-3bc8ae5cba86",
|
||||
"title": "Add Support for PV in XKI Indicator.",
|
||||
"description": "",
|
||||
"labels": [],
|
||||
"checkboxes": [],
|
||||
"comments": []
|
||||
}
|
||||
]
|
||||
"cards": []
|
||||
},
|
||||
{
|
||||
"id": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
|
||||
"title": "Doing",
|
||||
"cards": [
|
||||
{
|
||||
"id": "a59a73f4-1ab4-477b-893e-b2dfb71fe6ea",
|
||||
"listId": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
|
||||
"title": "Add Support for PV in XKI Indicator.",
|
||||
"description": "",
|
||||
"labels": [],
|
||||
"checkboxes": [],
|
||||
"comments": []
|
||||
},
|
||||
{
|
||||
"id": "f8eb6951-f337-40da-9b98-e468f77709fd",
|
||||
"listId": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
|
||||
@@ -57,6 +56,506 @@
|
||||
"labels": [],
|
||||
"checkboxes": [],
|
||||
"comments": []
|
||||
},
|
||||
{
|
||||
"id": "bcb422f9-89db-4816-ba3a-bae95c9c8da4",
|
||||
"listId": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
|
||||
"title": "Test all XKI Helper Functions",
|
||||
"description": "Test all KI Parser Conditional Tools ...\n ",
|
||||
"labels": [],
|
||||
"checkboxes": [
|
||||
{
|
||||
"id": "987aadc7-1775-4ddb-96a8-c7867b41c5dc",
|
||||
"title": "IsKIFastBullish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "33d30e91-1d65-4cc9-8955-4fcdac1a1a1c",
|
||||
"title": "IsKIFastBearish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "f5efdef3-3dd5-4a67-9335-27ade4a08119",
|
||||
"title": "IsKIFastSwitchedToBullish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "95fd5f87-3076-4a10-9d1d-2190c74e77dc",
|
||||
"title": "IsKIFastSwitchedToBearish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "5848cd3c-7f60-4310-adde-56d0e80896a2",
|
||||
"title": "IsKIFastOverLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "879b6657-8a36-4329-9edd-2b5243733c37",
|
||||
"title": "IsKIFastUnderLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "7ebd6627-2bd7-47b1-9b3c-51643a446cb3",
|
||||
"title": "IsKIFastSameAsLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "4533e930-8c54-45ea-95b8-a95aa9278bd8",
|
||||
"title": "IsKIFastSwitchedOverLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "1231584a-5181-457b-8f31-02da2962c54a",
|
||||
"title": "IsKIFastSwitchedUnderLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "67f9ccdb-eff3-4e1e-945b-5232773f16f5",
|
||||
"title": "IsKISlowBullish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "2262f093-f7c9-4a73-983c-055b6098f915",
|
||||
"title": "IsKISlowBearish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "0e6b67fe-0ff5-4783-a4e3-36b3a70007f5",
|
||||
"title": "IsKISlowSwitchedToBullish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "0ec4ea00-63bc-4059-92e2-46afa6793325",
|
||||
"title": "IsKISlowSwitchedToBearish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "cf71aa02-fbf9-4f42-a4f2-791353cc290e",
|
||||
"title": "IsKISlowOverLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "da046ac2-0ed5-4c45-ba5b-ffd31a1f65a3",
|
||||
"title": "IsKISlowUnderLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "f57c9dde-9294-4909-b5c8-4a8a9a661072",
|
||||
"title": "IsKISlowSameAsLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "c52951e5-7a57-4823-a061-9d7a4aa9f0f4",
|
||||
"title": "IsKISlowSwitchedOverLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "9e523117-d742-4ffa-ae7d-cbd995b6bc61",
|
||||
"title": "IsKISlowSwitchedUnderLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "3ae34a28-6172-4209-832d-41647e45c072",
|
||||
"title": "IsKISuperSlowBullish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "a7720bdf-2535-430f-9f55-81fa2d281910",
|
||||
"title": "IsKISuperSlowBearish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "b03e521f-d1b4-4e83-9aaa-6a65297420d5",
|
||||
"title": "IsKISuperSlowSwitchedToBullish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "3a59a397-816d-4e41-93cd-cab889ebcc1e",
|
||||
"title": "IsKISuperSlowSwitchedToBearish",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "315380e3-702b-41bf-abf5-4b85c0e00ce4",
|
||||
"title": "IsKISuperSlowOverLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "3a18f5b6-f18e-43d8-b8e6-43fc530ac80d",
|
||||
"title": "IsKISuperSlowUnderLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "4174d12c-382f-4615-9a65-99c447fa6a2a",
|
||||
"title": "IsKISuperSlowSameAsLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "03c1fc35-b0c4-477f-ab30-d183a990aff1",
|
||||
"title": "IsKISuperSlowSwitchedOverLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "82f549d7-6afa-4408-9d3a-d41d4d623bb7",
|
||||
"title": "IsKISuperSlowSwitchedUnderLast",
|
||||
"checked": true
|
||||
},
|
||||
{
|
||||
"id": "abd7362a-29ba-4f92-9fe0-0496ccb7e9c6",
|
||||
"title": "IsKIWaveBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "440e446f-9aa9-4f74-a950-63a013b42fa5",
|
||||
"title": "IsKIWaveBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "2606bddb-aae1-4cca-8a29-b11c9f7015e6",
|
||||
"title": "IsKIWaveSwitchedToBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "2036fddf-c4eb-4c5d-a550-d3f84341e78b",
|
||||
"title": "IsKIWaveSwitchedToBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "649905b4-d0e9-4009-aeda-08a633861201",
|
||||
"title": "IsKIWaveOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "cc181a1f-298a-438d-afc8-74b0d4200228",
|
||||
"title": "IsKIWaveUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "66bafec6-7794-4650-8919-d6409b49fbdf",
|
||||
"title": "IsKIWaveSwitchedOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "a5a714cb-ea11-42e3-8e9c-8745405998ae",
|
||||
"title": "IsKIWaveSwitchedUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "b94e9071-5f85-4a38-828c-7cf8a1e99a63",
|
||||
"title": "IsPriceOverKIUpper",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "c3a7d88b-c81f-46d4-a3cc-a0d1f5597371",
|
||||
"title": "IsPriceUnderKIUpper",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "1efcb06a-0edd-41d0-8e8b-18cba4f64226",
|
||||
"title": "IsPriceOverKILower",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "7e95d7e0-a50f-412b-a024-2568bf66c3f1",
|
||||
"title": "IsPriceUnderKILower",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "d747f70e-af68-42f1-a621-efd3ce518b47",
|
||||
"title": "IsPriceInsideKIBands",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "f534622b-5a7f-4c9c-85ed-c562d907fd89",
|
||||
"title": "IsPriceSwitchedOverKIUpper",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "8e559cb9-f6a9-412e-8882-e622030cf838",
|
||||
"title": "IsPriceSwitchedUnderKIUpper",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "b16ad1a1-1fb2-4bb6-b2f8-f9310d012f4f",
|
||||
"title": "IsPriceSwitchedOverKILower",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "dd0deb1f-a259-4ce9-a471-92e268e10abe",
|
||||
"title": "IsPriceSwitchedUnderKILower",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "ebf997ee-8944-4442-86fb-6d01ea64b8a6",
|
||||
"title": "IsMAFastBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "11eb8b4c-004c-4272-921f-4067315aac6a",
|
||||
"title": "IsMAFastBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "90451b0f-ec2e-48e0-8797-7f48cedf743c",
|
||||
"title": "IsMAFastOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "6158296f-fec3-443e-826b-84a481225013",
|
||||
"title": "IsMAFastUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "14210197-c670-4f49-8935-b65926945837",
|
||||
"title": "IsMAFastSwitchedOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "e84b372e-fbdc-45da-a604-76a0fc6381c4",
|
||||
"title": "IsMAFastSwitchedUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "e756a5d0-4477-4277-be7d-5897079add6a",
|
||||
"title": "IsMAFastSwitchedToBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "548819d7-06fa-4ca5-adf2-c4c2d3064d7e",
|
||||
"title": "IsMAFastSwitchedToBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "ef0feb55-069c-4e9a-a56e-de05f6b6801f",
|
||||
"title": "IsMASlowBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "630cd36a-f848-44d6-958b-728c4757df6e",
|
||||
"title": "IsMASlowBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "acca2b2e-27d6-44dc-bd7f-98857e1b7e64",
|
||||
"title": "IsMASlowOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "49631b5a-8b69-4649-a47d-bef5bda3e137",
|
||||
"title": "IsMASlowUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "762fd136-113c-444f-8373-2104bc4db466",
|
||||
"title": "IsMASlowSwitchedOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "3cd7c2a1-8a8a-4aba-85c2-6279a356c49e",
|
||||
"title": "IsMASlowSwitchedUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "0568553a-8ad1-4588-834e-26befe2a9bbb",
|
||||
"title": "IsMASlowSwitchedToBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "62899e4a-87da-4fc9-8b4b-f1b8b077c177",
|
||||
"title": "IsMASlowSwitchedToBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "43bbc4df-7601-4460-b636-61b73b30f10a",
|
||||
"title": "IsMASuperSlowBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "91c30277-6ea9-40e8-8467-d06beabf486b",
|
||||
"title": "IsMASuperSlowBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "0a102b6a-fabe-4aba-938f-d87a22e11b5e",
|
||||
"title": "IsMASuperSlowOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "97e4a349-77c8-4997-8f1b-875fff8229ab",
|
||||
"title": "IsMASuperSlowUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "cc1a7131-227d-4007-82ed-78c8cc9ef33e",
|
||||
"title": "IsMASuperSlowSwitchedOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "93899467-f06d-420a-ac6e-e645c8c07389",
|
||||
"title": "IsMASuperSlowSwitchedUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "a64507e6-c99a-4e6a-a995-c1be671d1083",
|
||||
"title": "IsMASuperSlowSwitchedToBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "65295670-87f7-481c-ab9e-a92c8606923f",
|
||||
"title": "IsMASuperSlowSwitchedToBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "2cbc64ba-1882-47a6-9206-7b25e8008395",
|
||||
"title": "IsMACrossoverBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "44b233e6-5a56-4f3a-9c28-60e11aa2059a",
|
||||
"title": "IsMACrossoverBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "d7af351b-1de4-4ca9-958a-388d944d4fa9",
|
||||
"title": "IsMACrossoverSwitchedToBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "5af39475-d1f8-477f-b867-5359aaaf94fa",
|
||||
"title": "IsMACrossoverSwitchedToBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "dd69c2c0-c999-4235-8cb5-74607b27c7ec",
|
||||
"title": "IsATRBreakoutUp",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "1a77e8e1-b3e8-48b4-b072-1cda3a69c6f9",
|
||||
"title": "IsATRBreakoutDown",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "bfeb3c24-f0ed-4aed-99af-bec8db026a62",
|
||||
"title": "IsATROverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "62881e04-9b38-49e4-ae9d-e5161c1b0b5c",
|
||||
"title": "IsATRUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "33ec5ba0-d31a-4602-ba79-7d3b4d9d7986",
|
||||
"title": "IsATRSwitchedOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "cf0fb674-8dfc-4ed1-b1dd-5a8447d818a4",
|
||||
"title": "IsATRSwitchedUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "ab07c8e5-454c-4c9b-a69d-fa2e8330a2e0",
|
||||
"title": "IsVolatilityHigh",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "031521be-0062-4d07-ade4-ff17782888c7",
|
||||
"title": "IsVolatilityLow",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "49376783-45aa-4a57-a304-3547babf0ccd",
|
||||
"title": "IsVolatilitySwitchdToHigh",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "5803601b-9143-471d-968f-59622d37b70a",
|
||||
"title": "IsVolatilitySwitchdToLow",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "0ab99ddc-75b8-45c7-9140-8cd3dc6921c6",
|
||||
"title": "IsRSIBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "ba39f76c-2257-48fe-94ca-addf2148ee23",
|
||||
"title": "IsRSIBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "91c098b3-56d8-4728-b411-edf7e42d60b0",
|
||||
"title": "IsRSIOverbought",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "7917431d-9bc9-4514-8aea-7fae7c11b0de",
|
||||
"title": "IsRSIOversold",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "83d4b28b-fe6c-411c-a209-c57e3c8251d0",
|
||||
"title": "IsRSISwitchedToOverSold",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "96493d94-9db6-49de-a7f1-e3990b9469b8",
|
||||
"title": "IsRSISwitchedFromOverSold",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "02579268-284f-40f3-93c9-0cb3f70d103a",
|
||||
"title": "IsRSISwitchedToOverbought",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "6c473b2e-1b37-44b2-a08c-ce6217d0c00e",
|
||||
"title": "IsRSISwitchedFromOverbought",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "30177c7a-47df-4d90-8132-0f467ebc071c",
|
||||
"title": "IsRSISwitchedToBullish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "a3e07f9c-72da-49b4-8101-f742644a2b81",
|
||||
"title": "IsRSISwitchedToBearish",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "d2a8183b-3553-4016-8155-a114c70da5ec",
|
||||
"title": "IsPeakSameAsLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "7395f77c-7491-417e-8ca8-a41923b46b68",
|
||||
"title": "IsPeakOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "afdae94d-1a14-408d-b1bd-e84c0868a655",
|
||||
"title": "IsPeakUnderLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "45f52be4-1f08-4e7a-b15b-d8db48752449",
|
||||
"title": "IsValeSameAsLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "ebc003bc-850d-44e2-a0ed-5ddaba71ae1a",
|
||||
"title": "IsValeOverLast",
|
||||
"checked": false
|
||||
},
|
||||
{
|
||||
"id": "c979f0c3-e356-4fa6-bead-596e4a06b962",
|
||||
"title": "IsValeUnderLast",
|
||||
"checked": false
|
||||
}
|
||||
],
|
||||
"comments": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -24,6 +24,140 @@
|
||||
// Imports ...
|
||||
#include "../Classes/x-saherelm.x-helper.class.mq5"
|
||||
|
||||
// #region Definitions ...
|
||||
enum ENUM_X121_XKI_BUFFER_NAME
|
||||
{
|
||||
X121_XKI_NONE = 0,
|
||||
X121_XKI_FAST = 1,
|
||||
X121_XKI_SLOW = 2,
|
||||
X121_XKI_SUPER_SLOW = 3,
|
||||
X121_XKI_UPPER = 4,
|
||||
X121_XKI_LOWER = 5,
|
||||
X121_XKI_WAVE = 6,
|
||||
X121_XKI_MA_FAST = 7,
|
||||
X121_XKI_MA_SLOW = 8,
|
||||
X121_XKI_MA_SUPER_SLOW = 9,
|
||||
X121_XKI_MA_CROSS = 10,
|
||||
X121_XKI_ATR = 11,
|
||||
};
|
||||
|
||||
bool IsXValid(ENUM_X121_XKI_BUFFER_NAME value)
|
||||
{
|
||||
return value != X121_XKI_NONE;
|
||||
}
|
||||
string ToXString(ENUM_X121_XKI_BUFFER_NAME value)
|
||||
{
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
if (IsXValid(value))
|
||||
{
|
||||
//
|
||||
switch (value)
|
||||
{
|
||||
//
|
||||
case X121_XKI_FAST:
|
||||
result = "FAST";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_SLOW:
|
||||
result = "SLOW";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_SUPER_SLOW:
|
||||
result = "SUPER_SLOW";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_UPPER:
|
||||
result = "UPPER";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_LOWER:
|
||||
result = "LOWER";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_WAVE:
|
||||
result = "WAVE";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_MA_FAST:
|
||||
result = "MA_FAST";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_MA_SLOW:
|
||||
result = "MA_SLOW";
|
||||
break;
|
||||
|
||||
//
|
||||
case X121_XKI_MA_SUPER_SLOW:
|
||||
result = "MA_SUPER_SLOW";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
ENUM_X121_XKI_BUFFER_NAME ToXKIBufferName(string value)
|
||||
{
|
||||
//
|
||||
ENUM_X121_XKI_BUFFER_NAME result = X121_XKI_NONE;
|
||||
|
||||
//
|
||||
if (IsXValid(value))
|
||||
{
|
||||
//
|
||||
if (value == ToXString(X121_XKI_FAST))
|
||||
{
|
||||
result = X121_XKI_FAST;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_SLOW))
|
||||
{
|
||||
result = X121_XKI_SLOW;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_SUPER_SLOW))
|
||||
{
|
||||
result = X121_XKI_SUPER_SLOW;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_UPPER))
|
||||
{
|
||||
result = X121_XKI_UPPER;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_LOWER))
|
||||
{
|
||||
result = X121_XKI_LOWER;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_WAVE))
|
||||
{
|
||||
result = X121_XKI_WAVE;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_MA_FAST))
|
||||
{
|
||||
result = X121_XKI_MA_FAST;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_MA_SLOW))
|
||||
{
|
||||
result = X121_XKI_MA_SLOW;
|
||||
}
|
||||
else if (value == ToXString(X121_XKI_MA_SUPER_SLOW))
|
||||
{
|
||||
result = X121_XKI_MA_SUPER_SLOW;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region Buffers ...
|
||||
enum ENUM_X121_XKI_BUFFERS
|
||||
{
|
||||
@@ -86,6 +220,8 @@ struct X121XKIInputs
|
||||
int maSuperSlowLength; // MA Super Slow Length
|
||||
ENUM_MA_METHOD maMethod; // MA Mode
|
||||
ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
||||
double rsiBullishConfirmation; // RSI Bullish Confirmation Level
|
||||
double rsiBearishConfirmation; // RSI Bearish Confirmation Level
|
||||
int rsiLength; // RSI Length
|
||||
ENUM_APPLIED_PRICE rsiAppliedTo; // RSI Applied To
|
||||
int kiWaveSmoothingLength; // RSI KI Wave Smoothing Length
|
||||
@@ -151,6 +287,8 @@ struct X121XKIInputs
|
||||
maAppliedTo = PRICE_CLOSE;
|
||||
rsiLength = 14;
|
||||
rsiAppliedTo = PRICE_CLOSE;
|
||||
rsiBullishConfirmation = 55;
|
||||
rsiBearishConfirmation = 45;
|
||||
kiWaveSmoothingLength = 14;
|
||||
kiWaveSmoothingMode = X_MA_MODE_EMA;
|
||||
rsiMultiplier = 0.5;
|
||||
@@ -224,7 +362,11 @@ struct X121XKIInputs
|
||||
atrLength >= 5 &&
|
||||
//
|
||||
// RSI ...
|
||||
rsiLength >= 5
|
||||
rsiLength >= 5 &&
|
||||
rsiBullishConfirmation > 0 &&
|
||||
rsiBullishConfirmation < 100 &&
|
||||
rsiBearishConfirmation > 0 &&
|
||||
rsiBearishConfirmation < 100
|
||||
//
|
||||
;
|
||||
|
||||
@@ -430,6 +572,8 @@ class XCX121XKIHelper : public XCBaseHelper
|
||||
mInputs.maMethod,
|
||||
mInputs.maAppliedTo,
|
||||
mInputs.rsiLength,
|
||||
mInputs.rsiBullishConfirmation,
|
||||
mInputs.rsiBearishConfirmation,
|
||||
mInputs.rsiAppliedTo,
|
||||
mInputs.kiWaveSmoothingLength,
|
||||
mInputs.kiWaveSmoothingMode,
|
||||
|
||||
@@ -43,6 +43,8 @@ input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Mode
|
||||
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||
input int rsiLength = 14; // RSI Length
|
||||
input ENUM_APPLIED_PRICE rsiAppliedTo = PRICE_CLOSE; // RSI Applied To
|
||||
input double rsiBullishConfirmation = 55; // RSI Bullish Confirmation Level
|
||||
input double rsiBearishConfirmation = 45; // RSI Bearish Confirmation Level
|
||||
input int kiWaveSmoothingLength = 14; // RSI KI Wave Smoothing Length
|
||||
input ENUM_X_MA_METHOD kiWaveSmoothingMode = X_MA_MODE_EMA; // RSI KI Wave Smoothing Method
|
||||
input double rsiMultiplier = 0.5; // RSI Multiplier
|
||||
@@ -626,7 +628,11 @@ bool ValidateInputs()
|
||||
atrLength >= 5 &&
|
||||
//
|
||||
// RSI ...
|
||||
rsiLength >= 5
|
||||
rsiLength >= 5 &&
|
||||
rsiBullishConfirmation > 0 &&
|
||||
rsiBullishConfirmation < 100 &&
|
||||
rsiBearishConfirmation > 0 &&
|
||||
rsiBearishConfirmation < 100
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1700,15 +1706,15 @@ void CalculateRSI(
|
||||
|
||||
//
|
||||
double iState =
|
||||
iRsi >= 55
|
||||
iRsi >= rsiBullishConfirmation
|
||||
? bullishState
|
||||
: iRsi <= 45
|
||||
: iRsi <= rsiBearishConfirmation
|
||||
? bearishState
|
||||
: neuturalState;
|
||||
double iColor =
|
||||
iRsi >= 55
|
||||
iRsi >= rsiBullishConfirmation
|
||||
? bullishColorIDX
|
||||
: iRsi <= 45
|
||||
: iRsi <= rsiBearishConfirmation
|
||||
? bearishColorIDX
|
||||
: neuturalColorIDX;
|
||||
if (!showKIWave)
|
||||
|
||||
@@ -506,7 +506,6 @@ int GetCandlestickPatterns(
|
||||
Add(X_BAR_PATTERN_TRUE_GAPED, dest);
|
||||
Add(forDir, dir);
|
||||
|
||||
|
||||
//
|
||||
result = ArraySize(dest);
|
||||
|
||||
@@ -1955,6 +1954,51 @@ struct XDirectionShift
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool Init(
|
||||
string _type,
|
||||
datetime _at,
|
||||
double _after,
|
||||
double _before,
|
||||
string _symbol,
|
||||
ENUM_TIMEFRAMES _period,
|
||||
ENUM_X_DIRECTION _shiftTo //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result =
|
||||
IsXValid(_at) &&
|
||||
IsXValid(_type) &&
|
||||
IsXValid(_symbol) &&
|
||||
IsXValid(_period) &&
|
||||
NotEmptyZero(_after) &&
|
||||
NotEmptyZero(_before) &&
|
||||
HasDirection(_shiftTo);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
type = _type;
|
||||
at = _at;
|
||||
after = _after;
|
||||
before = _before;
|
||||
symbol = _symbol;
|
||||
period = _period;
|
||||
shiftTo = _shiftTo;
|
||||
|
||||
//
|
||||
result = IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Bar Index of Direction Shift ...
|
||||
int Index()
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// #region KI Fast ...
|
||||
//
|
||||
// if (kiParser.IsKIFastBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastSwitchedToBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastSwitchedToBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastSameAsLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastSwitchedOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKIFastSwitchedUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region KI Slow ...
|
||||
//
|
||||
// if (kiParser.IsKISlowBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowSwitchedToBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowSwitchedToBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowSameAsLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowSwitchedOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISlowSwitchedUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region KI Super Slow ...
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedToBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedToBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSameAsLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -979,6 +979,66 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
bool isBearish = false;
|
||||
int barIndex = bar.Index() + 1;
|
||||
|
||||
//
|
||||
// TEST ...
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedToBullish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedToBearish(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSameAsLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedOverLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// if (kiParser.IsKISuperSlowSwitchedUnderLast(barIndex))
|
||||
// {
|
||||
// DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
return false;
|
||||
|
||||
//
|
||||
// Initialize Indexed Bar ...
|
||||
XOHCL iBar;
|
||||
@@ -1072,44 +1132,44 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
|
||||
//
|
||||
// Count Touches ...
|
||||
int bullishTouches = 0;
|
||||
int bearishTouches = 0;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
kiParser.CountTouches(
|
||||
bullishTouches,
|
||||
bearishTouches,
|
||||
barIndex,
|
||||
4 // Loopback ...
|
||||
);
|
||||
// int bullishTouches = 0;
|
||||
// int bearishTouches = 0;
|
||||
// if (result)
|
||||
// {
|
||||
// //
|
||||
// kiParser.CountTouches(
|
||||
// bullishTouches,
|
||||
// bearishTouches,
|
||||
// barIndex,
|
||||
// 4 // Loopback ...
|
||||
// );
|
||||
|
||||
//
|
||||
isBullish =
|
||||
isBullish &&
|
||||
bullishTouches >= bearishTouches;
|
||||
// //
|
||||
// isBullish =
|
||||
// isBullish &&
|
||||
// bullishTouches >= bearishTouches;
|
||||
|
||||
//
|
||||
isBearish =
|
||||
isBearish &&
|
||||
bearishTouches >= bullishTouches;
|
||||
// //
|
||||
// isBearish =
|
||||
// isBearish &&
|
||||
// bearishTouches >= bullishTouches;
|
||||
|
||||
//
|
||||
// Summarize Result ...
|
||||
result = isBullish || isBearish;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
isBullish = false;
|
||||
isBearish = false;
|
||||
}
|
||||
// //
|
||||
// // Summarize Result ...
|
||||
// result = isBullish || isBearish;
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// isBullish = false;
|
||||
// isBearish = false;
|
||||
// }
|
||||
|
||||
//
|
||||
if (bullishTouches > 0 || bearishTouches > 0)
|
||||
{
|
||||
// DebugBreak();
|
||||
}
|
||||
}
|
||||
// //
|
||||
// if (bullishTouches > 0 || bearishTouches > 0)
|
||||
// {
|
||||
// // DebugBreak();
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
if (!result)
|
||||
|
||||
@@ -1547,7 +1547,851 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
||||
// #endregion
|
||||
|
||||
// #region Switches ...
|
||||
// TODO: Implement Switches Checkers in Loopback ...
|
||||
int HasKIFastSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsKIFastSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_FAST),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKIFast(i),
|
||||
kiHelper.GetKIFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsKIFastSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_FAST),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKIFast(i),
|
||||
kiHelper.GetKIFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasKISlowSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsKISlowSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKISlow(i),
|
||||
kiHelper.GetKISlow(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsKISlowSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKIFast(i),
|
||||
kiHelper.GetKIFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasKISuperSlowSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsKISuperSlowSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_SUPER_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKISuperSlow(i),
|
||||
kiHelper.GetKISuperSlow(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsKISuperSlowSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_SUPER_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKIFast(i),
|
||||
kiHelper.GetKIFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasKIWaveSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsKIWaveSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_WAVE),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKIWave(i),
|
||||
kiHelper.GetKIWave(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsKIWaveSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_WAVE),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetKIWave(i),
|
||||
kiHelper.GetKIWave(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasMAFastSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsMAFastSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_FAST),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetMAFast(i),
|
||||
kiHelper.GetMAFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsMAFastSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_FAST),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetMAFast(i),
|
||||
kiHelper.GetMAFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasMASlowSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsMASlowSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetMASlow(i),
|
||||
kiHelper.GetMASlow(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsMASlowSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetMAFast(i),
|
||||
kiHelper.GetMAFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasMASuperSlowSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsMASuperSlowSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_SUPER_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetMASuperSlow(i),
|
||||
kiHelper.GetMASuperSlow(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsMASuperSlowSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_SUPER_SLOW),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetMAFast(i),
|
||||
kiHelper.GetMAFast(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasMACrossedSwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsMACrossoverSwitchedToBullish(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_CROSS),
|
||||
GetBarTime(symbol, period, i),
|
||||
MathMin(kiHelper.GetMAFast(i), kiHelper.GetMASlow(i)),
|
||||
MathMin(kiHelper.GetMAFast(i + 1), kiHelper.GetMASlow(i + 1)),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsMACrossoverSwitchedToBearish(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_MA_CROSS),
|
||||
GetBarTime(symbol, period, i),
|
||||
MathMin(kiHelper.GetMAFast(i), kiHelper.GetMASlow(i)),
|
||||
MathMin(kiHelper.GetMAFast(i + 1), kiHelper.GetMASlow(i + 1)),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int HasATRVolatilitySwitch(
|
||||
XDirectionShift &switches[],
|
||||
int barIndex = 0,
|
||||
int loopback = 10,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
XClean(switches);
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 2);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
XDirectionShift iShift;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullish = kiParser.IsVolatilitySwitchdToHigh(i);
|
||||
has = hasBullish && isBullish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_ATR),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetATR(i),
|
||||
kiHelper.GetATR(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearish = kiParser.IsVolatilitySwitchdToLow(i);
|
||||
has = hasBearish && isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iShift.Clean();
|
||||
has = iShift.Init(
|
||||
ToXString(X121_XKI_ATR),
|
||||
GetBarTime(symbol, period, i),
|
||||
kiHelper.GetATR(i),
|
||||
kiHelper.GetATR(i + 1),
|
||||
symbol,
|
||||
period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
iShift,
|
||||
switches //
|
||||
);
|
||||
|
||||
//
|
||||
iShift.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(switches);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region Peak and Vale ...
|
||||
|
||||
Reference in New Issue
Block a user