#### superbvictory

##### New member

I tried to look for the codes and here is where I found some references:

Thanks in advance

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter superbvictory
- Start date

I tried to look for the codes and here is where I found some references:

Thanks in advance

Here is your requested study converted to TOS based upon the code as listed in https://www.prorealcode.com/prorealtime-indicators/absolute-strength/

Code:

```
# PRC Absolute Strength
# Converted to TOS
#
# https://www.prorealcode.com/prorealtime-indicators/absolute-strength/
declare lower;
input mode = {default RSI, STOCH};
def p0 = close;
def p1 = close[1];
def length = 9; # Period
def smooth = 1; # Smoothing Period
def bulls;
def bears;
if mode == mode.RSI then {
bulls = 0.5 * AbsValue((p0 - p1) + (p0 - p1));
bears = 0.5 * AbsValue((p0 - p1) - (p0 - p1));
}
else {
bulls = p0 - Lowest(low, length);
bears = Highest(high, length) - p0;
}
def AvgBulls = Average(bulls, length);
def AvgBears = Average(bears, length);
plot SmoothedBulls = Average(AvgBulls, smooth);
SmoothedBulls.SetDefaultColor(CreateColor(0,191,255));
SmoothedBulls.SetLineWeight(3);
plot SmoothedBears = Average(AvgBears, smooth);
SmoothedBears.SetDefaultColor(CreateColor(255,0,0));
SmoothedBears.SetLineWeight(3);
```

Last edited by a moderator:

...I would recommend the original indicator is using a WMA average instead of SMA.

@diazlaz Unfortunately i tried using WMA's and got the same result I think the problem may stem from the following:

Any ideas?

Ruby:

```
input modema = {default wma, exp, sma};
#...
def AvgBulls;
def AvgBears;
def SmthBulls;
def SmthBears;
switch (modema) {
case wma:
AvgBulls = WMA(Bulls, length);
AvgBears = WMA(Bears, length);
SmthBulls = WMA(AvgBulls, smooth);
SmthBears = WMA(AvgBears, smooth);
case exp:
AvgBulls = ExpAverage(Bulls, length);
AvgBears = ExpAverage(Bears, length);;
SmthBulls = ExpAverage(AvgBulls, smooth);
SmthBears = ExpAverage(AvgBears, smooth);
case sma:
AvgBulls = Average(Bulls, length);
AvgBears = Average(Bears, length);;
SmthBulls = Average(AvgBulls, smooth);
SmthBears = Average(AvgBears, smooth);
}
```

Not to my way of looking at it...I think it's a good idea @diazlaz ...may not be the ultimate solution, but it is an important step along the wayit's probably not worth it or needed.

Did you plug it in? If so, did it work?

Here is my port:

Ruby:

```
#TITLE
#Absolute Strength Histogram for TOS
#PRC_Absolute Strength | indicator
#DESCRIPTION
#The Absolute Strength indicator indicates the current market “strength”
#in two different ways possible RSI Method and 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.
#CREDITS
#https://www.prorealcode.com/prorealtime-indicators/absolute-strength/
#https://www.prorealcode.com/user/nicolas/
#CHANGELOG
#2019.11.01 @diazlaz Initial Port
declare lower;
#INPUT INDICATOR
input mode = {default RSI, Stoch}; #0-RSI method 1-Stoch method
input length = 9; #length
input smooth = 1; #period of smoothing factor
input modema = {default wma, exp, sma};
input price = close; # price data
#LOGIC
def price1 = price;
def price2 = price[1];
def Bulls;
def Bears;
switch (mode) {
case RSI:
Bulls = 0.5*(AbsValue(Price1-Price2)+(Price1-Price2));
Bears = 0.5*(AbsValue(Price1-Price2)-(Price1-Price2));
case Stoch:
Bulls = price1 - Lowest(low, length);
Bears = Highest(high, length) - price1;
}
def AvgBulls;
def AvgBears;
def SmthBulls;
def SmthBears;
switch (modema) {
case wma:
AvgBulls = WMA(Bulls, length);
AvgBears = WMA(Bears, length);
SmthBulls = WMA(AvgBulls, smooth);
SmthBears = WMA(AvgBears, smooth);
case exp:
AvgBulls = ExpAverage(Bulls, length);
AvgBears = ExpAverage(Bears, length);;
SmthBulls = ExpAverage(AvgBulls, smooth);
SmthBears = ExpAverage(AvgBears, smooth);
case sma:
AvgBulls = Average(Bulls, length);
AvgBears = Average(Bears, length);;
SmthBulls = Average(AvgBulls, smooth);
SmthBears = Average(AvgBears, smooth);
}
#PLOTS
plot pSmthBulls = SmthBulls;
pSmthBulls.AssignValueColor(COLOR.UPTICK);
pSmthBulls.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plot pSmthBears = SmthBears;
pSmthBears.AssignValueColor(COLOR.DOWNTICK);
pSmthBears.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plot pSmthBullsL = SmthBulls;
pSmthBullsL.AssignValueColor(COLOR.GREEN);
pSmthBullsL.SetLineWeight(2);
plot pSmthBearsL = SmthBears;
pSmthBearsL.AssignValueColor(COLOR.RED);
pSmthBearsL.SetLineWeight(2);
#COLORCANDLES
input showColorBars = yes;
AssignPriceColor(
if !showColorBars then
Color.CURRENT
else
if SmthBulls > SmthBears then COLOR.GREEN
else
COLOR.RED
);
```

Thank you. I always look at my WMAs first before anything else, and this is wonderful!

Last edited by a moderator:

I use the RSI in Laguerre Time w/ Fractal Energy on higher aggregations to determine trend/momentum and I use the IronRod Stochastic Momentum Index to time entry on the 5min/2min aggs.

Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|

N | Relative Strength (SPX) Crosses Above 30 Week EMA | Questions | 0 | |

C | How to emulate IBD's RS Relative Strength Ranking? | Indicators | 0 | |

J | Normalized Relative Strength | Indicators | 10 | |

L | Watchlist column and scanner for a Relative Strength Study? | Questions | 9 | |

ARSI - Adaptive Relative Strength Index for ThinkorSwim | Indicators | 8 |