S

#### SolidChiken

##### New member

**2019 Donor**

S

Code:

```
# TS_TapeMomentum
# http://www.thinkscripter.com
# [email protected]
# Last Update 07 Nov 2010
#hint: For use on tick charts <b>ONLY</b>. Red inidcates average momentum, yellow > average, green > two standard deviations.
#hint period: Averaging period.
#hint capMultiplier: Multiple of standard deviation at which large spikes will be truncated with a magenta dot.
#hint capLargeSpikes: Truncate larger spikes at a given standard deviation multiplier to avoid scale compression.
declare lower;
input period = 14;
input capMultiplier = 5.0;
input capLargeSpikes = YES;
def isTickChart = if getAggregationPeriod() <= 3200 then 1 else 0;
def timer = secondsTillTime(1615);
def deltaT = absValue(timer[-1]-timer);
def momentum = if isTickChart then volume/deltaT else 0;;
def aveSM = average(momentum,period);
def sdAve = aveSM+2*stdev(momentum, period);
def spikeCap = totalSum(momentum)/barNumber()*capMultiplier;
plot tickMomentum = if capLargeSpikes then min(momentum, spikeCap) else momentum;
plot cap = if capLargeSpikes and tickMomentum==spikeCap then spikeCap else double.nan;
cap.setStyle(curve.POINTS);
cap.setLineWeight(2);
cap.setDefaultColor(color.magenta);
tickMomentum.setPaintingStrategy(paintingStrategy.HISTOGRAM);
tickMomentum.setLineWeight(2);
tickMomentum.assignValueColor(if tickMomentum >=min(spikeCap, sdAve) then color.green else if tickMomentum > aveSM then color.yellow else color.red);
plot zero = 0;
zero.setDefaultColor(color.white);
addChartLabel(!isTickChart,"THIS STUDY ONLY FOR USE ON TICK CHARTS",color.red);
```

S

It detects fast changes in the pace of the tape. The green bars are “extreme” spikes. When you get these extreme spikes it indicates an algo, HFT, or large institution is executing a huge order, and the pace of the tape is above average. When you get spikes around 600 or more, often they can indicate tops or bottoms.

That's sick! It's basically another type of market internal.

S

Hmm... Now then realized this study requires Tick chart.

Gotta find out if it works for me.

I'm confused. I typed in "$TICK" and I don't see the study.

Switch over to Tick charts or else it will not work. I found it here.Code:`# TS_TapeMomentum # http://www.thinkscripter.com # [email protected] # Last Update 07 Nov 2010 #hint: For use on tick charts <b>ONLY</b>. Red inidcates average momentum, yellow > average, green > two standard deviations. #hint period: Averaging period. #hint capMultiplier: Multiple of standard deviation at which large spikes will be truncated with a magenta dot. #hint capLargeSpikes: Truncate larger spikes at a given standard deviation multiplier to avoid scale compression. declare lower; input period = 14; input capMultiplier = 5.0; input capLargeSpikes = YES; def isTickChart = if getAggregationPeriod() <= 3200 then 1 else 0; def timer = secondsTillTime(1615); def deltaT = absValue(timer[-1]-timer); def momentum = if isTickChart then volume/deltaT else 0;; def aveSM = average(momentum,period); def sdAve = aveSM+2*stdev(momentum, period); def spikeCap = totalSum(momentum)/barNumber()*capMultiplier; plot tickMomentum = if capLargeSpikes then min(momentum, spikeCap) else momentum; plot cap = if capLargeSpikes and tickMomentum==spikeCap then spikeCap else double.nan; cap.setStyle(curve.POINTS); cap.setLineWeight(2); cap.setDefaultColor(color.magenta); tickMomentum.setPaintingStrategy(paintingStrategy.HISTOGRAM); tickMomentum.setLineWeight(2); tickMomentum.assignValueColor(if tickMomentum >=min(spikeCap, sdAve) then color.green else if tickMomentum > aveSM then color.yellow else color.red); plot zero = 0; zero.setDefaultColor(color.white); addChartLabel(!isTickChart,"THIS STUDY ONLY FOR USE ON TICK CHARTS",color.red);`

@Shinthus it's not $tick but a Tick chart as in Bar or Candle chart.

@Shinthus Click on your current timeframe and adjust it to this.

Code:

`def momentum = if isTickChart then volume/deltaT else 0;;`

Code:

`def momentum = volume/deltaT;`

S

When "tape speed" is up, it can signal potential turnaround points (as the big guys load or unload), or sometimes the reinforcement of a trend as more people jump in.

The current version of this indicator will only work on tick charts and will not function properly on time based charts.

Additionally, it's not 100% real time, as it requires the close of the current bar to generate the calculation.

Let me know if you have questions.

-Jeff

Code:

```
declare lower;
#########################################################
plot neutral_line_pos = 1;
neutral_line_pos.SetDefaultColor(Color.GRAY);
neutral_line_pos.SetStyle(Curve.SHORT_DASH);
plot zero_line = 0;
zero_line.SetDefaultColor(Color.GRAY);
#########################################################
def tdiff = SecondsFromTime(0930);
def tsrw = (1 / (tdiff[0] - tdiff[1])) * 100;
input period = 21;
def tsavg = average(tsrw[1], period);
def tsrtavg = tsrw / tsavg;
def truncate = if tsrtavg > 3 then 3 else tsrtavg; #required to attenuate HUGE signals that make the smaller signals hard to read
plot tape_speed = truncate;
tape_speed.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
tape_speed.AssignValueColor(if tape_speed >= 2 then COLOR.WHITE else if tape_speed > 1.0 then Color.GRAY else Color.DARK_GRAY);
```

P

Doesn't work on Day chart. I think it would be great for futures ticks!

P

Is it possible for the histograms to change colors on mobile?

T

S

@takiz1ma I don't have the code. The screenshot was taken from a site. However, I took two studies from the TOS and made them look similar like above.

Code:

```
# TD Ameritrade IP Company, Inc. (c) 2008-2020
# Stochastic Momentum Index
declare lower;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;
def min_low = lowest(low, percentKLength);
def max_high = highest(high, percentKLength);
def rel_diff = close - (max_high + min_low)/2;
def diff = max_high - min_low;
def avgrel = expaverage(expaverage(rel_diff, percentDLength), percentDLength);
def avgdiff = expaverage(expaverage(diff, percentDLength), percentDLength);
plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
smi.AssignValueColor(if smi > smi[1] then Color.green else Color.red);
plot AvgSMI = expaverage(smi, percentDLength);
avgsmi.setDefaultColor(Color.Dark_Gray);
plot overbought = over_bought;
overbought.setDefaultColor(Color.Dark_Red);
overbought.setStyle(curve.SHORT_DASH);
plot oversold = over_sold;
oversold.setDefaultColor(Color.Dark_Green);
oversold.setStyle(curve.SHORT_DASH);
plot UpSignal = if smi crosses above AvgSMI then smi else Double.NaN;
plot DownSignal = if smi crosses below AvgSMI then smi else Double.NaN;
UpSignal.SetDefaultColor(Color.WHITE);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpSignal.SetLineWeight(2);
UpSignal.hideTitle();
DownSignal.SetDefaultColor(Color.Dark_Orange);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownSignal.SetLineWeight(2);
DownSignal.hideTitle();
```

Last edited by a moderator:

T

@SolidChiken Wow thanks i will be trying it out tonight

M

Is there any Tape Reader thinkScript you guys know of?

T

Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|

B | Looking for alterations on this Mobius Market internals script | Questions | 0 | |

A | Looking for someone to write a script for me | Questions | 4 | |

Looking for Gap Up Scanner with EMA's | Questions | 0 | ||

M | Looking for DTOSC indicator | Questions | 3 | |

Q | I am looking to get an alert if a 9 day SMA crosses over the price | Questions | 4 |