last ...
This commit is contained in:
@@ -1332,3 +1332,357 @@ bool Strategy1HasSignal(
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Bar Has Signal Based on Strategy 1 ...
|
||||||
|
* POI ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL, reference to Bar ...
|
||||||
|
* @param zone: XBoxZone, reference to holds affected zone ...
|
||||||
|
* @param targets: XTarget, reference to detected Signal's Targets collections ...
|
||||||
|
* @param dir: ENUM_X_DIRECTION, detected Signal's direction ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool Strategy1HasSignal(
|
||||||
|
XOHCL & bar,
|
||||||
|
XBoxZone & zone,
|
||||||
|
XTarget & targets[],
|
||||||
|
ENUM_X_DIRECTION & dir //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
zone.Clean();
|
||||||
|
XClean(targets);
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
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);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Validation and Filtering Market Structure if required ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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 (HasChild(zones))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPOIDrawConfig iConfig;
|
||||||
|
iConfig.Default();
|
||||||
|
|
||||||
|
//
|
||||||
|
poiDrawer.DrawZones(zones, iConfig);
|
||||||
|
iConfig.Clean();
|
||||||
|
// DebugBreak();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Has Nearest ...
|
||||||
|
int nearIDX = -1;
|
||||||
|
result = poiDetector.HasNearZone(
|
||||||
|
nearIDX,
|
||||||
|
bar.close,
|
||||||
|
nearThreshold,
|
||||||
|
zones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isBullish = false;
|
||||||
|
isBearish = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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 &&
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
//
|
||||||
|
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 ...
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: isBearish ? X_DIRECTION_BEARISH
|
||||||
|
: X_DIRECTION_NONE;
|
||||||
|
result = HasDirection(dir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Zone ...
|
||||||
|
double entry = GetEntry(iBar.symbol, dir);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double upper = isBullish
|
||||||
|
? entry
|
||||||
|
: iBar.high;
|
||||||
|
double lower = isBullish
|
||||||
|
? iBar.low
|
||||||
|
: entry;
|
||||||
|
datetime to = bar.time;
|
||||||
|
datetime from = iBar.BeforeOn();
|
||||||
|
result = zone.Init(
|
||||||
|
iBar.symbol,
|
||||||
|
iBar.period,
|
||||||
|
upper,
|
||||||
|
lower,
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
dir,
|
||||||
|
"XS1" //
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPOIDrawConfig iConfig;
|
||||||
|
iConfig.Default();
|
||||||
|
|
||||||
|
//
|
||||||
|
poiDrawer.DrawZone(zone, iConfig);
|
||||||
|
|
||||||
|
//
|
||||||
|
// DebugBreak();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
zone.IsValid() &&
|
||||||
|
HasDirection(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -973,21 +973,10 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
int barIndex = bar.Index() + 1;
|
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;
|
XOHCL iBar;
|
||||||
result = iBar.Init(bar.symbol, bar.period, barIndex);
|
result = iBar.Init(bar.symbol, bar.period, barIndex);
|
||||||
@@ -997,235 +986,326 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do Validation and Filtering Market Structure if required ...
|
XBoxZone supports[];
|
||||||
|
XBoxZone resistances[];
|
||||||
//
|
XBoxZone minorSupport;
|
||||||
// Validate near Support / Resistance Zones ...
|
XBoxZone majorSupport;
|
||||||
bool validateNearSupRes = true;
|
XBoxZone minorResistance;
|
||||||
if (result && validateNearSupRes)
|
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 drawn = 0;
|
||||||
int loopback = 100;
|
|
||||||
int validationLength = 7;
|
|
||||||
double nearThreshold = 5;
|
|
||||||
int validationRetests = 0;
|
|
||||||
int validationLoopback = 100;
|
|
||||||
double validationThreshold = 5;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Filling Zones ...
|
XPOIDrawConfig config;
|
||||||
XBoxZone zones[];
|
config.Default();
|
||||||
if (isBullish)
|
|
||||||
|
//
|
||||||
|
// Minors ...
|
||||||
|
if (minorSupport.IsValid())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Detect Supports ...
|
drawn++;
|
||||||
poiDetector.DetectSupports(
|
poiDrawer.DrawZone(minorSupport, config);
|
||||||
zones,
|
|
||||||
barIndex,
|
|
||||||
loopback,
|
|
||||||
true,
|
|
||||||
validationLength, // Validation Length ...
|
|
||||||
validationRetests, // Min Retest ...
|
|
||||||
validationThreshold, // Retest Threshold ...
|
|
||||||
validationLoopback, // Retest Loopback ...
|
|
||||||
symbol,
|
|
||||||
period //
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else if (isBearish)
|
if (minorResistance.IsValid())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Detect Resistances ...
|
drawn++;
|
||||||
poiDetector.DetectResistances(
|
poiDrawer.DrawZone(minorResistance, config);
|
||||||
zones,
|
|
||||||
barIndex,
|
|
||||||
loopback,
|
|
||||||
true,
|
|
||||||
validationLength, // Validation Length ...
|
|
||||||
validationRetests, // Min Retest ...
|
|
||||||
validationThreshold, // Retest Threshold ...
|
|
||||||
validationLoopback, // Retest Loopback ...
|
|
||||||
symbol,
|
|
||||||
period //
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (HasChild(zones))
|
// Majors ...
|
||||||
|
config.bullishColor = clrLime;
|
||||||
|
config.bearishColor = clrRed;
|
||||||
|
config.zonesWidth = 4;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (majorSupport.IsValid())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XPOIDrawConfig iConfig;
|
drawn++;
|
||||||
iConfig.Default();
|
poiDrawer.DrawZone(majorSupport, config);
|
||||||
|
}
|
||||||
|
if (majorResistance.IsValid())
|
||||||
|
{
|
||||||
//
|
//
|
||||||
poiDrawer.DrawZones(zones, iConfig);
|
drawn++;
|
||||||
iConfig.Clean();
|
poiDrawer.DrawZone(majorResistance, config);
|
||||||
// DebugBreak();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Has Nearest ...
|
config.Clean();
|
||||||
int nearIDX = -1;
|
|
||||||
result = poiDetector.HasNearZone(
|
|
||||||
nearIDX,
|
|
||||||
bar.close,
|
|
||||||
nearThreshold,
|
|
||||||
zones //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate ...
|
if (drawn > 0)
|
||||||
if (!result)
|
|
||||||
{
|
{
|
||||||
//
|
DebugBreak();
|
||||||
isBullish = false;
|
|
||||||
isBearish = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Validate by ATR Rising/Falling ...
|
// // Retrieve Base Conditions ...
|
||||||
bool validateByATRRaisFalling = true;
|
// bool isBullish = IsBullishPOILongEntry(barIndex);
|
||||||
if (result && validateByATRRaisFalling)
|
// bool isBearish = IsBearishPOIShortEntry(barIndex);
|
||||||
{
|
|
||||||
//
|
|
||||||
// Bullish:
|
|
||||||
// - ATR Lower Rising ...
|
|
||||||
// - ATR Over ATR Ma ...
|
|
||||||
// Bearsih:
|
|
||||||
// - ATR Upper Falling ...
|
|
||||||
// - ATR Over ATR Ma ...
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
isBullish =
|
// // Validate Conditions ...
|
||||||
isBullish &&
|
// result = isBullish || isBearish;
|
||||||
// kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
// if (!result)
|
||||||
kiHelper.GetKILower(barIndex) > kiHelper.GetKILower(barIndex + 1);
|
// {
|
||||||
isBearish =
|
// return result;
|
||||||
isBearish &&
|
// }
|
||||||
// kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
|
||||||
kiHelper.GetKIUpper(barIndex) < kiHelper.GetKIUpper(barIndex + 1);
|
|
||||||
result = isBullish || isBearish;
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (!result)
|
// // Do Validation and Filtering Market Structure if required ...
|
||||||
{
|
|
||||||
//
|
|
||||||
isBullish = false;
|
|
||||||
isBearish = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Validate by RSI ...
|
// // Validate near Support / Resistance Zones ...
|
||||||
bool validatebyRSI = false;
|
// bool validateNearSupRes = true;
|
||||||
if (result && validatebyRSI)
|
// if (result && validateNearSupRes)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
// Bullish:
|
// // Configs ...
|
||||||
// - Not in Over Baught;
|
// int loopback = 100;
|
||||||
// - Rising;
|
// int validationLength = 7;
|
||||||
// Bearish :
|
// double nearThreshold = 5;
|
||||||
// - Not in Over Sold;
|
// int validationRetests = 0;
|
||||||
// - Falling;
|
// int validationLoopback = 100;
|
||||||
|
// double validationThreshold = 5;
|
||||||
|
|
||||||
//
|
// //
|
||||||
isBullish =
|
// // Filling Zones ...
|
||||||
isBullish &&
|
// XBoxZone zones[];
|
||||||
!kiParser.IsRSIOverbought(barIndex) &&
|
// if (isBullish)
|
||||||
kiHelper.GetRSI(barIndex) > kiHelper.GetRSI(barIndex + 1);
|
// {
|
||||||
isBearish =
|
// //
|
||||||
isBearish &&
|
// // Detect Supports ...
|
||||||
!kiParser.IsRSIOversold(barIndex) &&
|
// poiDetector.DetectSupports(
|
||||||
kiHelper.GetRSI(barIndex) < kiHelper.GetRSI(barIndex + 1);
|
// zones,
|
||||||
result = isBullish || isBearish;
|
// 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)
|
// if (HasChild(zones))
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
isBullish = false;
|
// XPOIDrawConfig iConfig;
|
||||||
isBearish = false;
|
// iConfig.Default();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Validate by iBar Pattern ...
|
// poiDrawer.DrawZones(zones, iConfig);
|
||||||
// in this Strategy we have PinBar or SignalKeyBar ...
|
// iConfig.Clean();
|
||||||
bool validateByBarPatterns = false;
|
// // DebugBreak();
|
||||||
if (result && validateByBarPatterns)
|
// }
|
||||||
{
|
|
||||||
//
|
|
||||||
// Pin ...
|
|
||||||
bool isPinBar = poiDetector.IsPinnedBar(
|
|
||||||
iBar,
|
|
||||||
dir //
|
|
||||||
);
|
|
||||||
bool isPinBarBullish =
|
|
||||||
isPinBar &&
|
|
||||||
IsXBullish(dir);
|
|
||||||
bool isPinBarBearish =
|
|
||||||
isPinBar &&
|
|
||||||
IsXBearish(dir);
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Engulfe ...
|
// // Check Has Nearest ...
|
||||||
bool isEngulfed = poiDetector.IsEngulfedBar(
|
// int nearIDX = -1;
|
||||||
iBar,
|
// result = poiDetector.HasNearZone(
|
||||||
dir //
|
// nearIDX,
|
||||||
);
|
// bar.close,
|
||||||
bool isEngulfedBullish =
|
// nearThreshold,
|
||||||
isEngulfed &&
|
// zones //
|
||||||
IsXBullish(dir);
|
// );
|
||||||
bool isEngulfedBearish =
|
|
||||||
isEngulfed &&
|
|
||||||
IsXBearish(dir);
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Signal Key Bar ...
|
// // Validate ...
|
||||||
bool isSignalKeyBar = poiDetector.IsSignalKeyBarPattern(
|
// if (!result)
|
||||||
iBar,
|
// {
|
||||||
dir //
|
// //
|
||||||
);
|
// isBullish = false;
|
||||||
bool isSignalKeyBarBullish =
|
// isBearish = false;
|
||||||
isSignalKeyBar &&
|
// }
|
||||||
IsXBullish(dir);
|
// }
|
||||||
bool isSignalKeyBarBearish =
|
|
||||||
isSignalKeyBar &&
|
|
||||||
IsXBearish(dir);
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
isBullish =
|
// // Validate by ATR Rising/Falling ...
|
||||||
isBullish &&
|
// bool validateByATRRaisFalling = true;
|
||||||
(isEngulfedBullish);
|
// if (result && validateByATRRaisFalling)
|
||||||
isBearish =
|
// {
|
||||||
isBearish &&
|
// //
|
||||||
(isEngulfedBearish);
|
// // Bullish:
|
||||||
|
// // - ATR Lower Rising ...
|
||||||
|
// // - ATR Over ATR Ma ...
|
||||||
|
// // Bearsih:
|
||||||
|
// // - ATR Upper Falling ...
|
||||||
|
// // - ATR Over ATR Ma ...
|
||||||
|
|
||||||
// //
|
// //
|
||||||
// isBullish =
|
// isBullish =
|
||||||
// isBullish &&
|
// isBullish &&
|
||||||
// (isPinBarBullish ||
|
// // kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
||||||
// isEngulfedBullish ||
|
// kiHelper.GetKILower(barIndex) > kiHelper.GetKILower(barIndex + 1);
|
||||||
// isSignalKeyBarBullish);
|
// isBearish =
|
||||||
// isBearish =
|
// isBearish &&
|
||||||
// isBearish &&
|
// // kiHelper.GetATR(barIndex) > kiHelper.GetATRSmoothed(barIndex) &&
|
||||||
// (isPinBarBearish ||
|
// kiHelper.GetKIUpper(barIndex) < kiHelper.GetKIUpper(barIndex + 1);
|
||||||
// isEngulfedBearish ||
|
// result = isBullish || isBearish;
|
||||||
// isSignalKeyBarBearish);
|
|
||||||
|
|
||||||
//
|
// //
|
||||||
result = isBullish || isBearish;
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// isBullish = false;
|
||||||
|
// isBearish = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (!result)
|
// // Validate by RSI ...
|
||||||
{
|
// bool validatebyRSI = false;
|
||||||
//
|
// if (result && validatebyRSI)
|
||||||
isBullish = false;
|
// {
|
||||||
isBearish = false;
|
// //
|
||||||
}
|
// // 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 ...
|
// Check and Prepare Direction ...
|
||||||
|
|||||||
@@ -1617,7 +1617,8 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
|||||||
XBoxZone &majorResistance,
|
XBoxZone &majorResistance,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
string forSymbol = NULL,
|
string forSymbol = NULL,
|
||||||
ENUM_TIMEFRAMES forPeriod = NULL,
|
ENUM_TIMEFRAMES forMinorPeriod = NULL,
|
||||||
|
ENUM_TIMEFRAMES forMajorPeriod = NULL,
|
||||||
int loopback = 50,
|
int loopback = 50,
|
||||||
int minorValidation = 7,
|
int minorValidation = 7,
|
||||||
int majorValidation = 14,
|
int majorValidation = 14,
|
||||||
@@ -1644,9 +1645,13 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
|||||||
{
|
{
|
||||||
forSymbol = symbol;
|
forSymbol = symbol;
|
||||||
}
|
}
|
||||||
if (!IsXValid(forPeriod))
|
if (!IsXValid(forMinorPeriod))
|
||||||
{
|
{
|
||||||
forPeriod = period;
|
forMinorPeriod = period;
|
||||||
|
}
|
||||||
|
if (!IsXValid(forMajorPeriod))
|
||||||
|
{
|
||||||
|
forMajorPeriod = period;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1670,7 +1675,7 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
|||||||
retestThreshold,
|
retestThreshold,
|
||||||
retestLoopback,
|
retestLoopback,
|
||||||
forSymbol,
|
forSymbol,
|
||||||
forPeriod //
|
forMinorPeriod //
|
||||||
);
|
);
|
||||||
if (IsValidSize(supportsCount))
|
if (IsValidSize(supportsCount))
|
||||||
{
|
{
|
||||||
@@ -1699,7 +1704,7 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
|||||||
retestThreshold,
|
retestThreshold,
|
||||||
retestLoopback,
|
retestLoopback,
|
||||||
forSymbol,
|
forSymbol,
|
||||||
forPeriod //
|
forMinorPeriod //
|
||||||
);
|
);
|
||||||
if (IsValidSize(resistancesCount))
|
if (IsValidSize(resistancesCount))
|
||||||
{
|
{
|
||||||
@@ -1735,10 +1740,13 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
|||||||
retestThreshold,
|
retestThreshold,
|
||||||
retestLoopback,
|
retestLoopback,
|
||||||
forSymbol,
|
forSymbol,
|
||||||
forPeriod //
|
forMajorPeriod //
|
||||||
);
|
);
|
||||||
if (IsValidSize(supportsCount))
|
if (IsValidSize(supportsCount))
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
UpdateToTime(tmpSupports);
|
||||||
|
|
||||||
//
|
//
|
||||||
FillNotExists(
|
FillNotExists(
|
||||||
supports,
|
supports,
|
||||||
@@ -1764,10 +1772,13 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
|||||||
retestThreshold,
|
retestThreshold,
|
||||||
retestLoopback,
|
retestLoopback,
|
||||||
forSymbol,
|
forSymbol,
|
||||||
forPeriod //
|
forMajorPeriod //
|
||||||
);
|
);
|
||||||
if (IsValidSize(resistancesCount))
|
if (IsValidSize(resistancesCount))
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
UpdateToTime(tmpResistances);
|
||||||
|
|
||||||
//
|
//
|
||||||
FillNotExists(
|
FillNotExists(
|
||||||
resistances,
|
resistances,
|
||||||
|
|||||||
Reference in New Issue
Block a user