- Katılım
- 23 Eki 2020
- Mesajlar
- 1,826
----- Original Message ----- From: Glen Wallace <gcwallace@xxxxxxxx> To: MetaStock listserver <metastock@xxxxxxxxxxxxxxxxxx> Sent: July 31, 1999 13:43 Subject: Welles Wilder's Relative Strength Index (RSI) The standard RSI function in MetaStock does not permit the use of a variable for the number of periods or for the price array, so I need to write thelong-hand version. Unfortunately, I'm having a brain fart when it comesto coding the sum of the absolute price changes on the up days (or down days)in a particular, user defined period. Does anyone have the code forthis, or can anyone suggest a solution? RSI = 100 - (100 / (1+U/D)) Where: U = an average of upward price change on a closing basis D = an average of downward price change on a closing basis Re: Welles Wilder's Relative Strength Index (RSI) To: <metastock@xxxxxxxxxxxxx> Subject: Re: Welles Wilder's Relative Strength Index (RSI) From: "Glen Wallace" <gcwallace@xxxxxxxx> Date: Mon, 2 Aug 1999 14:40:46 -0700 References: <003001bedb96$0d041020$5f1c4118@xxxxxxxxxxxxxxxxxxxxxx> Reply-To: metastock@xxxxxxxxxxxxx Sender: owner-metastock@xxxxxxxxxxxxx Thanks to everyone who offered solutions. Below is the code for anRSI where you can customize the number of periods (perhaps to increase ordecrease as volatility changes) and the price array (perhaps to a movingaverage of the close). Although I have not tested it thoroughly, whenI use similar parameters, it matches the standard MetaStock RSI function. Of course, if you spot any flaws or improvements, let me know. Note that the parameters used in the example below have no value as an indicator; they're just for illustration. |
|
Relative Strength Index - Custom III RSIPeriod:= Int(14 / (Stdev(CLOSE,10)/Stdev(CLOSE,5))); RSIDataArray:= Mov(CLOSE,25,SIMPLE); U:= Wilders(If(ROC(RSIDataArray,1,$)>0, ROC(RSIDataArray,1,$), 0), LastValue(RSIPeriod)); D:= Wilders(If(ROC(RSIDataArray,1,$)<0, Abs(ROC(RSIDataArray,1,$)), 0), LastValue(RSIPeriod)); 100-(100/(1+U/D)) |
Source / From: |