0% found this document useful (0 votes)
38 views3 pages

Indikator Skripta2

The document discusses the concept of relative strength according to Robert A. Levy. It compares the performance of securities over past observation periods to determine if they are relatively strong or weak. It then outlines how to calculate relative strength using the closing price and a moving average, and how to interpret the results.

Uploaded by

ema.trend007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views3 pages

Indikator Skripta2

The document discusses the concept of relative strength according to Robert A. Levy. It compares the performance of securities over past observation periods to determine if they are relatively strong or weak. It then outlines how to calculate relative strength using the closing price and a moving average, and how to interpret the results.

Uploaded by

ema.trend007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 3

// This source code is subject to the terms of the Mozilla Public License 2.

0 at
https://mozilla.org/MPL/2.0/
// © Mango2Juice

// Description:
// The concept of Relative Strength to Robert A. Levy is based on the assumption
that,
// securities which exhibited a large relative strength in the past
// will also develop relatively strongly in future, and conversely.
//
// It is compare on the performance of the past with the performance of last observa-
tion period.

// Calculation:
// Arithmetic mean of the candle closing price over the observation period.
// The result is plotted around the 1.0 mark.

// RSL = Close / MA

// Interpretation:
// If an instrument has an RSL of greater than 1, it is more likely than not, the in-
strument is more than weak in the past.
// Second interpretation of Levy is to first divide the standard deviations of the
last 27 weekly closing prices.
// The intention of this method is to determine the volatility of the securities be-
ing observed.

//@version=4
study("Relative Strength Levy", "RSL", precision = 5)

// Inputs
CS0 = "Lime/Red", CS1 = "Aqua/Pink", CS2 = "Coral/Violet", CS3 = "Blue/Yellow"
colorScheme= input(CS0, "Color Scheme", options = [CS0, CS1, CS2, CS3])
display = input("Line", "Display", input.string, options = ["Line", "Columns"])
maLen = input(26, "Length", input.integer)
maType = input("SMA", "MA Type", input.string, options = ["ALMA", "EMA", "DEMA",
"TEMA", "WMA", "VWMA", "SMA", "SMMA", "HMA", "LSMA", "Kijun", "McGinley"])

lsmaOffset = input(0, "* Least Squares (LSMA) Only - Offset Value", minval=0)
almaOffset = input(0.85, "* Arnaud Legoux (ALMA) Only - Offset Value", minval=0,
step=0.01)
almaSigma = input(6, "* Arnaud Legoux (ALMA) Only - Sigma Value", minval=0)

ma(type, src, len) =>


float result = 0
if type=="SMA" // Simple
result := sma(src, len)
if type=="EMA" // Exponential
result := ema(src, len)
if type=="DEMA" // Double Exponential
e = ema(src, len)
result := 2 * e - ema(e, len)
if type=="TEMA" // Triple Exponential
e = ema(src, len)
result := 3 * (e - ema(e, len)) + ema(ema(e, len), len)
if type=="WMA" // Weighted
result := wma(src, len)
if type=="VWMA" // Volume Weighted
result := vwma(src, len)
if type=="SMMA" // Smoothed
w = wma(src, len)
result := na(w[1]) ? sma(src, len) : (w[1] * (len - 1) + src) / len
if type == "RMA"
result := rma(src, len)
if type=="HMA" // Hull
result := wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
if type=="LSMA" // Least Squares
result := linreg(src, len, lsmaOffset)
if type=="ALMA" // Arnaud Legoux
result := alma(src, len, almaOffset, almaSigma)
if type=="Kijun" //Kijun-sen
kijun = avg(lowest(len), highest(len))
result :=kijun
if type=="McGinley"
mg = 0.0
mg := na(mg[1]) ? ema(src, len) : mg[1] + (src - mg[1]) / (len * pow(src/
mg[1], 4))
result :=mg
result

rsl = close / ma(maType, close, maLen)

// Colors

bullsColor = colorScheme == CS0 ? #00FF00ff : colorScheme == CS1 ? #00C0FFff : col-


orScheme == CS2 ? #FF8080ff : color.blue
bearsColor = colorScheme == CS0 ? #FF0000ff : colorScheme == CS1 ? #FF0080ff : col-
orScheme == CS2 ? #AA00FFff : color.yellow

rslColor = rsl > 1 ? bullsColor : bearsColor

// Plots

column = rsl >= 1.0 ? rsl - 1.0 : rsl < 1.0 ? -(1.0 - rsl) : 0.0
_line = display == "Line"
style = _line ? plot.style_line : plot.style_columns

plot(_line ? rsl : column, "RSL", rslColor, 2, style, histbase = 0)


plot(_line ? 1 : 0, "Centerline", color.gray)

You might also like