Support Center Have any questions regarding the site? Submit a support ticket here. Check this section for announcements also.

08-22-2015, 11:41 AM   #1

Join Date: Aug 2015
Posts: 3

Thanks: 0
Thanked 0 Times in 0 Posts

TOS - Expected Rate of Return - Just Needs a Bit of Tweaking

Hey guys

I created a study for TOS (expected Rate of Return) - just wondering if someone can help me tweak it.

it is as follows:

declare lower;

input length = 5;
input returnLength = 1;
input index = {default DJUSHC, SPX, "Nasdaq Composite", NDX, Dow30, "Russell 2000"};
Assert(returnLength > 0, "'return length' must be positive: " + returnLength);
def primary = if close[returnLength] == 0 then 0 else (close - close[returnLength]) / close[returnLength] * 100;
def logic;

switch (index) { case SPX: logic = close("SPX");
case "Nasdaq Composite": logic = close("COMP");
case NDX: logic = close("NDX");
case "Dow30": logic = close("\$DJI");
case "Russell 2000": logic = close("RUT");
case "DJUSHC": logic = close("\$DJUSHC");
}

def secondary = if logic[returnLength] == 0 then 0 else (logic - logic[returnLength]) / logic[returnLength] * 100;

def Beta = Covariance(primary, secondary, length) / Sqr(StDev(secondary, length));

assert(length > 0, "'length' must be positive: " + length);
plot PercentChg = (100 * (logic / logic[length] - 1) * Beta);

PercentChg.DefineColor("N ormal", GetColor(7));

I'm pretty sure the Formula is correct however i'm not sure what the Length variable is for

I am plotting it for the Dow Health Care Index

Beta * % change in the index

I have also created a Beta study for the same index

« Ct Power Rsi Pivot | - »
 Thread Tools Display Modes Help Others By Rating This Thread Linear Mode Help Others By Rating This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 ∧ Similar Threads Thread Thread Starter Forum Replies Last Post tradernicky Trading Indicators 0 08-22-2015 11:35 AM marinemonk Options Trading Laboratory 3 11-29-2013 05:25 AM Mysticforex Trading and the Markets 46 04-04-2012 04:37 AM 156 Coding Forum 9 08-01-2008 01:34 AM Soultrader Support Center 7 02-12-2008 11:00 AM

### Website Terms

All times are GMT -4. The time now is 09:08 AM.