Friday, May 22, 2009

ThinkOrSwim TRIX indicator as a histogram, a request from L.G.




One reader asked in the comment section how to convert a standard TOS study from Line to Histogram.

Copy paste the TOS code into your own custom study and add a the function ".SetPaintingStrategy(PaintingStrategy.HISTOGRAM);" (like so)

On this study I like the Line over Histogram look, but please change it to suit your taste.



declare lower;

input length = 9;
input colorNormLength = 14;
input price = close;
input signalLength = 3;

def tr = ExpAverage(ExpAverage(ExpAverage(Log(price), length), length), length);

plot TRIX = (tr - tr[1]) * 10000;
plot Signal = ExpAverage(TRIX, signalLength);
plot ZeroLine = 0;

def normVal = FastKCustom(AbsValue(TRIX), colorNormLength);

TRIX.SetDefaultColor(GetColor(8));
TRIX.AssignValueColor(CreateColor(255, (240 - (100 - (if TRIX > 0 then normVal else (-normVal))) * 175 / 200), 0));
ZeroLine.SetDefaultColor(GetColor(5));
Signal.setDefaultColor(GetColor(3));
TRIX.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
blog comments powered by Disqus