Nicolas

Absolute Strength

Category: Indicators By: Nicolas Created: January 16, 2019, 11:46 AM
January 16, 2019, 11:46 AM
Indicators
13 Comments
Absolute Strength

The Absolute Strength indicator indicates the current market “strength” in two different ways possible:

  1. RSI Method
  2. Stochastic Method

and by separating the bulls and bears into 2 curves.

The results are then averaged with the same “length” as the one used for these 2 above methods and smoothed a second time using the “Smooth” variable. The moving average mode used is by default the Weighted one.

//PRC_Absolute Strength | indicator
//16.01.2019
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings 
Mode =0   // 0-RSI method 1-Stoch method
Length = 9 // Period
Smooth = 1 // Period of smoothing
ModeMA = 2 // Mode of Moving Average
// --- end of settings 

if barindex>max(Length,Smooth) then 
 Price1=customclose
 Price2=customclose[1]

 if Mode=0 then
  Bulls=0.5*(Abs(Price1-Price2)+(Price1-Price2))
  Bears=0.5*(Abs(Price1-Price2)-(Price1-Price2))
 endif
 if Mode=1 then
  smax=Highest[Length](high)
  smin=Lowest[Length](low)
  Bulls=Price1 - smin
  Bears=smax - Price1
 endif

 AvgBulls=average[Length,ModeMA](Bulls)
 AvgBears=average[Length,ModeMA](Bears)

 SmthBulls=average[Smooth,ModeMA](AvgBulls)
 SmthBears=average[Smooth,ModeMA](AvgBears)
endif

RETURN  SmthBulls coloured(0,0,255,50) style(histogram),  SmthBears coloured(255,0,0,50) style(histogram) , SmthBears coloured(255,0,0) style(line,3), SmthBulls coloured(0,191,255) style(line,3)

 

Download
Filename: PRC_Absolute-Strength.itf
Downloads: 560
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

dau710
7 years ago
#

Are the Bulls Blue & the Bears Red?

dau710
7 years ago
#

Many thanks :)

Nicolas
7 years ago
#

Yes!

Jo han
7 years ago
#

Ok :)

Jo han
7 years ago
#

Thanks for the explanation! Tried to change ModeMA (4 rows at the bottom) with WeightedAverage[9](close) but get "A positive integer field is expected with average" //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge // --- settings //Mode =0 // 0-RSI method 1-Stoch method //Length = 9 // Period //Smooth = 1 // Period of smoothing //ModeMA = 2 // Mode of Moving Average // --- end of settings if barindex>max(Length,Smooth) then Price1=customclose Price2=customclose[1] if Mode=0 then Bulls=0.5*(Abs(Price1-Price2)+(Price1-Price2)) Bears=0.5*(Abs(Price1-Price2)-(Price1-Price2)) endif if Mode=1 then smax=Highest[Length](high) smin=Lowest[Length](low) Bulls=Price1 - smin Bears=smax - Price1 endif // AvgBulls=average[Length,ModeMA](Bulls) AvgBulls=average[Length,WeightedAverage[9](close)](Bulls) //AvgBears=average[Length,ModeMA](Bears) AvgBears=average[Length,WeightedAverage[9](close)](Bears) //SmthBulls=average[Smooth,ModeMA](AvgBulls) SmthBulls=average[Smooth,WeightedAverage[9](close)](AvgBulls) //SmthBears=average[Smooth,ModeMA](AvgBears) SmthBears=average[Smooth,WeightedAverage[9](close)](AvgBears) endif RETURN SmthBulls coloured(0,0,255,50) style(histogram), SmthBears coloured(255,0,0,50) style(histogram) , SmthBears coloured(255,0,0) style(line,3), SmthBulls coloured(0,191,255) style(line,3) Also tried to replace the whole average line with // AvgBulls=average[Length,ModeMA](Bulls) AvgBulls=WeightedAverage[9](Bulls) //AvgBears=average[Length,ModeMA](Bears) AvgBears=WeightedAverage[9](Bears) //SmthBulls=average[Smooth,ModeMA](AvgBulls) SmthBulls=WeightedAverage[9](AvgBulls) //SmthBears=average[Smooth,ModeMA](AvgBears) SmthBears=WeightedAverage[9](AvgBears) Do not get any errors with this but it is still not working with proscreener Any pointers in the right direction (I'm really a beginner in programming) ;) Best Regards, Johan

Nicolas
7 years ago
#

Please open a new topic with the code and an explanation, you have messed up the initial code :)

Jo han
7 years ago
#

I am trying to call Absolute Strength into ProScreener (PRT 11.1) But i do not get any results "matches" in my ProSreener Window. Works fine with other indicators. It's like it not calling the indicator properly? Code in proscreener; ignored, ignored, indicator1, indicator2 = CALL "PRC_Absolute Strength"[0, 9, 1, 2](close) c1 = (indicator1 >= indicator2) SCREENER[c1] ((close/DClose(1)-1)*100 AS "%Chg yest.") Best Regards, Johan

Nicolas
7 years ago
#

The moving average mode is not working in ProScreener, you have to change the code for the appropriate moving average type. By default it is set to Weighted Average, so you have to change all lines containing MODEMA with WeightedAverage, see https://www.prorealcode.com/documentation/weightedaverage/

MStarFX
7 years ago
#

How do I add Absolute Strength indicator into my chart

Bogdan35
7 years ago
#

Hello, I there one for a MT4 File? Thanks!

Vicari0us
8 years ago
#

Perfect thanks! I got it

Vicari0us
8 years ago
#

Hi Nicolas, How do I incorporate this indicator into my strategy? I mean what do I call the indicator. Example: trend = supertrend[7,3] //This is for Supertrend indicator Confirmations = Absolutestrength[??] //What do I add here to use it in the syntax Thanks

Nicolas
8 years ago
#

Use the CALL function: https://www.prorealcode.com/documentation/call/ or use the 'fx' button in the ProBacktest window to add it automatically in your program.

ProRealCode ProRealCode
Loading...