Get Updates:
Email
Twitter
RSS

I’ve been messing with the TRIN as of late and crafted this polarized oscillator using the average value of the TRIN and TRINQ. The oscillator has been inverted so that a rising oscillator line is indicative of rising prices vice the way the actual TRIN works. I’d have to classify this one as experimental so feel free to hack away and post your modified version in the comments. I’ll be creating a user submissions page over the weekend and look forward to posting some of your best scripts!

Polarized TRIN Oscillator

Polarized TRIN Oscillator


# POLARIZEDTRINOSCILLATOR
# (c) 2009 http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 26 MAR 2009

declare lower;

input length = 9;
input EMA_period = 5;

def trin = close("$TRIN");
def trinq = close("$TRIN/Q");

def aveTrin = (trin+trinq)/2;

def fractal = sqrt(power(aveTrin-aveTrin[length],2)+100);
def incremental = sqrt(power(aveTrin-aveTrin[1],2)+1);
def sum = sum(incremental,length);

def resultant = if aveTrin-aveTrin[length] > 0 then round100((fractal/sum)*100) else round100(-(fractal/sum)*100);

def polarizedTrin = if resultant == 0 then 1 else resultant;
plot PTO = expAverage(-polarizedTrin, EMA_period);
PTO.setDefaultColor(color.yellow);

plot zeroline = 0.0;
zeroline.setDefaultColor(color.white);
plot plusLine =75;
plusLine.setDefaultColor(color.cyan);
plot minusLine = -75;
minusLine.setDefaultColor(color.cyan);

9 Responses to “Polarized TRIN Oscillator”

  1. Bill Smith says:

    I had a question about another indicator. On StockCharts.com there is something called the “Summation Index (ratio adjusted)”, which you can get to with the symbol $NYSI. Supposedly it is a chart of advances-declines, but it’s very different from the chart on TOS of $ADVN-$DECN. Do you know if there is a way to duplicate this chart on TOS?

    Thanks,
    Bill

  2. thinkscripter says:

    Bill,
    You’ve peaked my curiosity and I’m investigating if it is possible.
    Eric

  3. Bill Smith says:

    I found this link with the formula, so I think you could make an indicator, but I was trying to figure out how to get it in the price chart area so an indicator (like MACD) could be applied to it. Not sure if that is possible.

    http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:introduction_to_mark#mcclellan_summation_

  4. thinkscripter says:

    Thanks Bill. The indicator was easy enough to build but I’m seeing some inconsistency issues with the ToS data for $ADVN and $DECN. I’m not sure what is causing it but there are holes in the data which make the chart incorrect. I will troubleshoot and contact ToS for their opinion.
    Eric

  5. Curtis White says:

    Thanks for this script! Check my blog for my own version TICK indicator.

    Here is a modification that I made that plots a DOT on the zero line for any time the TRIN is ABOVE 0 “bullish” and no dot when not plotted. The way this is to be used is NOT as a trade system but as a way of saying OKAY should I be more or less bullish. You have to wait until next bar is plotted for confirmation. So basically you want to look for shorts when no dots and buys when dots.

    plot zeroCross = if PTO >= 0 then 0 else double.nan;
    zeroCross.SetPaintingStrategy(paintingStrategy.points);

    Put this on base study (behind graph) and hide everything else except zero line.

  6. Curtis White says:

    Here are my complete modifications. This adds a histogram fill and plots a dot when TRIN >= 0 as explained above.

    plot histogramFill = PTO;
    histoGramFill.SetPaintingStrategy(paintingStrategy.Histogram);
    histoGramFill.SetDefaultColor(color.green);
    histoGramFill.SetLineWeight(3);

    plot zeroCross = if PTO >= 0 then 0 else double.nan;
    zeroCross.SetPaintingStrategy(paintingStrategy.points);

  7. Mark Stevenson says:

    I’m looking for a Fractal Indicator study for the TOS charts. I believe it’s a built-in study in MT4 but I don’t use that package so it would be nice to have a similar indicator for TOS. Have you seen one?

  8. Scott Spain says:

    I was wondering if there was a Fractals indicator for TOS Thinkdesktop? This is the fractal indicator that Mark Stevenson was asking for. It is a standard indicator for the Metatrader 4 program. It is one of the main indicators for Bill Williams Alligator system. The way the indicator displays its results is with arrows above or below price bars.

Leave a Reply