Fix Spread Passing for Signalling and Conditions Processing ...
This commit is contained in:
@@ -326,6 +326,16 @@ class XC121SMCCycleHelper : public XCBase
|
||||
//
|
||||
result = conditions.IsValid();
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Calculate(
|
||||
barIndex,
|
||||
conditions //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
@@ -361,6 +371,7 @@ class XC121SMCCycleHelper : public XCBase
|
||||
|
||||
//
|
||||
double bid = GetBid(bar.symbol);
|
||||
double ask = GetAsk(bar.symbol);
|
||||
|
||||
//
|
||||
// Retrieve X121 Cnditions ...
|
||||
@@ -407,7 +418,9 @@ class XC121SMCCycleHelper : public XCBase
|
||||
|
||||
//
|
||||
// Check Zone is Valid For Bar ...
|
||||
bool isValid = bar.high < iZone.Lower();
|
||||
bool isValid = bar.high < iZone.Lower() &&
|
||||
ask < iZone.Lower() &&
|
||||
bid < iZone.Lower();
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
@@ -511,7 +524,9 @@ class XC121SMCCycleHelper : public XCBase
|
||||
|
||||
//
|
||||
// Check Zone is Valid For Bar ...
|
||||
bool isValid = bar.low > iZone.Upper();
|
||||
bool isValid = bar.low > iZone.Upper() &&
|
||||
ask > iZone.Upper() &&
|
||||
bid > iZone.Upper();
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
@@ -616,6 +631,121 @@ class XC121SMCCycleHelper : public XCBase
|
||||
protected:
|
||||
//
|
||||
|
||||
/**
|
||||
* Calculate Requirements ...
|
||||
*
|
||||
* @param barIndex: Integer, Bar Index ...
|
||||
* @param conditions: X121SMCCycleConditions instance ...
|
||||
*/
|
||||
void Calculate(
|
||||
int barIndex,
|
||||
X121SMCCycleConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
int index =
|
||||
barIndex <= 0
|
||||
? 1
|
||||
: barIndex;
|
||||
bool isInited = false;
|
||||
string symbol = GetSymbol();
|
||||
|
||||
//
|
||||
// Retrieve Bar ...
|
||||
XOHCL bar;
|
||||
isInited = GetBar(bar, index);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Previous Bar ...
|
||||
XOHCL pBar;
|
||||
int pIndex = index + 1;
|
||||
isInited = GetBar(pBar, pIndex);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XTick xTick;
|
||||
isInited = xTick.Init(symbol);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool isSarAttached =
|
||||
bar.close > conditions.x121Conditions.sarBuffer[0];
|
||||
if (isSarAttached)
|
||||
{
|
||||
Print("Sar Attached ...");
|
||||
}
|
||||
|
||||
// //
|
||||
// bool isSarBullish =
|
||||
// conditions.x121Conditions.sarBuffer[index] < bar.low;
|
||||
// bool isSarBullishPrev =
|
||||
// conditions.x121Conditions.sarBuffer[pIndex] < pBar.low;
|
||||
|
||||
// //
|
||||
// bool isSarBearish =
|
||||
// conditions.x121Conditions.sarBuffer[index] > bar.high;
|
||||
// bool isSarBearishPrev =
|
||||
// conditions.x121Conditions.sarBuffer[pIndex] > pBar.high;
|
||||
|
||||
// //
|
||||
// bool isSarSwitchedToBullish =
|
||||
// isSarBullish &&
|
||||
// !isSarBullishPrev &&
|
||||
// isSarBearishPrev;
|
||||
|
||||
// //
|
||||
// bool isSarSwitchedToBearish =
|
||||
// isSarBearish &&
|
||||
// !isSarBearishPrev &&
|
||||
// isSarBullishPrev;
|
||||
|
||||
// //
|
||||
// if (isSarSwitchedToBullish ||
|
||||
// isSarSwitchedToBearish)
|
||||
// {
|
||||
// Print("Sar Switched ...");
|
||||
// }
|
||||
|
||||
// //
|
||||
// bool isSarBullish =
|
||||
// conditions.x121Conditions.sarBuffer[1] < xTick.ask &&
|
||||
// conditions.x121Conditions.sarBuffer[1] < xTick.bid &&
|
||||
// conditions.x121Conditions.isSarBullish;
|
||||
|
||||
// //
|
||||
// bool isSarBearish =
|
||||
// conditions.x121Conditions.sarBuffer[1] > xTick.ask &&
|
||||
// conditions.x121Conditions.sarBuffer[1] > xTick.bid &&
|
||||
// conditions.x121Conditions.isSarBearish;
|
||||
|
||||
//
|
||||
// Detect Sar Changes ...
|
||||
// bool isSarChanged = (isSarBullish &&
|
||||
// !isSarBearish) ||
|
||||
// (isSarBearish &&
|
||||
// !isSarBullish);
|
||||
// if (isSarChanged)
|
||||
// {
|
||||
// Print("SarChaned");
|
||||
// }
|
||||
|
||||
//
|
||||
// Detect Peak Changes ...
|
||||
|
||||
//
|
||||
// Detect Vale Changes ...
|
||||
}
|
||||
|
||||
//
|
||||
private:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user