last ...
This commit is contained in:
@@ -215,18 +215,41 @@ input ENUM_X_MA_METHOD hkSignalBarMethod = X_MA_MODE_EMA; // Hiken Ashi Sign
|
|||||||
//
|
//
|
||||||
// Validating ...
|
// Validating ...
|
||||||
input group "Validating";
|
input group "Validating";
|
||||||
|
input bool forceHasSwing = true; // Force Blocks to Have Swing
|
||||||
|
input bool forceHasFLiquidity = false; // Force Blocks to Have Following Liquidity
|
||||||
|
input bool forceHasRLiquidity = false; // Force Blocks to Have Reversal Liquidity
|
||||||
|
input bool validateGapSequence = false; // Validate Block's Gap Sequence
|
||||||
|
input bool validateBlockEdgeBreakout = false; // Validate Block's Edge Breakout
|
||||||
|
|
||||||
//
|
//
|
||||||
// Filtering ...
|
// Filtering ...
|
||||||
input group "Filtering";
|
input group "Filtering";
|
||||||
|
input bool filterBasedOnSar = false; // Filter Based on Sar
|
||||||
|
input bool filterBasedOnRSI = false; // Filter Based on RSI
|
||||||
|
input bool filterBasedOnADX = false; // Filter Based on ADX
|
||||||
|
input bool filterBasedOnTrend = false; // Filter Based on Trend
|
||||||
|
input bool filterBasedOnDelta = false; // Filter Based on Delta
|
||||||
|
input bool filterBasedOnVolume = false; // Filter Based on Volume
|
||||||
|
input bool filterBasedOnSignalBar = false; // Filter Based on Signal Bar
|
||||||
|
input bool filterBasedOnTrendBars = false; // Filter Based on Trend Bars
|
||||||
|
input bool filterBasedOnHKSignalBar = false; // Filter Based on Hiken Ashi Signal Bar
|
||||||
|
|
||||||
|
//
|
||||||
|
// Alert ...
|
||||||
|
input group "Alerts";
|
||||||
|
input string alertPrefix = ""; // Alert Prefix
|
||||||
|
input bool _logAlerts = true; // Log Alerts
|
||||||
|
input bool _pushAlerts = false; // Push Alerts
|
||||||
|
input bool _mailAlerts = false; // Mail Alerts
|
||||||
|
input bool _terminalAlerts = true; // Terminal Alerts
|
||||||
|
|
||||||
//
|
//
|
||||||
// Presentation ...
|
// Presentation ...
|
||||||
input group "Presentation";
|
input group "Presentation";
|
||||||
input bool showBars = true; // Show Bars
|
input bool showBars = true; // Show Bars
|
||||||
input bool showHKBars = false; // Show Hiken Ashi Bars
|
|
||||||
input bool showSar = false; // Show Sar
|
input bool showSar = false; // Show Sar
|
||||||
input bool showTrend = false; // Show Trend
|
input bool showTrend = false; // Show Trend
|
||||||
|
input bool showHKBars = false; // Show Hiken Ashi Bars
|
||||||
input bool showTrendBars = false; // Show Trend Bars
|
input bool showTrendBars = false; // Show Trend Bars
|
||||||
input bool showSignalBars = false; // Show Signal Bars
|
input bool showSignalBars = false; // Show Signal Bars
|
||||||
input bool showHKSignalBars = false; // Show Hiken Ashi Signal Bars
|
input bool showHKSignalBars = false; // Show Hiken Ashi Signal Bars
|
||||||
@@ -234,12 +257,13 @@ input bool showHKSignalBars = false; // Show Hiken Ashi Signal Bars
|
|||||||
//
|
//
|
||||||
// Draws ...
|
// Draws ...
|
||||||
input bool drawZones = true; // Draw Detected Zones
|
input bool drawZones = true; // Draw Detected Zones
|
||||||
input bool drawSignals = true; // Draw Zone's Risk Reward Ratios
|
input bool drawSignals = true; // Draw Zone's Signal
|
||||||
|
|
||||||
//
|
//
|
||||||
input int startCalculationForLastBars = 1000; // Calculate Last n Bars
|
input int startCalculationForLastBars = 1000; // Calculate Last n Bars
|
||||||
int sarArrowCode = 159; // Sar Arrow Code
|
input int sarArrowCode = 159; // Sar Arrow Code
|
||||||
int rrZoneLength = 7; // Draw Risk Reward Ratio till n Bars
|
input int rrZoneLength = 7; // Draw Risk Reward Ratio till n Bars
|
||||||
|
input int maxSignalR2R = 4; // Max Allowed Signal R2R
|
||||||
|
|
||||||
//
|
//
|
||||||
// Styling ...
|
// Styling ...
|
||||||
@@ -265,31 +289,6 @@ input color fvgBullishColor = clrLime; // FVG Bullish Color
|
|||||||
input color fvgBearishColor = clrRed; // FVG Bearish Color
|
input color fvgBearishColor = clrRed; // FVG Bearish Color
|
||||||
input ENUM_LINE_STYLE fvgStyle = STYLE_SOLID; // FVG Style
|
input ENUM_LINE_STYLE fvgStyle = STYLE_SOLID; // FVG Style
|
||||||
|
|
||||||
//
|
|
||||||
// Alert ...
|
|
||||||
input group "Alerts";
|
|
||||||
input string alertPrefix = ""; // Alert Prefix
|
|
||||||
input bool _logAlerts = false; // Log Alerts
|
|
||||||
input bool _pushAlerts = false; // Push Alerts
|
|
||||||
input bool _mailAlerts = false; // Mail Alerts
|
|
||||||
input bool _terminalAlerts = false; // Terminal Alerts
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
bool forceHasSwing = true; // Force Blocks to Have Swing
|
|
||||||
bool forceHasFLiquidity = false; // Force Blocks to Have Following Liquidity
|
|
||||||
bool forceHasRLiquidity = false; // Force Blocks to Have Reversal Liquidity
|
|
||||||
bool validateGapSequence = true; // Validate Block's Gap Sequence
|
|
||||||
bool validateBlockEdgeBreakout = true; // Validate Block's Edge Breakout
|
|
||||||
bool filterBasedOnDelta = false; // Filter Based on Delta
|
|
||||||
bool filterBasedOnVolume = false; // Filter Based on Volume
|
|
||||||
bool filterBasedOnSignalBar = false; // Filter Based on Signal Bar
|
|
||||||
bool filterBasedOnHKSignalBar = false; // Filter Based on Hiken Ashi Signal Bar
|
|
||||||
bool filterBasedOnSar = false; // Filter Based on Sar
|
|
||||||
bool filterBasedOnTrend = false; // Filter Based on Trend
|
|
||||||
bool filterBasedOnTrendBars = false; // Filter Based on Trend Bars
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
|
|
||||||
@@ -1241,8 +1240,11 @@ void CalculateBuffers(
|
|||||||
*
|
*
|
||||||
* @param barIndex: Integer ...
|
* @param barIndex: Integer ...
|
||||||
*/
|
*/
|
||||||
void FillBuffersZero(int barIndex)
|
void FillBuffersZero(int bar_index)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
sarColorBuffer[bar_index] = hideColorIDX;
|
||||||
|
trendColorBuffer[bar_index] = hideColorIDX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1615,43 +1617,20 @@ void DetectTriggerBlock(
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (showTrendBars)
|
// Detect Trend Bar ...
|
||||||
{
|
XOHCL zTrendBar;
|
||||||
//
|
int zTrendIDX = iBarShift(
|
||||||
XOHCL zTrendBar;
|
_Symbol,
|
||||||
int zTrendIDX = iBarShift(
|
mTrendPeriod,
|
||||||
|
zBar.time //
|
||||||
|
);
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
zTrendBar.Init(
|
||||||
_Symbol,
|
_Symbol,
|
||||||
mTrendPeriod,
|
mTrendPeriod,
|
||||||
zBar.time //
|
zTrendIDX + 1 //
|
||||||
);
|
);
|
||||||
isDone =
|
|
||||||
has &&
|
|
||||||
zTrendBar.Init(
|
|
||||||
_Symbol,
|
|
||||||
mTrendPeriod,
|
|
||||||
zTrendIDX + 1 //
|
|
||||||
);
|
|
||||||
if (isDone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCOHCLObject *iObj;
|
|
||||||
isDone = drawer.CreateBar(
|
|
||||||
zTrendBar,
|
|
||||||
iObj,
|
|
||||||
zBar.time //
|
|
||||||
);
|
|
||||||
if (isDone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Style Object ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Store Object ...
|
|
||||||
mObjects.Add(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
zTrendBar.Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define Zone Structure ...
|
// Define Zone Structure ...
|
||||||
@@ -1935,33 +1914,33 @@ void DetectTriggerBlock(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
double iDelta = deltaBuffer[bar_index];
|
double iDelta = deltaBuffer[bar_index];
|
||||||
double iDeltaPrev = deltaBuffer[lastBarIndex];
|
double iPDelta = deltaBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isDeltaUp = iDelta > iDeltaPrev;
|
bool isDeltaUp = iDelta > iPDelta;
|
||||||
bool isDeltaDown = iDelta < iDeltaPrev;
|
bool isDeltaDown = iDelta < iPDelta;
|
||||||
|
|
||||||
//
|
//
|
||||||
double iDeltaSignal = deltaSignalBuffer[bar_index];
|
double iDeltaSignal = deltaSignalBuffer[bar_index];
|
||||||
double iDeltaSignalPrev = deltaSignalBuffer[lastBarIndex];
|
double iPDeltaSignal = deltaSignalBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isDeltaSignalUp = iDeltaSignal > iDeltaSignalPrev;
|
bool isDeltaSignalUp = iDeltaSignal > iPDeltaSignal;
|
||||||
bool isDeltaSignalDown = iDeltaSignal < iDeltaSignalPrev;
|
bool isDeltaSignalDown = iDeltaSignal < iPDeltaSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isDeltaSwitchedToBullish =
|
bool isDeltaSwitchedToBullish =
|
||||||
isDeltaUp &&
|
isDeltaUp &&
|
||||||
isDeltaSignalUp &&
|
isDeltaSignalUp &&
|
||||||
iDelta > iDeltaSignal &&
|
iDelta > iDeltaSignal &&
|
||||||
iDeltaPrev < iDeltaSignalPrev;
|
iPDelta < iPDeltaSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isDeltaSwitchedToBearish =
|
bool isDeltaSwitchedToBearish =
|
||||||
isDeltaDown &&
|
isDeltaDown &&
|
||||||
isDeltaSignalDown &&
|
isDeltaSignalDown &&
|
||||||
iDelta < iDeltaSignal &&
|
iDelta < iDeltaSignal &&
|
||||||
iDeltaPrev > iDeltaSignalPrev;
|
iPDelta > iPDeltaSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
@@ -1978,33 +1957,33 @@ void DetectTriggerBlock(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
double iBullishVolumeSignal = bullishVolumeSignalBuffer[bar_index];
|
double iBullishVolumeSignal = bullishVolumeSignalBuffer[bar_index];
|
||||||
double iBullishVolumeSignalPrev = bullishVolumeSignalBuffer[lastBarIndex];
|
double iPBullishVolumeSignal = bullishVolumeSignalBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBullishVolumeSignalUp = iBullishVolumeSignal > iBullishVolumeSignalPrev;
|
bool isBullishVolumeSignalUp = iBullishVolumeSignal > iPBullishVolumeSignal;
|
||||||
bool isBullishVolumeSignalDown = iBullishVolumeSignal < iBullishVolumeSignalPrev;
|
bool isBullishVolumeSignalDown = iBullishVolumeSignal < iPBullishVolumeSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
double iBearishVolumeSignal = bearishVolumeSignalBuffer[bar_index];
|
double iBearishVolumeSignal = bearishVolumeSignalBuffer[bar_index];
|
||||||
double iBearishVolumeSignalPrev = bearishVolumeSignalBuffer[lastBarIndex];
|
double iPBearishVolumeSignal = bearishVolumeSignalBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBearishVolumeSignalUp = iBearishVolumeSignal > iBearishVolumeSignalPrev;
|
bool isBearishVolumeSignalUp = iBearishVolumeSignal > iPBearishVolumeSignal;
|
||||||
bool isBearishVolumeSignalDown = iBearishVolumeSignal < iBearishVolumeSignalPrev;
|
bool isBearishVolumeSignalDown = iBearishVolumeSignal < iPBearishVolumeSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isVolumeSwitchdToBullish =
|
bool isVolumeSwitchdToBullish =
|
||||||
isBullishVolumeSignalUp &&
|
isBullishVolumeSignalUp &&
|
||||||
!isBearishVolumeSignalUp &&
|
!isBearishVolumeSignalUp &&
|
||||||
iBullishVolumeSignal > iBearishVolumeSignal &&
|
iBullishVolumeSignal > iBearishVolumeSignal &&
|
||||||
iBullishVolumeSignalPrev < iBearishVolumeSignalPrev;
|
iPBullishVolumeSignal < iPBearishVolumeSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isVolumeSwitchdToBearish =
|
bool isVolumeSwitchdToBearish =
|
||||||
isBearishVolumeSignalUp &&
|
isBearishVolumeSignalUp &&
|
||||||
!isBullishVolumeSignalUp &&
|
!isBullishVolumeSignalUp &&
|
||||||
iBearishVolumeSignal > iBullishVolumeSignal &&
|
iBearishVolumeSignal > iBullishVolumeSignal &&
|
||||||
iBearishVolumeSignalPrev < iBullishVolumeSignalPrev;
|
iPBearishVolumeSignal < iPBullishVolumeSignal;
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
@@ -2021,29 +2000,29 @@ void DetectTriggerBlock(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
double iSignalOpen = openSignalBuffer[bar_index];
|
double iSignalOpen = openSignalBuffer[bar_index];
|
||||||
double iSignalOpenPrev = openSignalBuffer[lastBarIndex];
|
double iPSignalOpen = openSignalBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
double iSignalClose = closeSignalBuffer[bar_index];
|
double iSignalClose = closeSignalBuffer[bar_index];
|
||||||
double iSignalClosePrev = closeSignalBuffer[lastBarIndex];
|
double iPSignalClose = closeSignalBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSignalBarBullish = iSignalOpen < iSignalClose;
|
bool isSignalBarBullish = iSignalOpen < iSignalClose;
|
||||||
bool isSignalBarBullishPrev = iSignalOpenPrev < iSignalClosePrev;
|
bool isPSignalBarBullish = iPSignalOpen < iPSignalClose;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSignalBarBearish = iSignalOpen > iSignalClose;
|
bool isSignalBarBearish = iSignalOpen > iSignalClose;
|
||||||
bool isSignalBarBearishPrev = iSignalOpenPrev > iSignalClosePrev;
|
bool isPSignalBarBearish = iPSignalOpen > iPSignalClose;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSignalBarSwitchedToBullish =
|
bool isSignalBarSwitchedToBullish =
|
||||||
isSignalBarBullish &&
|
isSignalBarBullish &&
|
||||||
!isSignalBarBullishPrev;
|
!isPSignalBarBullish;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSignalBarSwitchedToBearish =
|
bool isSignalBarSwitchedToBearish =
|
||||||
isSignalBarBearish &&
|
isSignalBarBearish &&
|
||||||
!isSignalBarBearishPrev;
|
!isPSignalBarBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
@@ -2060,29 +2039,29 @@ void DetectTriggerBlock(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
double iHKSignalOpen = openHKSignalBuffer[bar_index];
|
double iHKSignalOpen = openHKSignalBuffer[bar_index];
|
||||||
double iHKSignalOpenPrev = openHKSignalBuffer[lastBarIndex];
|
double iPHKSignalOpen = openHKSignalBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
double iHKSignalClose = closeHKSignalBuffer[bar_index];
|
double iHKSignalClose = closeHKSignalBuffer[bar_index];
|
||||||
double iHKSignalClosePrev = closeHKSignalBuffer[lastBarIndex];
|
double iPHKSignalClose = closeHKSignalBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isHKSignalBarBullish = iHKSignalOpen < iHKSignalClose;
|
bool isHKSignalBarBullish = iHKSignalOpen < iHKSignalClose;
|
||||||
bool isHKSignalBarBullishPrev = iHKSignalOpenPrev < iHKSignalClosePrev;
|
bool isPHKSignalBarBullish = iPHKSignalOpen < iPHKSignalClose;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isHKSignalBarBearish = iHKSignalOpen > iHKSignalClose;
|
bool isHKSignalBarBearish = iHKSignalOpen > iHKSignalClose;
|
||||||
bool isHKSignalBarBearishPrev = iHKSignalOpenPrev > iHKSignalClosePrev;
|
bool isPHKSignalBarBearish = iPHKSignalOpen > iPHKSignalClose;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isHKSignalBarSwitchedToBullish =
|
bool isHKSignalBarSwitchedToBullish =
|
||||||
isHKSignalBarBullish &&
|
isHKSignalBarBullish &&
|
||||||
!isHKSignalBarBullishPrev;
|
!isPHKSignalBarBullish;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isHKSignalBarSwitchedToBearish =
|
bool isHKSignalBarSwitchedToBearish =
|
||||||
isHKSignalBarBearish &&
|
isHKSignalBarBearish &&
|
||||||
!isHKSignalBarBearishPrev;
|
!isPHKSignalBarBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
@@ -2099,32 +2078,47 @@ void DetectTriggerBlock(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
double iSarState = sarStateBuffer[bar_index];
|
double iSarState = sarStateBuffer[bar_index];
|
||||||
double iSarStatePrev = sarStateBuffer[lastBarIndex];
|
double iPSarState = sarStateBuffer[lastBarIndex];
|
||||||
|
double iP2SarState = sarStateBuffer[lastBarIndex + 1];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSarBullish = iSarState > 0;
|
bool isSarBullish = iSarState > 0;
|
||||||
bool isSarBullishPrev = iSarStatePrev > 0;
|
bool isPSarBullish = iPSarState > 0;
|
||||||
|
bool isP2SarBullish = iP2SarState > 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSarBearish = iSarState < 0;
|
bool isSarBearish = iSarState < 0;
|
||||||
bool isSarBearishPrev = iSarStatePrev < 0;
|
bool isPSarBearish = iPSarState < 0;
|
||||||
|
bool isP2SarBearish = iP2SarState < 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSarSwitchedToBullish =
|
bool isSarSwitchedToBullish =
|
||||||
isSarBullish &&
|
isSarBullish &&
|
||||||
!isSarBullishPrev;
|
!isPSarBullish;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSarSwitchedToBearish =
|
bool isSarSwitchedToBearish =
|
||||||
isSarBearish &&
|
isSarBearish &&
|
||||||
!isSarBearishPrev;
|
!isPSarBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSarPSwitchedToBullish =
|
||||||
|
isPSarBullish &&
|
||||||
|
!isP2SarBullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSarPSwitchedToBearish =
|
||||||
|
isPSarBearish &&
|
||||||
|
!isP2SarBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
has &&
|
has &&
|
||||||
(isBullish
|
(isBullish
|
||||||
? isSarSwitchedToBullish
|
? (isSarSwitchedToBullish ||
|
||||||
: isSarSwitchedToBearish);
|
isSarPSwitchedToBullish)
|
||||||
|
: (isSarSwitchedToBearish ||
|
||||||
|
isSarPSwitchedToBearish));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2134,15 +2128,15 @@ void DetectTriggerBlock(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
double iTrendState = trendStateBuffer[bar_index];
|
double iTrendState = trendStateBuffer[bar_index];
|
||||||
double iTrendStatePrev = trendStateBuffer[lastBarIndex];
|
double iPTrendState = trendStateBuffer[lastBarIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isTrendBullish = iTrendState > 0;
|
bool isTrendBullish = iTrendState > 0;
|
||||||
bool isTrendBullishPrev = iTrendStatePrev > 0;
|
bool isPTrendBullish = iPTrendState > 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isTrendBearish = iTrendState < 0;
|
bool isTrendBearish = iTrendState < 0;
|
||||||
bool isTrendBearishPrev = iTrendStatePrev < 0;
|
bool isPTrendBearish = iPTrendState < 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
double trends[];
|
double trends[];
|
||||||
@@ -2175,13 +2169,13 @@ void DetectTriggerBlock(
|
|||||||
bool isTrendSwitchedToBullish =
|
bool isTrendSwitchedToBullish =
|
||||||
isTrendUp &&
|
isTrendUp &&
|
||||||
isTrendBullish &&
|
isTrendBullish &&
|
||||||
!isTrendBullishPrev;
|
!isPTrendBullish;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isTrendSwitchedToBearish =
|
bool isTrendSwitchedToBearish =
|
||||||
isTrendDown &&
|
isTrendDown &&
|
||||||
isTrendBearish &&
|
isTrendBearish &&
|
||||||
!isTrendBearishPrev;
|
!isPTrendBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
@@ -2191,8 +2185,195 @@ void DetectTriggerBlock(
|
|||||||
: isTrendSwitchedToBearish);
|
: isTrendSwitchedToBearish);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// TREND Bars ...
|
||||||
|
if (has &&
|
||||||
|
zTrendBar.IsValid() &&
|
||||||
|
filterBasedOnTrendBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Calculate Trend Bar's Midd Range ...
|
||||||
|
double mid = zTrendBar.low + ((zTrendBar.high - zTrendBar.low) / 2);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check zBar Close based on MID ...
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
(isBullish
|
||||||
|
? zBar.close < mid
|
||||||
|
: zBar.close > mid);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Trigger Block ...
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
(isBullish
|
||||||
|
? tb.trigger.lower < zTrendBar.GetDown()
|
||||||
|
: tb.trigger.upper > zTrendBar.GetUp());
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// RSI ...
|
||||||
|
if (has &&
|
||||||
|
filterBasedOnRSI)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double rsiTrend = (rsiOBLevel + rsiOSLevel) / 2;
|
||||||
|
|
||||||
|
//
|
||||||
|
double iRSI = rsiBuffer[bar_index];
|
||||||
|
double iPRSI = rsiBuffer[lastBarIndex];
|
||||||
|
double iP2RSI = rsiBuffer[lastBarIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSICrossedOverOS =
|
||||||
|
iRSI > rsiOSLevel &&
|
||||||
|
iPRSI <= rsiOSLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSICrossedUnderOB =
|
||||||
|
iRSI < rsiOBLevel &&
|
||||||
|
iPRSI >= rsiOBLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPRSICrossedOverOS =
|
||||||
|
iPRSI > rsiOSLevel &&
|
||||||
|
iP2RSI <= rsiOSLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPRSICrossedUnderOB =
|
||||||
|
iPRSI < rsiOBLevel &&
|
||||||
|
iP2RSI >= rsiOBLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
(isBullish
|
||||||
|
? (isRSICrossedOverOS ||
|
||||||
|
isPRSICrossedOverOS)
|
||||||
|
: (isRSICrossedUnderOB ||
|
||||||
|
isPRSICrossedUnderOB));
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ADX ...
|
||||||
|
if (has &&
|
||||||
|
filterBasedOnADX)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// ADX ...
|
||||||
|
double iADX = adxBuffer[bar_index];
|
||||||
|
double iPADX = adxBuffer[lastBarIndex];
|
||||||
|
double iP2ADX = adxBuffer[lastBarIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// ADX +DI ...
|
||||||
|
double iADXP = adxpBuffer[bar_index];
|
||||||
|
double iPADXP = adxpBuffer[lastBarIndex];
|
||||||
|
double iP2ADXP = adxpBuffer[lastBarIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// ADX -DI ...
|
||||||
|
double iADXN = adxnBuffer[bar_index];
|
||||||
|
double iPADXN = adxnBuffer[lastBarIndex];
|
||||||
|
double iP2ADXN = adxnBuffer[lastBarIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Preparing Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXBullish = iADX > adxThreshold;
|
||||||
|
bool isADXBearish = iADX < adxThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPADXBullish = iPADX > adxThreshold;
|
||||||
|
bool isPADXBearish = iPADX < adxThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isP2ADXBullish = iP2ADX > adxThreshold;
|
||||||
|
bool isP2ADXBearish = iP2ADX < adxThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXSwitchedToBullish =
|
||||||
|
isADXBullish &&
|
||||||
|
!isPADXBullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXSwitchedToBearish =
|
||||||
|
isADXBearish &&
|
||||||
|
!isPADXBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPADXSwitchedToBullish =
|
||||||
|
isPADXBullish &&
|
||||||
|
!isP2ADXBullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPADXSwitchedToBearish =
|
||||||
|
isPADXBearish &&
|
||||||
|
!isP2ADXBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
(isBullish
|
||||||
|
? (isADXSwitchedToBullish ||
|
||||||
|
isPADXSwitchedToBullish)
|
||||||
|
: (isADXSwitchedToBearish ||
|
||||||
|
isPADXSwitchedToBearish));
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SIGNAL ...
|
||||||
|
if (has &&
|
||||||
|
(drawSignals &&
|
||||||
|
maxSignalR2R > 0))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double targets[];
|
||||||
|
for (int i = 1; i <= maxSignalR2R; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(double)i,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
has = ToSignal(
|
||||||
|
tb.trigger,
|
||||||
|
tb.signal,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle Draw ...
|
// Handle Draw ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Trend Bar ...
|
||||||
|
if (has &&
|
||||||
|
showTrendBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOHCLObject *iObj;
|
||||||
|
isDone = drawer.CreateBar(
|
||||||
|
zTrendBar,
|
||||||
|
iObj,
|
||||||
|
zBar.time //
|
||||||
|
);
|
||||||
|
if (isDone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Style Object ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Store Object ...
|
||||||
|
mObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Trigger Block ...
|
||||||
if (has &&
|
if (has &&
|
||||||
drawZones)
|
drawZones)
|
||||||
{
|
{
|
||||||
@@ -2236,6 +2417,7 @@ void DetectTriggerBlock(
|
|||||||
tb.Clean();
|
tb.Clean();
|
||||||
zBar.Clean();
|
zBar.Clean();
|
||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
|
zTrendBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user