ROY, Utah
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks Given: 11
Thanks Received: 6
|
Also looking for someone to help turn this ThinkorSwim study into a Strategy for same
declare lower;
input cciLength = 14;
input cciAvgLength = 9;
input over_sold = -100;
input over_bought = 100;
input rsilenght = 14;
input rsiover_Bought = 70;
input rsiover_Sold = 30;
input price = close;
input rsiaverageType = AverageType.WILDERS;
input rsiBUY = 35;
input rsiSELL = 45;
def NetChgAvg = MovingAverage(rsiaverageType, price - price[1], rsilenght);
def TotChgAvg = MovingAverage(rsiaverageType, AbsValue(price - price[1]), rsilenght);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot RSI = 50 * (ChgRatio + 1);
plot CCI = CCI(length = cciLength);
plot CCIAvg = Average(CCI, cciAvgLength);
plot OverBought = over_bought;
plot OverSold = over_sold;
CCI.SetDefaultColor(GetColor(9));
CCIAvg.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(5));
OverSold.SetDefaultColor(GetColor(5));
plot Diff = CCI - CCIAvg;
plot ZeroLine = 0;
plot UpSignal = if Diff crosses above ZeroLine and RSI > rsiBUY then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine and RSI > rsiSELL then ZeroLine else Double.NaN;
CCI.SetDefaultColor(GetColor(1));
CCIAvg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.Color("Positive and Up") else Diff.Color("Positive and Down") else if Diff < Diff[1] then Diff.Color("Negative and Down") else Diff.Color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
|