Question from TS EasyLanguage newbie

Hi, I'm a TradeStation EasyLanguage newbie and I'm trying to make a ShowMe for a 1-bar RSI-divergence with a price-high.

I want a dot on the current bar if the current bar is higher (or equally high) as the previous bar, and RSI is lower than (or equal to) the previous RSI-value.

Something like this:

Code:
Input: RSI(5);
If High >= high[1] AND RSI[0] < RSI[1] then
begin
Plot1 (Close, "rsi");
end;

Only problem is, this doesn't work. I get a dot on every bar where high[0) >=high[1], so the RSI-values are NOT taken into account.

Can anybody help me?

Thanks from SonnyPlunger :cool:
 
Because RSI is an indicator. If you declared it as an input, it will override the indicator function.

Try this:

Code:
inputs:
	Offset(1),
	Price( Close ),
	Length( 14 ),
	OverSold( 30 ),
	OverBought( 70 ),
	OverSColor( Cyan ), 
	OverBColor( Red ) ;

variables:  var0( 0 ) ;

var0 = RSI( Price, Length ) ;
 

if high >= high[1] and var0 < var0[1] then
plot1(high + offset, "RSI");

                  
if var0 > OverBought then 
	SetPlotColor( 1, OverBColor ) 
else if var0 < OverSold then 
	SetPlotColor( 1, OverSColor ) ;
 
You're not calculating the RSI in your code.

Add something like this:

Code:
inputs:
	Price( Close ),
	Length( 14 );

variables:  MyRSI( 0 ) ;

MyRSI = RSI( Price, Length ) ;

Then use MyRSI everytime you want to reference the RSI value.

-eLindy
 
Quote from elindydotcom:
oops - looks like someone else posted while I was posting.
-eLindy
Yours is a more elegant solution...

You are using RSI the function,

while I have copied RSI the indicator and modified the plot to draw the dot.
 
To Tums and elindydotcom,

WOW! Fast replies! I tried both your suggestions, and both worked!

Thanks a LOT to both of you, much appreciated!

Regards, Sonny Plunger:cool:
 
Can I hone in on this thread with an RSI request?

My oversold RSI setting is 25. I'd like an alarm to trigger when it equals or goes lower than 25. But I don't need it to tell me when it exits, or when it reaches the overbought line, or when it leaves that etc etc etc.

I can't seem to get it to alarm simply on the equaling or dropping lower than 25.
 
Quote from steve0617:
Can I hone in on this thread with an RSI request?
My oversold RSI setting is 25. I'd like an alarm to trigger when it equals or goes lower than 25. But I don't need it to tell me when it exits, or when it reaches the overbought line, or when it leaves that etc etc etc.
I can't seem to get it to alarm simply on the equaling or dropping lower than 25.
Can't you simply use the built-in alert?

or, if you post your code modification, I can take a look for you.
 
Quote from Tums:

Can't you simply use the built-in alert?

or, if you post your code modification, I can take a look for you.

That's the problem. Using the built in system alert cause the alarm to trigger with any break down or out of the RSI. I simply want the alarm to signal when it hits 25 or lower.

I'm not using any code at all. Simply the right click on the RSI line:Alert:Enable Alert
 
Quote from steve0617:
That's the problem. Using the built in system alert cause the alarm to trigger with any break down or out of the RSI. I simply want the alarm to signal when it hits 25 or lower.
I'm not using any code at all. Simply the right click on the RSI line:Alert:Enable Alert

ok, here's the modified code. You should save it under a different name.
I have blocked out the unwanted original code with green {}, and added modifications in red.


Code:
inputs:
	Price( Close ),
	Length( 14 ),
	OverSold( 30 ),
	OverBought( 70 ),
	OverSColor( Cyan ), 
	OverBColor( Red ) ;

variables:  var0( 0 ) ;

var0 = RSI( Price, Length ) ;
 
Plot1( var0, "RSI" ) ;
Plot2( OverBought, "OverBot" ) ;
Plot3( OverSold, "OverSld" ) ;

                  
if var0 > OverBought then 
	SetPlotColor( 1, OverBColor ) 
else if var0 < OverSold then 
	SetPlotColor( 1, OverSColor ) ;

condition1 = var0 crosses [color=green]{over}[/color] [color=red]under[/color] OverSold ;
if condition1 then
	Alert( "Indicator [color=red]Entering[/color] oversold zone" )[color=red];[/color]
	
[color=green]{else 
begin 
condition1 = var0 crosses under OverBought ;
if condition1 then
	Alert( "Indicator exiting overbought zone" ) ;
end;}[/color]
 
Back
Top