Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.
tradernicky
-
Content Count
3 -
Joined
-
Last visited
Posts posted by tradernicky
-
-
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;
input hiAlert = 0;
input loAlert = 0;
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("HiAlert", GetColor(5));
PercentChg.DefineColor("Normal", GetColor(7));
PercentChg.DefineColor("LoAlert", GetColor(1));
PercentChg.AssignValueColor(if PercentChg > hiAlert then PercentChg.color("HiAlert") else if PercentChg < loAlert then PercentChg.color("LoAlert") else PercentChg.color("Normal"));
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
-
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;
input hiAlert = 0;
input loAlert = 0;
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("HiAlert", GetColor(5));
PercentChg.DefineColor("Normal", GetColor(7));
PercentChg.DefineColor("LoAlert", GetColor(1));
PercentChg.AssignValueColor(if PercentChg > hiAlert then PercentChg.color("HiAlert") else if PercentChg < loAlert then PercentChg.color("LoAlert") else PercentChg.color("Normal"));
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
TOS - Expected Rate of Return - Just Needs a Bit of Tweaking
in Announcements and Support
Posted
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;
input hiAlert = 0;
input loAlert = 0;
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("HiAlert", GetColor(5));
PercentChg.DefineColor("Normal", GetColor(7));
PercentChg.DefineColor("LoAlert", GetColor(1));
PercentChg.AssignValueColor(if PercentChg > hiAlert then PercentChg.color("HiAlert") else if PercentChg < loAlert then PercentChg.color("LoAlert") else PercentChg.color("Normal"));
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