Help with RSI(2) code  [SOLVED]

Questions about MultiCharts and user contributed studies.
jc123
Posts: 2
Joined: 24 Nov 2014
Has thanked: 2 times

Help with RSI(2) code

Postby jc123 » 24 Nov 2014

Hello,

I'm having difficulty using old code for a new study. I'd like to use it as a paintbar type of study (code below) and as code to be included in a Signal. The paintbar code doesn't plot:

Code: Select all

inputs: RSI(2),Color (Green) ;

If RSI >99 Then
PlotPaintBar(High, Low, Open, Close, "RSI(2)>99", Color);
If this can be fixed, can the same code also be used in a Signal?

Thanks!

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Help with RSI(2) code

Postby TJ » 24 Nov 2014

Hello,

I'm having difficulty using old code for a new study. I'd like to use it as a paintbar type of study (code below) and as code to be included in a Signal. The paintbar code doesn't plot:

Code: Select all

inputs: RSI(2),Color (Green) ;

If RSI >99 Then
PlotPaintBar(High, Low, Open, Close, "RSI(2)>99", Color);
If this can be fixed, can the same code also be used in a Signal?

Thanks!
Is this all the code?

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Help with RSI(2) code

Postby MAtricks » 24 Nov 2014

I'd say its too much code :) This'll do it:

Code: Select all

If RSI(C, 2) >99 Then
PlotPaintBar(High, Low, Open, Close, "RSI(2)>99" );

A bit cleaner if you care:

Code: Select all

Inputs:
RSILength( 2 ),
RSIThreshhold( 99 ) ;

Variables:
vRSI( 0 ) ;

vRSI = RSI( C, RSILength ) ;

If vRSI > RSIThreshhold then
PlotPB(H, L, O, C, "RSI Extreme" );
Yes, it can be made into a signal by switching the plot statement to a buy/sellshort statement.

jc123
Posts: 2
Joined: 24 Nov 2014
Has thanked: 2 times

Re: Help with RSI(2) code  [SOLVED]

Postby jc123 » 24 Nov 2014

That works. Thank you!


Return to “MultiCharts”