last ...
This commit is contained in:
@@ -923,10 +923,165 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
DebugBreak();
|
||||
// Detect Nearest Directional ...
|
||||
int nearestDirectionalSwitchIndex = -1;
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
isBullish = poiDetector.NearestKIFastSwitchedToBullish(
|
||||
nearestDirectionalSwitchIndex,
|
||||
bar.Index() + 2 //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
isBearish = poiDetector.NearestKIFastSwitchedToBearish(
|
||||
nearestDirectionalSwitchIndex,
|
||||
bar.Index() + 2 //
|
||||
);
|
||||
}
|
||||
result =
|
||||
IsValidIndex(nearestDirectionalSwitchIndex) &&
|
||||
(isBullish ||
|
||||
isBearish);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Preparing Zone ...
|
||||
double upper = bar.FindHighest(nearestDirectionalSwitchIndex - bar.Index(), MODE_HIGH);
|
||||
double lower = bar.FindLowest(nearestDirectionalSwitchIndex - bar.Index(), MODE_LOW);
|
||||
|
||||
//
|
||||
result = zone.Init(
|
||||
symbol,
|
||||
period,
|
||||
upper,
|
||||
lower,
|
||||
GetBarTime(symbol, period, nearestDirectionalSwitchIndex),
|
||||
bar.time,
|
||||
dir,
|
||||
"XKI1" //
|
||||
);
|
||||
|
||||
//
|
||||
// Support and Resistance ...
|
||||
XBoxZone support;
|
||||
XBoxZone resistance;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XOHCL tmpBar;
|
||||
int tmpIDX = -1;
|
||||
bool has = false;
|
||||
double upper = 0;
|
||||
double lower = 0;
|
||||
int length = zone.GetAge();
|
||||
|
||||
//
|
||||
// Support ...
|
||||
tmpIDX = bar.FindLowestIndex(length, MODE_LOW);
|
||||
if (IsValidIndex(tmpIDX))
|
||||
{
|
||||
//
|
||||
if (tmpBar.Init(symbol, period, tmpIDX))
|
||||
{
|
||||
//
|
||||
lower = iLow(symbol, period, tmpIDX);
|
||||
upper = bar.FindLowest(length, MODE_CLOSE);
|
||||
if (upper <= lower)
|
||||
{
|
||||
upper = tmpBar.GetDown();
|
||||
}
|
||||
|
||||
//
|
||||
has = support.Init(
|
||||
symbol,
|
||||
period,
|
||||
upper,
|
||||
lower,
|
||||
tmpBar.time,
|
||||
bar.time,
|
||||
X_DIRECTION_BULLISH,
|
||||
X_BAR_PATTERN_SUPPORT //
|
||||
);
|
||||
|
||||
//
|
||||
tmpBar.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance ...
|
||||
tmpIDX = bar.FindHighestIndex(length, MODE_HIGH);
|
||||
if (IsValidIndex(tmpIDX))
|
||||
{
|
||||
//
|
||||
if (tmpBar.Init(symbol, period, tmpIDX))
|
||||
{
|
||||
//
|
||||
upper = iHigh(symbol, period, tmpIDX);
|
||||
lower = bar.FindHighest(length, MODE_CLOSE);
|
||||
if (upper <= lower)
|
||||
{
|
||||
upper = tmpBar.GetUp();
|
||||
}
|
||||
|
||||
//
|
||||
has = resistance.Init(
|
||||
symbol,
|
||||
period,
|
||||
upper,
|
||||
lower,
|
||||
tmpBar.time,
|
||||
bar.time,
|
||||
X_DIRECTION_BEARISH,
|
||||
X_BAR_PATTERN_RESISTANCE //
|
||||
);
|
||||
|
||||
//
|
||||
tmpBar.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Rempve ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
// Other Drawing Materials ...
|
||||
XPOIDrawConfig drawConfig;
|
||||
drawConfig.Default();
|
||||
|
||||
//
|
||||
poiDrawer.DrawZone(zone, drawConfig);
|
||||
|
||||
//
|
||||
if (support.IsValid())
|
||||
{
|
||||
poiDrawer.DrawZone(support, drawConfig);
|
||||
}
|
||||
|
||||
//
|
||||
if (resistance.IsValid())
|
||||
{
|
||||
poiDrawer.DrawZone(resistance, drawConfig);
|
||||
}
|
||||
|
||||
//
|
||||
drawConfig.Clean();
|
||||
|
||||
//
|
||||
// DebugBreak();
|
||||
}
|
||||
|
||||
//
|
||||
result = ToBox(bar, zone, dir, X_BAR_PATTERN_SIGNALKEY);
|
||||
result =
|
||||
result &&
|
||||
zone.IsValid() &&
|
||||
|
||||
Reference in New Issue
Block a user