NOTE:The original post of the code had the > signs swapped with < signs and is now fixed.
Here’s one for the folks over at EminiAddict and followers of Dave Halsey’s methods. This study is designed only to run on an intraday chart of the $TICK. The day’s range is indicated by the red and green horizontal envelope. Each new high TICK (NHT) or new low TICK (NLT) will push the envelope lines out giving you a handy reference. Extreme TICK readings above user-selectable thresholds are additionally tagged with a yellow triangle. The white line in the center is a 20 period moving average linked to Bollinger Bands in gray. The chart itself is set to a one minute bar chart. The color of the bars changes in response to the TICK moving average above or below the zero line. I added a TPO Profile to the chart as I found it interesting how symmetrical today’s $TICK distribution was. Enjoy – Eric
NOTE: If you are having trouble pasting this code into the TOS Script Editor (i.e. lots of errors), paste the code into a text editor like Notepad first, then copy and paste into TOS from there. This will strip out any hidden formatting that makes the script editor puke.
# TICKRANGE
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 30 SEP 2009
# For use on charts of $TICK only
input showOnlyToday = YES;
input Market_Open_Time = 0930;
input Market_Close_Time = 1600;
input tickAveragePeriod = 20;
input bollingerBandFactor = 2.0;
def day = getDay();
def lastDay = getLastDay();
def isToday = if(day==lastDay,1,0);
def shouldPlot = if(showOnlyToday and isToday, 1,if(!showOnlyToday,1,0));
def pastOpen = if((secondsTillTime(Market_Open_Time) > 0), 0,1);
def pastClose = if((secondsTillTime(Market_Close_Time) > 0), 0,1);
def marketOpen = if(pastOpen and !pastClose, 1, 0);
def firstBar =if (day[1] != day, day-1, 0);
rec regHoursHigh = if(high > regHoursHigh[1] and marketOpen, high, if(marketOpen and !firstBar, regHoursHigh[1], high));
plot TICK_High = if(marketOpen and shouldPlot, regHoursHigh, Double.nan);
TICK_High.SetDefaultColor(color.green);
TICK_High.SetLineWeight(1);
rec regHoursLow = if(low < regHoursLow[1] and marketOpen, low, if(marketOpen and !firstBar, regHoursLow[1],low));
plot TICK_Low = if(marketOpen and shouldPlot, regHoursLow, double.nan);
TICK_Low.SetLineWeight(1);
TICK_Low.setDefaultColor(color.red);
input HighThreshold = 1000;
input LowThreshold = -1000;
def tickDataLow = low("$TICK");
def tickDataHigh = high("$TICK");
def tickClose = close("$TICK");
def isLow = if((tickDataLow < LowThreshold), 1, 0);
def isHigh = if((tickDataHigh > HighThreshold), 1, 0);
plot ExtremeTick = if(isLow and !isHigh, low, if(isHigh and !isLow , high, double.nan));
ExtremeTick.setStyle(curve.POINTS);
ExtremeTick.setPaintingStrategy(paintingStrategy.LINE_VS_TRIANGLES);
ExtremeTick.setDefaultColor(color.yellow);
ExtremeTick.setLineWeight(3);
plot tickSMA = average(tickClose,tickAveragePeriod);
tickSMA.setLineWeight(3);
tickSMA.setDefaultColor(color.white);
def ticksDev = stdev(tickClose, tickAveragePeriod);
plot tickBBH = tickSMA+bollingerBandFactor*tickSDev;
tickBBH.setLineWeight(1);
tickBBH.setDefaultColor(color.dark_gray);
plot tickBBL = tickSMA-bollingerBandFactor*tickSDev;
tickBBL.setLineWeight(1);
tickBBL.setDefaultColor(color.dark_gray);
AssignPriceColor(if tickSMA >= 0 then color.green else color.red);
plot eHT = HighThreshold;
eHT.setDefaultColor(color.dark_gRAY);
plot eLT = LowThreshold;
eLT.setDefaultColor(color.dark_gRAY);
plot zero = 0;
zero.setDefaultColor(color.red);
zero.setLineWeight(2);





The seems wrong
nr 1:
“AssignPriceColor(if tickSMA =0 color.green”
nr 2:
def isHigh = if((tickDataHigh HighThreshold”
nr 3
def pastOpen = if((secondsTillTime(Market_Open_Time) > 0), 0,1);
def pastClose = if((secondsTillTime(Market_Close_Time) > 0), 0,1);
rec regHoursHigh = if(high regHoursHigh[1]” and (“market_open_time)<0= on both past open and close….
Aaaaack!!! The code got a little mangled in the HTML process. It has since been fixed. Thank you,
Eric
I tried this in TOS and the basic indicators work, but the histogram on the right Y axis is absent. Any suggestions.
thanks
Bill
PS nice job – great site
Bill,
The histogram is not part of the TICK range study. It is my TPO Profile running concurrently with the TICK Range.
Eric
One question:
I noticed both filled and empty red and green bars? What does filled and unfilled mean?
Thanks.
-TK
That has to do with your candle settings in TOS and not the study. Take a look at the “Style” settings.
Eric
Tick data for the study which is based on the interval of 10 sec. Because it contains a number of elementranih trading value at the primary level is distorted. So each indicator based on such data is not that not true, but on the contrary can create the illusion that we damage during trading.