|
|||||||||||||||||||
|
|||||||||||||||||||
| Special offer: buy AmiBroker and EOD+Real-Time Data |
|
The SWMA, also known as a triangular moving average, can be conveniently implemented as a double simple moving average, and this code can be separated out into a function that can than be called from the main body of the code as many times as necessary. TradeStation includes a TriAverage function, but the function required here is a little more generalized, so we call it TriAverage_gen and provide the code for it below, following the main indicator code. Summation is another built-in function in TradeStation, and we use that as is. Type : Function, Name : TriAverage_gen inputs: Price( numericseries ), Length( numericsimple ) ; variables: Length1( 0 ), Length2( 0 ) ; Length1 = Floor( ( Length + 1 ) * .5 ) ; Length2 = Ceiling( ( Length + 1 ) * .5 ) ; TriAverage_gen = Average( Average( Price, Length1 ), Length2 ) ; Type : Indicator, Name : Relative Vigor Index inputs: Length( 10 ) ; variables: Change( 0 ), MyRange( 0 ), Num( 0 ), Den( 0 ), RVI( 0 ), RVISig( 0 ) ; Change = Close - Open ; MyRange = High - Low ; Value1 = TriAverage_gen( Change, 4 ) ; Value2 = TriAverage_gen( MyRange, 4 ) ; Num = Summation( Value1, Length ) ; Den = Summation( Value2, Length ) ; if Den > 0 then RVI = Num / Den ; RVISig = TriAverage_gen( RVI, 4 ) ; Plot1( RVI, "RVI" ) ; Plot2( RVISig, "Sig" ) ; This code will also be available for download at www.tradestation2000i.com. Select Support -> EasyLanguage -> Strategies and Indicators -> Traders Tips, and look for the file "RelativeVigorIndex.ELS." -Ramesh Dhingra Director, EasyLanguage Consulting TradeStation Technologies, Inc. (formerly Omega Research, Inc.) a wholly owned subsidiary of TradeStation Group, Inc. http://www.TradeStation.com Code:
all formulas for TradeStation all formulas
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators and systems are submitted by anonymous users. Therefore S4T™ does not take any responsibility for it's quality. If you use any of this information, use it at your own risk. You are responsible for your own trading decisions. Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade. In no case will S4T™ be responsible for your trading gains or losses. |
|
|