last ...
This commit is contained in:
@@ -1788,414 +1788,3 @@ struct X121SMCStrategySignalProviderData
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Condition Parser ...
|
|
||||||
struct X121SMCStrategyConditionParser
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
string VERSION;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor ...
|
|
||||||
X121SMCStrategyConditionParser()
|
|
||||||
{
|
|
||||||
Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Tools ...
|
|
||||||
|
|
||||||
//
|
|
||||||
void Clean()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
VERSION = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void Parse(
|
|
||||||
X121Conditions &conditions //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
int zIDX = 0;
|
|
||||||
int cIDX = zIDX + 1;
|
|
||||||
int pIDX = cIDX + 1;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reading Required Materials ...
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Signalling Conditions Parsers ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasXSTRConditions(
|
|
||||||
ENUM_X_CYCLES cycle,
|
|
||||||
XBoxZone &box,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
X121SMCStrategySignalProviderData &provider,
|
|
||||||
int barIndex = 0 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
box.Clean();
|
|
||||||
dir = X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fil Selected Data ...
|
|
||||||
XPOIState cState;
|
|
||||||
X121Conditions cXConditions;
|
|
||||||
XPOIStateEvents cStateEvents;
|
|
||||||
XC121SMCCycleHelper *cHelper;
|
|
||||||
X121SMCCycleConditions cConditions;
|
|
||||||
result = provider.SelectCycle(
|
|
||||||
cycle,
|
|
||||||
cState,
|
|
||||||
cStateEvents,
|
|
||||||
cXConditions,
|
|
||||||
cHelper,
|
|
||||||
cConditions //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
cState.Clean();
|
|
||||||
ZeroMemory(cHelper);
|
|
||||||
cConditions.Clean();
|
|
||||||
cXConditions.Clean();
|
|
||||||
cStateEvents.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Parse(cXConditions);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Normalize Args ...
|
|
||||||
|
|
||||||
//
|
|
||||||
if (barIndex < 0)
|
|
||||||
{
|
|
||||||
barIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int idx = -1;
|
|
||||||
int count = 0;
|
|
||||||
bool has = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
int zIDX = barIndex;
|
|
||||||
int cIDX = zIDX + 1;
|
|
||||||
int pIDX = cIDX + 1;
|
|
||||||
int ppIDX = pIDX + 1;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBullish = false;
|
|
||||||
bool isBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL zBar;
|
|
||||||
XOHCL cBar;
|
|
||||||
XOHCL pBar;
|
|
||||||
XOHCL pPBar;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Initial Bars ...
|
|
||||||
result = zBar.Init(
|
|
||||||
cState.symbol,
|
|
||||||
cState.period,
|
|
||||||
barIndex //
|
|
||||||
);
|
|
||||||
result =
|
|
||||||
result &&
|
|
||||||
zBar.GetPreviousBar(cBar);
|
|
||||||
result =
|
|
||||||
result &&
|
|
||||||
cBar.GetPreviousBar(pBar);
|
|
||||||
result =
|
|
||||||
result &&
|
|
||||||
pBar.GetPreviousBar(pPBar);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
zBar.Clean();
|
|
||||||
cBar.Clean();
|
|
||||||
pBar.Clean();
|
|
||||||
cState.Clean();
|
|
||||||
ZeroMemory(cHelper);
|
|
||||||
cConditions.Clean();
|
|
||||||
cXConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Conditions ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// XSTR ...
|
|
||||||
bool isStrIsBullish =
|
|
||||||
(cXConditions.isStrBullish ||
|
|
||||||
cXConditions.isStrSwitchedToBullish);
|
|
||||||
bool isStrIsBearish =
|
|
||||||
(cXConditions.isStrBearish ||
|
|
||||||
cXConditions.isStrSwitchedToBearish);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detecting Str Box ...
|
|
||||||
XBoxZone strBox;
|
|
||||||
bool hasStrBox = false;
|
|
||||||
if (!hasStrBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
hasStrBox =
|
|
||||||
cXConditions.isStrBullish ||
|
|
||||||
cXConditions.isStrBearish;
|
|
||||||
if (hasStrBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
ENUM_X_DIRECTION strDir =
|
|
||||||
cXConditions.isStrBullish
|
|
||||||
? X_DIRECTION_BULLISH
|
|
||||||
: X_DIRECTION_BEARISH;
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL lastBar;
|
|
||||||
ENUM_X_DIRECTION lastDir;
|
|
||||||
bool hasLast =
|
|
||||||
cHelper
|
|
||||||
.DetectNearestStrSwitched(
|
|
||||||
lastBar,
|
|
||||||
lastDir,
|
|
||||||
zIDX //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL prevBar;
|
|
||||||
ENUM_X_DIRECTION prevDir;
|
|
||||||
bool hasPrev =
|
|
||||||
hasLast &&
|
|
||||||
cHelper
|
|
||||||
.DetectNearestStrSwitched(
|
|
||||||
prevBar,
|
|
||||||
prevDir,
|
|
||||||
lastBar.Index() + 1 //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
hasStrBox =
|
|
||||||
hasLast &&
|
|
||||||
hasPrev;
|
|
||||||
if (hasStrBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int fromIDX = MathMax(
|
|
||||||
lastBar.Index(),
|
|
||||||
prevBar.Index() //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
string symbol = cBar.symbol;
|
|
||||||
ENUM_TIMEFRAMES period = cBar.period;
|
|
||||||
|
|
||||||
//
|
|
||||||
datetime from = GetBarTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
fromIDX //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
int length = fromIDX - barIndex;
|
|
||||||
|
|
||||||
//
|
|
||||||
double upper = zBar.FindHighest(
|
|
||||||
length,
|
|
||||||
MODE_HIGH //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
double lower = zBar.FindLowest(
|
|
||||||
length,
|
|
||||||
MODE_LOW //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
strBox.from = from;
|
|
||||||
strBox.dir = strDir;
|
|
||||||
strBox.lower = lower;
|
|
||||||
strBox.upper = upper;
|
|
||||||
strBox.symbol = symbol;
|
|
||||||
strBox.period = period;
|
|
||||||
strBox.type = "XSTRBox";
|
|
||||||
strBox.to = TimeCurrent();
|
|
||||||
|
|
||||||
//
|
|
||||||
hasStrBox =strBox.IsValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
lastBar.Clean();
|
|
||||||
prevBar.Clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// XFastMa ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isFastMaOverStr =
|
|
||||||
(cXConditions.x3maFastBuffer[cIDX] > cXConditions.strBuffer[cIDX]);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isFastMaUnderStr =
|
|
||||||
(cXConditions.x3maFastBuffer[cIDX] < cXConditions.strBuffer[cIDX]);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isFastMaBullishReject =
|
|
||||||
cBar.low < pBar.low &&
|
|
||||||
cBar.low > cXConditions.strBuffer[cIDX] &&
|
|
||||||
cBar.low < cXConditions.x3maFastBuffer[cIDX] &&
|
|
||||||
cBar.GetDown() > cXConditions.x3maFastBuffer[cIDX];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isFastMaBearishReject =
|
|
||||||
cBar.high > pBar.high &&
|
|
||||||
cBar.high < cXConditions.strBuffer[cIDX] &&
|
|
||||||
cBar.high > cXConditions.x3maFastBuffer[cIDX] &&
|
|
||||||
cBar.GetUp() < cXConditions.x3maFastBuffer[cIDX];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Summarize Conditions ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isBullish =
|
|
||||||
//
|
|
||||||
// false
|
|
||||||
hasStrBox &&
|
|
||||||
isStrIsBullish &&
|
|
||||||
isFastMaOverStr &&
|
|
||||||
isFastMaBullishReject
|
|
||||||
//
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isBearish =
|
|
||||||
//
|
|
||||||
// false
|
|
||||||
hasStrBox &&
|
|
||||||
isStrIsBearish &&
|
|
||||||
isFastMaUnderStr &&
|
|
||||||
isFastMaBearishReject
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Filling Requirements ...
|
|
||||||
result =
|
|
||||||
isBullish ||
|
|
||||||
isBearish;
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
|
||||||
XCBoxObject *iObj;
|
|
||||||
bool isCreated = drawer.DrawBox(
|
|
||||||
strBox,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated) {
|
|
||||||
//
|
|
||||||
Print("STRBox");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
dir =
|
|
||||||
isBullish
|
|
||||||
? X_DIRECTION_BULLISH
|
|
||||||
: X_DIRECTION_BEARISH;
|
|
||||||
|
|
||||||
//
|
|
||||||
box.dir = dir;
|
|
||||||
box.from = pPBar.time;
|
|
||||||
box.to = TimeCurrent();
|
|
||||||
box.symbol = cBar.symbol;
|
|
||||||
box.period = cBar.period;
|
|
||||||
|
|
||||||
//
|
|
||||||
double points = GetPoints(box.symbol);
|
|
||||||
|
|
||||||
//
|
|
||||||
double pivot = cXConditions.strBuffer[cIDX];
|
|
||||||
// isBullish
|
|
||||||
// ? cBar.low - (points * 5)
|
|
||||||
// : cBar.high + (points * 5);
|
|
||||||
|
|
||||||
//
|
|
||||||
double point = GetEntry(
|
|
||||||
cBar.symbol,
|
|
||||||
dir //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
box.upper =
|
|
||||||
isBullish
|
|
||||||
? point
|
|
||||||
: pivot;
|
|
||||||
|
|
||||||
//
|
|
||||||
box.lower =
|
|
||||||
isBullish
|
|
||||||
? pivot
|
|
||||||
: point;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool drawBoxes = true;
|
|
||||||
if (drawBoxes)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check All Conditions ...
|
|
||||||
result =
|
|
||||||
box.IsValid() &&
|
|
||||||
HasDirection(dir) &&
|
|
||||||
(isBullish ||
|
|
||||||
isBearish);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cleanup Resources ...
|
|
||||||
zBar.Clean();
|
|
||||||
cBar.Clean();
|
|
||||||
pBar.Clean();
|
|
||||||
pPBar.Clean();
|
|
||||||
cState.Clean();
|
|
||||||
strBox.Clean();
|
|
||||||
cConditions.Clean();
|
|
||||||
cConditions.Clean();
|
|
||||||
ZeroMemory(cHelper);
|
|
||||||
cStateEvents.Clean();
|
|
||||||
cXConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -206,9 +206,7 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Provider XTkKumo ...
|
hasSignalBox = HasXSTRConditions(
|
||||||
X121SMCStrategyConditionParser cParser;
|
|
||||||
hasSignalBox = cParser.HasXSTRConditions(
|
|
||||||
X_CYCLE_DECISION,
|
X_CYCLE_DECISION,
|
||||||
signalBox,
|
signalBox,
|
||||||
signalBoxDir,
|
signalBoxDir,
|
||||||
@@ -386,9 +384,6 @@ class XCX121SMCXINDSignalDetector : public XCBase
|
|||||||
Clean(sls);
|
Clean(sls);
|
||||||
Clean(targets);
|
Clean(targets);
|
||||||
|
|
||||||
//
|
|
||||||
cParser.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
provider.Clean();
|
provider.Clean();
|
||||||
|
|
||||||
|
|||||||
@@ -223,4 +223,368 @@ struct X121SMCStrategyXINDSignalConditions
|
|||||||
//
|
//
|
||||||
// Extension Functions ...
|
// Extension Functions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Signalling Conditions Parsers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasXSTRConditions(
|
||||||
|
ENUM_X_CYCLES cycle,
|
||||||
|
XBoxZone &box,
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
X121SMCStrategySignalProviderData &provider,
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fil Selected Data ...
|
||||||
|
XPOIState cState;
|
||||||
|
X121Conditions cXConditions;
|
||||||
|
XPOIStateEvents cStateEvents;
|
||||||
|
XC121SMCCycleHelper *cHelper;
|
||||||
|
X121SMCCycleConditions cConditions;
|
||||||
|
result = provider.SelectCycle(
|
||||||
|
cycle,
|
||||||
|
cState,
|
||||||
|
cStateEvents,
|
||||||
|
cXConditions,
|
||||||
|
cHelper,
|
||||||
|
cConditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize Args ...
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
int count = 0;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int zIDX = barIndex;
|
||||||
|
int cIDX = zIDX + 1;
|
||||||
|
int pIDX = cIDX + 1;
|
||||||
|
int ppIDX = pIDX + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL zBar;
|
||||||
|
XOHCL cBar;
|
||||||
|
XOHCL pBar;
|
||||||
|
XOHCL pPBar;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initial Bars ...
|
||||||
|
result = zBar.Init(
|
||||||
|
cState.symbol,
|
||||||
|
cState.period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
zBar.GetPreviousBar(cBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
cBar.GetPreviousBar(pBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
pBar.GetPreviousBar(pPBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// XSTR ...
|
||||||
|
bool isStrIsBullish =
|
||||||
|
(cXConditions.isStrBullish ||
|
||||||
|
cXConditions.isStrSwitchedToBullish);
|
||||||
|
bool isStrIsBearish =
|
||||||
|
(cXConditions.isStrBearish ||
|
||||||
|
cXConditions.isStrSwitchedToBearish);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting Str Box ...
|
||||||
|
XBoxZone strBox;
|
||||||
|
bool hasStrBox = false;
|
||||||
|
if (!hasStrBox)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasStrBox =
|
||||||
|
cXConditions.isStrBullish ||
|
||||||
|
cXConditions.isStrBearish;
|
||||||
|
if (hasStrBox)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION strDir =
|
||||||
|
cXConditions.isStrBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL lastBar;
|
||||||
|
ENUM_X_DIRECTION lastDir;
|
||||||
|
bool hasLast =
|
||||||
|
cHelper
|
||||||
|
.DetectNearestStrSwitched(
|
||||||
|
lastBar,
|
||||||
|
lastDir,
|
||||||
|
zIDX //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL prevBar;
|
||||||
|
ENUM_X_DIRECTION prevDir;
|
||||||
|
bool hasPrev =
|
||||||
|
hasLast &&
|
||||||
|
cHelper
|
||||||
|
.DetectNearestStrSwitched(
|
||||||
|
prevBar,
|
||||||
|
prevDir,
|
||||||
|
lastBar.Index() + 1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
hasStrBox =
|
||||||
|
hasLast &&
|
||||||
|
hasPrev;
|
||||||
|
if (hasStrBox)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int fromIDX = MathMax(
|
||||||
|
lastBar.Index(),
|
||||||
|
prevBar.Index() //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = cBar.symbol;
|
||||||
|
ENUM_TIMEFRAMES period = cBar.period;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime from = GetBarTime(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
fromIDX //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int length = fromIDX - barIndex;
|
||||||
|
|
||||||
|
//
|
||||||
|
double upper = zBar.FindHighest(
|
||||||
|
length,
|
||||||
|
MODE_HIGH //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double lower = zBar.FindLowest(
|
||||||
|
length,
|
||||||
|
MODE_LOW //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
strBox.from = from;
|
||||||
|
strBox.dir = strDir;
|
||||||
|
strBox.lower = lower;
|
||||||
|
strBox.upper = upper;
|
||||||
|
strBox.symbol = symbol;
|
||||||
|
strBox.period = period;
|
||||||
|
strBox.type = "XSTRBox";
|
||||||
|
strBox.to = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasStrBox = strBox.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
lastBar.Clean();
|
||||||
|
prevBar.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XFastMa ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastMaOverStr =
|
||||||
|
(cXConditions.x3maFastBuffer[cIDX] > cXConditions.strBuffer[cIDX]);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastMaUnderStr =
|
||||||
|
(cXConditions.x3maFastBuffer[cIDX] < cXConditions.strBuffer[cIDX]);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastMaBullishReject =
|
||||||
|
cBar.low < pBar.low &&
|
||||||
|
cBar.low > cXConditions.strBuffer[cIDX] &&
|
||||||
|
cBar.low < cXConditions.x3maFastBuffer[cIDX] &&
|
||||||
|
cBar.GetDown() > cXConditions.x3maFastBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastMaBearishReject =
|
||||||
|
cBar.high > pBar.high &&
|
||||||
|
cBar.high < cXConditions.strBuffer[cIDX] &&
|
||||||
|
cBar.high > cXConditions.x3maFastBuffer[cIDX] &&
|
||||||
|
cBar.GetUp() < cXConditions.x3maFastBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Summarize Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
//
|
||||||
|
// false
|
||||||
|
hasStrBox &&
|
||||||
|
isStrIsBullish &&
|
||||||
|
isFastMaOverStr &&
|
||||||
|
isFastMaBullishReject
|
||||||
|
//
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
//
|
||||||
|
// false
|
||||||
|
hasStrBox &&
|
||||||
|
isStrIsBearish &&
|
||||||
|
isFastMaUnderStr &&
|
||||||
|
isFastMaBearishReject
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filling Requirements ...
|
||||||
|
result =
|
||||||
|
isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
bool isCreated = drawer.DrawBox(
|
||||||
|
strBox,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Print("STRBox");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.dir = dir;
|
||||||
|
box.from = pPBar.time;
|
||||||
|
box.to = TimeCurrent();
|
||||||
|
box.symbol = cBar.symbol;
|
||||||
|
box.period = cBar.period;
|
||||||
|
|
||||||
|
//
|
||||||
|
double points = GetPoints(box.symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
double pivot = cXConditions.strBuffer[cIDX];
|
||||||
|
// isBullish
|
||||||
|
// ? cBar.low - (points * 5)
|
||||||
|
// : cBar.high + (points * 5);
|
||||||
|
|
||||||
|
//
|
||||||
|
double point = GetEntry(
|
||||||
|
cBar.symbol,
|
||||||
|
dir //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
box.upper =
|
||||||
|
isBullish
|
||||||
|
? point
|
||||||
|
: pivot;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.lower =
|
||||||
|
isBullish
|
||||||
|
? pivot
|
||||||
|
: point;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawBoxes = true;
|
||||||
|
if (drawBoxes)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check All Conditions ...
|
||||||
|
result =
|
||||||
|
box.IsValid() &&
|
||||||
|
HasDirection(dir) &&
|
||||||
|
(isBullish ||
|
||||||
|
isBearish);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
pPBar.Clean();
|
||||||
|
cState.Clean();
|
||||||
|
strBox.Clean();
|
||||||
|
cConditions.Clean();
|
||||||
|
cConditions.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cStateEvents.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Reference in New Issue
Block a user