Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 11-26-2009, 02:32 AM   #1

Join Date: Oct 2007
Location: nontaburi
Posts: 3
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts



REQ:How to Add MA to Original RSI

Hi All,

I am using TradeStation 8.2 ,I need to add simple , Exp and Weihgted MA to original RSI, or other word,I need to have RSI with MA of its.since TS just have RSI one line only.

any expert pls kindly suggest me about this,thanks so much in advance.

Kindest regards,

itrader.
itrader is offline  
Reply With Quote
Old 11-26-2009, 02:37 AM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,578
Ignore this user

Thanks: 2,022
Thanked 1,400 Times in 860 Posts



Re: REQ:How to Add MA to Original RSI

can you post the code?

p.s. use the code tag to wrap the code. That's the # icon at the top of the reply window.
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...
Tams is offline  
Reply With Quote
Old 11-26-2009, 03:22 AM   #3

Join Date: Oct 2007
Location: nontaburi
Posts: 3
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts



Re: REQ:How to Add MA to Original RSI

Quote:
Originally Posted by Tams »
can you post the code?

p.s. use the code tag to wrap the code. That's the # icon at the top of the reply window.
Firstly,thank you,Sir for your quick reply.
Here is the RSI code

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

variables:  MyRSI( 0 ) ;

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

{ Color criteria }
if MyRSI > OverBought then 
	SetPlotColor( 1, OverBColor ) 
else if MyRSI < OverSold then 
	SetPlotColor( 1, OverSColor ) ;

{ Alert criteria }
if MyRSI crosses over OverSold then
	Alert( "Indicator exiting oversold zone" )
else if MyRSI crosses under OverBought then
	Alert( "Indicator exiting overbought zone" ) ;


{ ** Copyright (c) 1991-2003 TradeStation Technologies, Inc. All rights reserved. ** 
  ** TradeStation reserves the right to modify or overwrite this analysis technique 
     with each release. ** }
You 're very helpful,Thanks agin.

itrader.
itrader is offline  
Reply With Quote
Old 11-26-2009, 11:27 AM   #4

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,578
Ignore this user

Thanks: 2,022
Thanked 1,400 Times in 860 Posts



Re: REQ:How to Add MA to Original RSI

if you read the code line by line, you will see this:

MyRSI = RSI( Price, Length ) ;


the RSI is calculated, and the data is saved in the variable MyRSI.


to average out the data, all you have to do is add:

Smoothed.RSI = average( MyRSI , Smooth.length);


same deal for weighted average or exponential average... or whatever data modifying calculation you want to make.


.
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...

Last edited by Tams; 11-26-2009 at 11:36 AM.
Tams is offline  
Reply With Quote
Old 11-26-2009, 11:28 AM   #5

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,578
Ignore this user

Thanks: 2,022
Thanked 1,400 Times in 860 Posts



Re: REQ:How to Add MA to Original RSI

Here's the modified code.

note the added input, variables, calculation, and plot statements.


(you should save this code under a different name, so that you do not ruin the original RSI code)


Code:
// Smoothed RSI
// modification by TAMS
// date: 20091126
//


inputs:
	Price( Close ),
	Length( 14 ),
	Smooth.Length( 3 ),  { <--- NEW }
	OverSold( 30 ),
	OverBought( 70 ),
	OverSColor( Cyan ), 
	OverBColor( Red ) ;

variables:
	MyRSI( 0 ) ,
	Smoothed.RSI( 0 ) ;  { <-- NEW }

MyRSI = RSI( Price, Length ) ;
Smoothed.RSI = Average( MyRSI, Smooth.length);  { <-- NEW }

 
Plot1( MyRSI, "RSI" ) ;
Plot11( Smoothed.RSI, "Smoothed.RSI" ) ;  { <-- NEW }

Plot2( OverBought, "OverBot" ) ;
Plot3( OverSold, "OverSld" ) ;

{ Color criteria }
if MyRSI > OverBought then 
	SetPlotColor( 1, OverBColor ) 
else if MyRSI < OverSold then 
	SetPlotColor( 1, OverSColor ) ;

{ Alert criteria }
if MyRSI crosses over OverSold then
	Alert( "Indicator exiting oversold zone" )
else if MyRSI crosses under OverBought then
	Alert( "Indicator exiting overbought zone" ) ;


{ ** Copyright (c) 1991-2003 TradeStation Technologies, Inc. All rights reserved. ** 
  ** TradeStation reserves the right to modify or overwrite this analysis technique 
     with each release. ** }
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...

Last edited by Tams; 11-26-2009 at 11:38 AM.
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
aaa (12-19-2009)
Old 11-26-2009, 11:32 AM   #6

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,578
Ignore this user

Thanks: 2,022
Thanked 1,400 Times in 860 Posts



Re: REQ:How to Add MA to Original RSI

here's how it looks:

if you don't want to see the original RSI plot,
you can delete it from the code,
or simply set it to invisible on the chart.


Attached Thumbnails
REQ:How to Add MA to Original RSI-smoothed-rsi.png  
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...
Tams is offline  
Reply With Quote
Old 11-26-2009, 09:33 PM   #7

Join Date: Oct 2007
Location: nontaburi
Posts: 3
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts



Re: REQ:How to Add MA to Original RSI

Tams,You 're the EXPERT and VERY HELPFUL.I don't have any word to say,except THANK YOU VERY MUCH.This is all i need.

Have a good trade

itrader.
itrader is offline  
Reply With Quote
Old 12-13-2009, 01:44 AM   #8

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,578
Ignore this user

Thanks: 2,022
Thanked 1,400 Times in 860 Posts



Re: REQ:How to Add MA to Original RSI

Quote:
Originally Posted by itrader »
Tams,You 're the EXPERT and VERY HELPFUL.I don't have any word to say,except THANK YOU VERY MUCH.This is all i need.
Have a good trade
itrader.

You are welcome...


You can also check out this variation.
It is on Stochastic... the idea can be applied to RSI, or any oscillating indicator.


Tidal Wave

http://www.traderslaboratory.com/for...wave-5666.html



156
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...

Last edited by Tams; 12-13-2009 at 01:57 AM.
Tams is offline  
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wyckoff: The Original Course DbPhoenix The Wyckoff Forum 0 06-20-2009 11:53 AM

All times are GMT -4. The time now is 04:21 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.