Range Extension Study for TOS

This is a simple study for ThinkOrSwim that plots the range from an opening price to the current price for the current bar. It has an alert associated with it so that if you have a big move the system can let you know about it. You can also tell the indicator if you want to display price or ticks.

In this example the Euro is down a big whopping tick (well it is a new hour). If we exceed our range, then we would get an alert and the bar would change from yellow to red or green depending on the direction.



#hint:atbPlotExtension Bands\nAdds a label that displays the price difference between the opening and the current tick.\n(c) 2010 Deltalatitude, LLC
#hint DisplayTick: Show extension in ticks or absolute price.
#hint MaxExtension: Send an alert if > MaxExtension
# This work is licensed under the Creative Commons Attribution
# 3.0 Unported License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by/3.0/
# or send a letter to Creative Commons, 171 Second Street,
# Suite 300, San Francisco, California, 94105, USA.

input DisplayTick = yes;
input MaxExtension = 100;

def range = if DisplayTick then (close-open)/ticksize() else close-open;

AddChartLabel(yes, concat("Extension: ", range) ,
if range > MaxExtension then color.Green else if range < -MaxExtension then color.Red else color.Yellow);

alert(absValue(range) > MaxExtension,concat("Max Extension for ",getSymbolPart()),Alert.Once,Sound.Ding);

No comments: