125 lines
3.3 KiB
Plaintext
125 lines
3.3 KiB
Plaintext
//
|
|
// Parsing Pivots ...
|
|
|
|
//
|
|
// Detect Selected Pivot ...
|
|
XBoxZone lastOSCPivot;
|
|
double providedSL = 0;
|
|
bool hasNewOSC = false;
|
|
bool hasPivots = HasChild(pivots);
|
|
if (hasPivots)
|
|
{
|
|
//
|
|
// Detect Selected Pivots ...
|
|
count = ArraySize(pivots);
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XBoxZone iPivot = pivots[i];
|
|
|
|
//
|
|
// Detect Selected Last OSC Pivots ...
|
|
bool isOSC =
|
|
Contains(
|
|
"XCA_RSI",
|
|
iPivot.type //
|
|
) ||
|
|
Contains(
|
|
"XCA_CCI",
|
|
iPivot.type //
|
|
);
|
|
bool canSetOSC =
|
|
!isOSC
|
|
? false
|
|
: !lastOSCPivot.IsValid()
|
|
? true
|
|
: lastOSCPivot.from < iPivot.from;
|
|
if (canSetOSC)
|
|
{
|
|
//
|
|
lastOSCPivot = iPivot;
|
|
|
|
//
|
|
// Detect New OSC Pivot Happens ...
|
|
hasNewOSC = lastOSCPivot.IsValid() &&
|
|
cBar.time == lastOSCPivot.to;
|
|
}
|
|
|
|
//
|
|
// Check Pivot Box Type ...
|
|
bool isPVPivot =
|
|
Contains(
|
|
"XCA_PEAKSWHRES",
|
|
iPivot.type //
|
|
) ||
|
|
Contains(
|
|
"XCA_VALESWLSUP",
|
|
iPivot.type //
|
|
);
|
|
if (isPVPivot)
|
|
{
|
|
//
|
|
// Select Box for OSC ...
|
|
if (hasNewOSC)
|
|
{
|
|
//
|
|
bool canSelectBox =
|
|
pivotBox.IsValid()
|
|
? false
|
|
: lastOSCPivot.dir == iPivot.dir &&
|
|
(IsBullish(iPivot.dir)
|
|
? lastOSCPivot.upper > iPivot.upper &&
|
|
lastOSCPivot.lower < iPivot.upper &&
|
|
lastOSCPivot.lower <= iPivot.lower
|
|
: lastOSCPivot.lower < iPivot.lower &&
|
|
lastOSCPivot.upper > iPivot.lower &&
|
|
lastOSCPivot.upper >= iPivot.upper);
|
|
if (canSelectBox)
|
|
{
|
|
pivotBox = iPivot;
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
iPivot.Clean();
|
|
|
|
//
|
|
}
|
|
}
|
|
|
|
//
|
|
// Signaller Summarization ...
|
|
|
|
//
|
|
// Cond1 Act Using PEAK VALE Box Activation or Rejection ...
|
|
|
|
//
|
|
bool isCond1Bullish =
|
|
//
|
|
hasNewOSC &&
|
|
(cVale < pVale ||
|
|
pVale < p2Vale) &&
|
|
pivotBox.IsValid() &&
|
|
pivotBox.IsBullish() &&
|
|
lastOSCPivot.IsBullish() &&
|
|
conditions.isValeIsPivot
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCond1Bearish =
|
|
//
|
|
hasNewOSC &&
|
|
(cPeak > pPeak ||
|
|
pPeak > p2Peak) &&
|
|
pivotBox.IsValid() &&
|
|
pivotBox.IsBearish() &&
|
|
lastOSCPivot.IsBearish() &&
|
|
conditions.isPeakIsPivot
|
|
//
|
|
;
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|