Danger Zones Indicator

Category: Indicators By: Iván González Created: April 4, 2024, 8:55 AM
April 4, 2024, 8:55 AM
Indicators
4 Comments

Introduction

The Danger Zones indicator is crafted to alert traders about potential danger zones that precede significant shifts in market direction.

Trend Identification

The core of the Danger Zones indicator lies in its ability to determine the current market trend using two key components: the Hull Moving Average (HMA) and the Parabolic SAR.

The indicator considers a trend to be bullish when the closing price is above both the HMA and the Parabolic SAR, and bearish otherwise. When the price does not meet these conditions, the trend is considered neutral.

Identification of Danger Zones

The indicator takes a step further by analyzing buying and selling volume, as well as the position of the RSI relative to a moving average, to identify “Danger Zones.” These zones are signaled when the volume shows a significant slowdown compared to the average, indicating a potential loss of strength in the current trend.

Indicator Functionality

Danger Zones employs a series of calculations to assess the rate of change in volume and the position of the RSI. When a slowdown in buying volume is identified during an uptrend, accompanied by a negative movement in net price and the RSI below its moving average, a danger zone for the uptrend is signaled.

Similarly, danger zones for downtrends are identified under opposite criteria. The indicator uses visual signals, such as changes in background color, to alert about these danger zones.

Practical Applications

The Danger Zones indicator can be utilized to adjust entry and exit strategies, looking for signs of weakness in current trends that may suggest a reversal.

It is crucial to adjust the indicator’s settings, such as the length of the HMA or the parameters of the Parabolic SAR, to accommodate different time frames or assets.

Implementation in ProRealTime

To implement and customize the Danger Zones indicator in ProRealTime, users have the ability to modify a series of variables according to their preferences or specific trading strategies. Below are the key variables that can be adjusted:

Length of HMA (Hull Moving Average):

  • length = 200
  • This variable determines the period of the Hull Moving Average used to identify the market trend. A higher value makes the average smoother and less reactive to price changes.

Parameters of the Parabolic SAR:

  • start = 0.02
  • increment = 0.02
  • maximum = 0.2
  • These variables control the behavior of the Parabolic SAR, including the start, increment, and maximum. Adjusting these parameters can make the indicator more or less sensitive to price movements.

Period of Slowdown in Buying and Selling Volume:

  • buyingVolumeSlowdownPeriod = 5
  • sellingVolumeSlowdownPeriod = 5
  • These variables define the period over which the slowdown in buying and selling volume is calculated, respectively. A longer period can help filter out minor changes in volume.

Type and Length of Moving Average for the RSI:

  • maTypeInput = 0 (0 for SMA, other values for different types of moving averages)
  • maLengthInput = 14
  • These variables allow the user to define the type and length of the moving average applied to the RSI. The choice of moving average type and its length can influence the indicator’s sensitivity to RSI variations.

Length of the RSI:

  • rsiLengthInput = 14
  • Determines the period of the RSI used to calculate the Relative Strength Index. A higher value produces a smoother RSI.

Source of the RSI:

  • rsiSourceInput = close
  • Specifies the data source for the RSI calculation, typically the closing price, but it can be adjusted to use other prices like the high, low, or average.

By modifying these variables, users can tailor the Danger Zones indicator to different trading styles, time frames, or personal preferences. It is crucial to experiment with these settings in a testing environment to determine the optimal combination that aligns with your trading objectives.

//PRC_Danger Zones
//version = 0
//22.03.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//////////////////////////////////////////////////
//------Inputs: Trend Identification--------------------//
//----HMA
length = 200
src = customclose
//----SAR
start = 0.02
increment = 0.02
maximum = 0.2
//-------Inputs: Danger Zone Identification--------------//
//----Volume
buyingVolumeSlowdownPeriod = 5 //Buying Volume Slowdown Period
sellingVolumeSlowdownPeriod = 5 //Selling Volume Slowdown Period
//----Moving average
maTypeInput = 0 // MA Type
maLengthInput = 14 // MA Length
//----RSI
rsiLengthInput = 14 // RSI Length
rsiSourceInput = close // Source
//-------------------------------------------------------//
//-----Trend identification------------------------------//
hma = hullaverage[length](src)
psar = SAR[start,increment,maximum]
trendup = close > hma and close > psar
trenddown = close < hma and close < psar
trendneutral = not trendup or not trenddown
//-------------------------------------------------------//
//-------Danger Zone Identification----------------------//
// Calculate average volume rate of change
buyingVolumeRateOfChange = Momentum[buyingVolumeSlowdownPeriod](volume)
sellingVolumeRateOfChange = momentum[sellingVolumeSlowdownPeriod](volume)
averageBuyingVolumeRateOfChange = average[5,0](buyingVolumeRateOfChange)
averageSellingVolumeRateOfChange = average[5,0](sellingVolumeRateOfChange)
// Calculate net price movement
averageNetPriceMovement = average[5,0](close-close[1])
// RSI integration
src1 = max(momentum[1](rsiSourceInput),0)
alpha1 = 1/rsiLengthInput
if barindex = rsiLengthInput then
up = average[rsiLengthInput](src1)
else
up = alpha1*src1 + (1-alpha1)*up[1]
endif
src2 = -min(momentum[1](rsiSourceInput),0)
alpha2 = 1/rsiLengthInput
if barindex = rsiLengthInput then
down = average[rsiLengthInput](src2)
else
down = alpha2*src2 + (1-alpha2)*down[1]
endif

if down = 0 then
myrsi = 100
elsif up = 0 then
myrsi = 0
else
myrsi = 100-(100/(1+up/down))
endif
rsiMa = average[maLengthInput,maTypeInput](myrsi)

rsibelowMA = myrsi < rsiMA
rsiaboveMA = myrsi > rsiMA
//-----------------------------------------------------//
//-----Trend ending Prediction-------------------------//
// Combine Conditions
uptrendDangerZone = trendUp and buyingVolumeRateOfChange <= averageBuyingVolumeRateOfChange and averageNetPriceMovement < 0 and rsiBelowMA
downtrendDangerZone = trendDown and sellingVolumeRateOfChange <= averageSellingVolumeRateOfChange and averageNetPriceMovement > 0 and rsiAboveMA
//-----------------------------------------------------//
if uptrendDangerZone then
backgroundcolor(255,152,0,70)
elsif downtrendDangerZone then
backgroundcolor(33,150,243,70)
endif

return

Download
Filename: PRC_Danger-Zones.itf
Downloads: 133
Iván González Master
Developer by day, aspiring writer by night. Still compiling my bio... Error 404: presentation not found.
Author’s Profile

Comments

Logo Logo
Loading...