Washington DC
Posts: 2 since Jan 2018
Thanks Given: 0
Thanks Received: 3
|
declare lower;
#RS
input CorrelationWithSecurity = "SPX";
def close2 = close(CorrelationWithSecurity);
plot RS = if close2 == 0 then 0 else close/close2;
RS.setDefaultColor(GetColor(6));
def sr = CompoundValue("historical data" = RS, "visible data" = if isNaN(sr[1]) then RS else sr[1]);
plot SRatio = sr;
SRatio.setDefaultColor(GetColor(5));
#EMA of RS
input price = close;
input length = 20;
input displace = 0;
input showBreakoutSignals = no;
plot AvgExp = ExpAverage(RS[-displace], length);
plot UpSignal = RS crosses above AvgExp;
plot DownSignal = RS crosses below AvgExp;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
AvgExp.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
|