Scripted RSI

The HaasScripting abilities are present inside the Simple license and up.

This is a example script for a Relative Strength Index (RSI) Trading Indicator.

d = Input('Length',14,1,99) -- Inputfield, value 14, range 1-99
p = GetPrices() -- Get (closing) price data
x = RSI(p, d); -- RSI calculation
xx = x[1] -- Reading the last RSI value
Plot('Buy', 30, 1, Green) -- Charting calls
Plot('RSI', xx, 1, Yellow)
Plot('Sell', 70, 1, Red)
if (xx > 70) then
ShortSell() -- Signal a sell/short at RSI > 70
end
if (xx < 30) then
LongBuy() -- Signal a buy/long at RSI < 30
end

When you run this then it will look like this