last ...
This commit is contained in:
@@ -973,21 +973,10 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
int barIndex = bar.Index() + 1;
|
||||
|
||||
//
|
||||
// Retrieve Base Conditions ...
|
||||
bool isBullish = IsBullishPOILongEntry(barIndex);
|
||||
bool isBearish = IsBearishPOIShortEntry(barIndex);
|
||||
|
||||
//
|
||||
// Validate Conditions ...
|
||||
result = isBullish || isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
result = iBar.Init(bar.symbol, bar.period, barIndex);
|
||||
@@ -997,235 +986,326 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
// Do Validation and Filtering Market Structure if required ...
|
||||
|
||||
//
|
||||
// Validate near Support / Resistance Zones ...
|
||||
bool validateNearSupRes = true;
|
||||
if (result && validateNearSupRes)
|
||||
XBoxZone supports[];
|
||||
XBoxZone resistances[];
|
||||
XBoxZone minorSupport;
|
||||
XBoxZone majorSupport;
|
||||
XBoxZone minorResistance;
|
||||
XBoxZone majorResistance;
|
||||
poiDetector.GetCurrentStructure(
|
||||
supports,
|
||||
resistances,
|
||||
minorSupport,
|
||||
majorSupport,
|
||||
minorResistance,
|
||||
majorResistance,
|
||||
barIndex,
|
||||
bar.symbol,
|
||||
bar.period, // Minor ...
|
||||
PERIOD_H1, // Major ...
|
||||
50,
|
||||
14,
|
||||
21,
|
||||
0 //
|
||||
);
|
||||
bool draw = true;
|
||||
if (draw)
|
||||
{
|
||||
//
|
||||
// Configs ...
|
||||
int loopback = 100;
|
||||
int validationLength = 7;
|
||||
double nearThreshold = 5;
|
||||
int validationRetests = 0;
|
||||
int validationLoopback = 100;
|
||||
double validationThreshold = 5;
|
||||
int drawn = 0;
|
||||
|
||||
//
|
||||
// Filling Zones ...
|
||||
XBoxZone zones[];
|
||||
if (isBullish)
|
||||
XPOIDrawConfig config;
|
||||
config.Default();
|
||||
|
||||
//
|
||||
// Minors ...
|
||||
if (minorSupport.IsValid())
|
||||
{
|
||||
//
|
||||
// Detect Supports ...
|
||||
poiDetector.DetectSupports(
|
||||
zones,
|
||||
barIndex,
|
||||
loopback,
|
||||
true,
|
||||
validationLength, // Validation Length ...
|
||||
validationRetests, // Min Retest ...
|
||||
validationThreshold, // Retest Threshold ...
|
||||
validationLoopback, // Retest Loopback ...
|
||||
symbol,
|
||||
period //
|
||||
);
|
||||
drawn++;
|
||||
poiDrawer.DrawZone(minorSupport, config);
|
||||
}
|
||||
else if (isBearish)
|
||||
if (minorResistance.IsValid())
|
||||
{
|
||||
//
|
||||
// Detect Resistances ...
|
||||
poiDetector.DetectResistances(
|
||||
zones,
|
||||
barIndex,
|
||||
loopback,
|
||||
true,
|
||||
validationLength, // Validation Length ...
|
||||
validationRetests, // Min Retest ...
|
||||
validationThreshold, // Retest Threshold ...
|
||||
validationLoopback, // Retest Loopback ...
|
||||
symbol,
|
||||
period //
|
||||
);
|
||||
drawn++;
|
||||
poiDrawer.DrawZone(minorResistance, config);
|
||||
}
|
||||
|
||||
//
|
||||
if (HasChild(zones))
|
||||
// Majors ...
|
||||
config.bullishColor = clrLime;
|
||||
config.bearishColor = clrRed;
|
||||
config.zonesWidth = 4;
|
||||
|
||||
//
|
||||
if (majorSupport.IsValid())
|
||||
{
|
||||
//
|
||||
XPOIDrawConfig iConfig;
|
||||
iConfig.Default();
|
||||
|
||||
drawn++;
|
||||
poiDrawer.DrawZone(majorSupport, config);
|
||||
}
|
||||
if (majorResistance.IsValid())
|
||||
{
|
||||
//
|
||||
poiDrawer.DrawZones(zones, iConfig);
|
||||
iConfig.Clean();
|
||||
// DebugBreak();
|
||||
drawn++;
|
||||
poiDrawer.DrawZone(majorResistance, config);
|
||||
}
|
||||
|
||||
//
|
||||
// Check Has Nearest ...
|
||||
int nearIDX = -1;
|
||||
result = poiDetector.HasNearZone(
|
||||
nearIDX,
|
||||
bar.close,
|
||||
nearThreshold,
|
||||
zones //
|
||||
);
|
||||
config.Clean();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
if (!result)
|
||||
if (drawn > 0)
|
||||
{
|
||||
//
|
||||
isBullish = false;
|
||||
isBearish = false;
|
||||
DebugBreak();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Validate by ATR Rising/Falling ...
|
||||
bool validateByATRRaisFalling = true;
|
||||
if (result && validateByATRRaisFalling)
|
||||
{
|
||||
//
|
||||
// Bullish:
|
||||
// - ATR Lower Rising ...
|
||||
// - ATR Over ATR Ma ...
|
||||
// Bearsih:
|
||||
// - ATR Upper Falling ...
|
||||
// - ATR Over ATR Ma ...
|
||||
// //
|
||||
// // Retrieve Base Conditions ...
|
||||
// bool isBullish = IsBullishPOILongEntry(barIndex);
|
||||
// bool isBearish = IsBearishPOIShortEntry(barIndex);
|
||||
|
||||
//
|
||||
isBullish =
|
||||
isBullish &&
|
||||
// kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
||||
kiHelper.GetKILower(barIndex) > kiHelper.GetKILower(barIndex + 1);
|
||||
isBearish =
|
||||
isBearish &&
|
||||
// kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
||||
kiHelper.GetKIUpper(barIndex) < kiHelper.GetKIUpper(barIndex + 1);
|
||||
result = isBullish || isBearish;
|
||||
// //
|
||||
// // Validate Conditions ...
|
||||
// result = isBullish || isBearish;
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
isBullish = false;
|
||||
isBearish = false;
|
||||
}
|
||||
}
|
||||
// //
|
||||
// // Do Validation and Filtering Market Structure if required ...
|
||||
|
||||
//
|
||||
// Validate by RSI ...
|
||||
bool validatebyRSI = false;
|
||||
if (result && validatebyRSI)
|
||||
{
|
||||
//
|
||||
// Bullish:
|
||||
// - Not in Over Baught;
|
||||
// - Rising;
|
||||
// Bearish :
|
||||
// - Not in Over Sold;
|
||||
// - Falling;
|
||||
// //
|
||||
// // Validate near Support / Resistance Zones ...
|
||||
// bool validateNearSupRes = true;
|
||||
// if (result && validateNearSupRes)
|
||||
// {
|
||||
// //
|
||||
// // Configs ...
|
||||
// int loopback = 100;
|
||||
// int validationLength = 7;
|
||||
// double nearThreshold = 5;
|
||||
// int validationRetests = 0;
|
||||
// int validationLoopback = 100;
|
||||
// double validationThreshold = 5;
|
||||
|
||||
//
|
||||
isBullish =
|
||||
isBullish &&
|
||||
!kiParser.IsRSIOverbought(barIndex) &&
|
||||
kiHelper.GetRSI(barIndex) > kiHelper.GetRSI(barIndex + 1);
|
||||
isBearish =
|
||||
isBearish &&
|
||||
!kiParser.IsRSIOversold(barIndex) &&
|
||||
kiHelper.GetRSI(barIndex) < kiHelper.GetRSI(barIndex + 1);
|
||||
result = isBullish || isBearish;
|
||||
// //
|
||||
// // Filling Zones ...
|
||||
// XBoxZone zones[];
|
||||
// if (isBullish)
|
||||
// {
|
||||
// //
|
||||
// // Detect Supports ...
|
||||
// poiDetector.DetectSupports(
|
||||
// zones,
|
||||
// barIndex,
|
||||
// loopback,
|
||||
// true,
|
||||
// validationLength, // Validation Length ...
|
||||
// validationRetests, // Min Retest ...
|
||||
// validationThreshold, // Retest Threshold ...
|
||||
// validationLoopback, // Retest Loopback ...
|
||||
// symbol,
|
||||
// period //
|
||||
// );
|
||||
// }
|
||||
// else if (isBearish)
|
||||
// {
|
||||
// //
|
||||
// // Detect Resistances ...
|
||||
// poiDetector.DetectResistances(
|
||||
// zones,
|
||||
// barIndex,
|
||||
// loopback,
|
||||
// true,
|
||||
// validationLength, // Validation Length ...
|
||||
// validationRetests, // Min Retest ...
|
||||
// validationThreshold, // Retest Threshold ...
|
||||
// validationLoopback, // Retest Loopback ...
|
||||
// symbol,
|
||||
// period //
|
||||
// );
|
||||
// }
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
isBullish = false;
|
||||
isBearish = false;
|
||||
}
|
||||
}
|
||||
// //
|
||||
// if (HasChild(zones))
|
||||
// {
|
||||
// //
|
||||
// XPOIDrawConfig iConfig;
|
||||
// iConfig.Default();
|
||||
|
||||
//
|
||||
// Validate by iBar Pattern ...
|
||||
// in this Strategy we have PinBar or SignalKeyBar ...
|
||||
bool validateByBarPatterns = false;
|
||||
if (result && validateByBarPatterns)
|
||||
{
|
||||
//
|
||||
// Pin ...
|
||||
bool isPinBar = poiDetector.IsPinnedBar(
|
||||
iBar,
|
||||
dir //
|
||||
);
|
||||
bool isPinBarBullish =
|
||||
isPinBar &&
|
||||
IsXBullish(dir);
|
||||
bool isPinBarBearish =
|
||||
isPinBar &&
|
||||
IsXBearish(dir);
|
||||
// //
|
||||
// poiDrawer.DrawZones(zones, iConfig);
|
||||
// iConfig.Clean();
|
||||
// // DebugBreak();
|
||||
// }
|
||||
|
||||
//
|
||||
// Engulfe ...
|
||||
bool isEngulfed = poiDetector.IsEngulfedBar(
|
||||
iBar,
|
||||
dir //
|
||||
);
|
||||
bool isEngulfedBullish =
|
||||
isEngulfed &&
|
||||
IsXBullish(dir);
|
||||
bool isEngulfedBearish =
|
||||
isEngulfed &&
|
||||
IsXBearish(dir);
|
||||
// //
|
||||
// // Check Has Nearest ...
|
||||
// int nearIDX = -1;
|
||||
// result = poiDetector.HasNearZone(
|
||||
// nearIDX,
|
||||
// bar.close,
|
||||
// nearThreshold,
|
||||
// zones //
|
||||
// );
|
||||
|
||||
//
|
||||
// Signal Key Bar ...
|
||||
bool isSignalKeyBar = poiDetector.IsSignalKeyBarPattern(
|
||||
iBar,
|
||||
dir //
|
||||
);
|
||||
bool isSignalKeyBarBullish =
|
||||
isSignalKeyBar &&
|
||||
IsXBullish(dir);
|
||||
bool isSignalKeyBarBearish =
|
||||
isSignalKeyBar &&
|
||||
IsXBearish(dir);
|
||||
// //
|
||||
// // Validate ...
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// isBullish = false;
|
||||
// isBearish = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
isBullish =
|
||||
isBullish &&
|
||||
(isEngulfedBullish);
|
||||
isBearish =
|
||||
isBearish &&
|
||||
(isEngulfedBearish);
|
||||
// //
|
||||
// // Validate by ATR Rising/Falling ...
|
||||
// bool validateByATRRaisFalling = true;
|
||||
// if (result && validateByATRRaisFalling)
|
||||
// {
|
||||
// //
|
||||
// // Bullish:
|
||||
// // - ATR Lower Rising ...
|
||||
// // - ATR Over ATR Ma ...
|
||||
// // Bearsih:
|
||||
// // - ATR Upper Falling ...
|
||||
// // - ATR Over ATR Ma ...
|
||||
|
||||
// //
|
||||
// isBullish =
|
||||
// isBullish &&
|
||||
// (isPinBarBullish ||
|
||||
// isEngulfedBullish ||
|
||||
// isSignalKeyBarBullish);
|
||||
// isBearish =
|
||||
// isBearish &&
|
||||
// (isPinBarBearish ||
|
||||
// isEngulfedBearish ||
|
||||
// isSignalKeyBarBearish);
|
||||
// //
|
||||
// isBullish =
|
||||
// isBullish &&
|
||||
// // kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
||||
// kiHelper.GetKILower(barIndex) > kiHelper.GetKILower(barIndex + 1);
|
||||
// isBearish =
|
||||
// isBearish &&
|
||||
// // kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
||||
// kiHelper.GetKIUpper(barIndex) < kiHelper.GetKIUpper(barIndex + 1);
|
||||
// result = isBullish || isBearish;
|
||||
|
||||
//
|
||||
result = isBullish || isBearish;
|
||||
// //
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// isBullish = false;
|
||||
// isBearish = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
isBullish = false;
|
||||
isBearish = false;
|
||||
}
|
||||
}
|
||||
// //
|
||||
// // Validate by RSI ...
|
||||
// bool validatebyRSI = false;
|
||||
// if (result && validatebyRSI)
|
||||
// {
|
||||
// //
|
||||
// // Bullish:
|
||||
// // - Not in Over Baught;
|
||||
// // - Rising;
|
||||
// // Bearish :
|
||||
// // - Not in Over Sold;
|
||||
// // - Falling;
|
||||
|
||||
// //
|
||||
// isBullish =
|
||||
// isBullish &&
|
||||
// !kiParser.IsRSIOverbought(barIndex) &&
|
||||
// kiHelper.GetRSI(barIndex) > kiHelper.GetRSI(barIndex + 1);
|
||||
// isBearish =
|
||||
// isBearish &&
|
||||
// !kiParser.IsRSIOversold(barIndex) &&
|
||||
// kiHelper.GetRSI(barIndex) < kiHelper.GetRSI(barIndex + 1);
|
||||
// result = isBullish || isBearish;
|
||||
|
||||
// //
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// isBullish = false;
|
||||
// isBearish = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Validate by iBar Pattern ...
|
||||
// // in this Strategy we have PinBar or SignalKeyBar ...
|
||||
// bool validateByBarPatterns = false;
|
||||
// if (result && validateByBarPatterns)
|
||||
// {
|
||||
// //
|
||||
// // Pin ...
|
||||
// bool isPinBar = poiDetector.IsPinnedBar(
|
||||
// iBar,
|
||||
// dir //
|
||||
// );
|
||||
// bool isPinBarBullish =
|
||||
// isPinBar &&
|
||||
// IsXBullish(dir);
|
||||
// bool isPinBarBearish =
|
||||
// isPinBar &&
|
||||
// IsXBearish(dir);
|
||||
|
||||
// //
|
||||
// // Engulfe ...
|
||||
// bool isEngulfed = poiDetector.IsEngulfedBar(
|
||||
// iBar,
|
||||
// dir //
|
||||
// );
|
||||
// bool isEngulfedBullish =
|
||||
// isEngulfed &&
|
||||
// IsXBullish(dir);
|
||||
// bool isEngulfedBearish =
|
||||
// isEngulfed &&
|
||||
// IsXBearish(dir);
|
||||
|
||||
// //
|
||||
// // Signal Key Bar ...
|
||||
// bool isSignalKeyBar = poiDetector.IsSignalKeyBarPattern(
|
||||
// iBar,
|
||||
// dir //
|
||||
// );
|
||||
// bool isSignalKeyBarBullish =
|
||||
// isSignalKeyBar &&
|
||||
// IsXBullish(dir);
|
||||
// bool isSignalKeyBarBearish =
|
||||
// isSignalKeyBar &&
|
||||
// IsXBearish(dir);
|
||||
|
||||
// //
|
||||
// isBullish =
|
||||
// isBullish &&
|
||||
// (isEngulfedBullish);
|
||||
// isBearish =
|
||||
// isBearish &&
|
||||
// (isEngulfedBearish);
|
||||
|
||||
// // //
|
||||
// // isBullish =
|
||||
// // isBullish &&
|
||||
// // (isPinBarBullish ||
|
||||
// // isEngulfedBullish ||
|
||||
// // isSignalKeyBarBullish);
|
||||
// // isBearish =
|
||||
// // isBearish &&
|
||||
// // (isPinBarBearish ||
|
||||
// // isEngulfedBearish ||
|
||||
// // isSignalKeyBarBearish);
|
||||
|
||||
// //
|
||||
// result = isBullish || isBearish;
|
||||
|
||||
// //
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// isBullish = false;
|
||||
// isBearish = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// Check and Prepare Direction ...
|
||||
|
||||
Reference in New Issue
Block a user