• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Exhaustion indicator

powderchick5

New member
VIP
Is there any way to convert this Trading view indicator to TOS?

/@version=4
study(title="[PX] Exhaustion Level", overlay=true)

//{
len = input(100, "Length")
lblOffset = input(30, title="Label Offset")
rProgressColor = input("orange", title="Resistance Color (in progress)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
rSettledColor = input("aqua", title="Resistance Color (settled)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
rStyle = input("solid", title="Resistance style", options=['solid','dotted','dashed'])
rWidth = input(1, title="Resistance Width")
sProgressColor = input("orange", title="Support Color (in progress)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
sSettledColor = input("aqua", title="Support Color (settled)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
sStyle = input("solid", title="Support style", options=['solid','dotted','dashed'])
sWidth = input(1, title="Support Width")
//} --------------- INPUT
//{
var bool overbought_active = false
var bool oversold_active = false
var float resistance = na
var float support = na
var int rFrom = 0
var int rTo = 0
var int sFrom = 0
var int sTo = 0
var rId = line(na)
var rlId = label(na)
var sId = line(na)
var slId = label(na)

src = close - vwap
out = (src-lowest(src, len))/(highest(src, len)-lowest(src, len))
//} --------------- INIT
//{
//{
f_calc_bar_time(offset) => ret = time + ((time-time[1]) * offset)
//} --- f_calc_bar_time()
//{
f_set_color(selection)=>
ret = color.black
if selection == "gray"
ret := color.gray
if selection == "green"
ret := color.green
if selection == "aqua"
ret := color.aqua
if selection == "blue"
ret := color.blue
if selection == "fuchsia"
ret := color.fuchsia
if selection == "lime"
ret := color.lime
if selection == "maroon"
ret := color.maroon
if selection == "navy"
ret := color.navy
if selection == "white"
ret := color.white
if selection == "yellow"
ret := color.yellow
if selection == "olive"
ret := color.olive
if selection == "orange"
ret := color.orange
if selection == "purple"
ret := color.purple
if selection == "red"
ret := color.red
if selection == "silver"
ret := color.silver
if selection == "teal"
ret := color.teal
ret
//} --- f_set_color()
//{
f_set_style(selection)=>
ret = line.style_solid
if selection == "dotted"
ret := line.style_dotted
if selection == "dashed"
ret := line.style_dashed
ret
//} --- f_set_style()
//} --------------- FUNCTIONS

//{
if out == 1 and not overbought_active[1]
overbought_active := true
resistance := high
rFrom := bar_index[1]
rTo := bar_index
rId := line.new(rFrom, resistance, rTo, resistance, color=f_set_color(rProgressColor), extend=extend.right, width=rWidth, style=f_set_style(rStyle))
rlId := label.new(f_calc_bar_time(lblOffset), resistance, xloc=xloc.bar_time, text="Resistance", style=label.style_none, textcolor=f_set_color(rProgressColor))
if overbought_active[1]
if high >= resistance
resistance := high
line.set_x1(rId, bar_index[1])
line.set_x2(rId, bar_index)
line.set_y1(rId, high)
line.set_y2(rId, high)
label.set_y(rlId, high)
else
overbought_active := false
line.set_color(rId, f_set_color(rSettledColor))
label.set_textcolor(rlId, f_set_color(rSettledColor))

if out == 0 and not oversold_active[1]
oversold_active := true
support := low
sFrom := bar_index[1]
sTo := bar_index
sId := line.new(sFrom, support, sTo, support, color=f_set_color(sProgressColor), extend=extend.right, width=sWidth, style=f_set_style(sStyle))
slId := label.new(f_calc_bar_time(lblOffset), support, xloc=xloc.bar_time, text="Support", style=label.style_none, textcolor=f_set_color(sProgressColor))
if oversold_active[1]
if low <= support
support := low
line.set_x1(sId, bar_index[1])
line.set_x2(sId, bar_index)
line.set_y1(sId, low)
line.set_y2(sId, low)
label.set_y(slId, low)
else
oversold_active := false
line.set_color(sId, f_set_color(sSettledColor))
label.set_textcolor(slId, f_set_color(sSettledColor))

//} --------------- LOGIC
 

MerryDay

Well-known member
VIP
@powderchick5 Here is a VWAP pivot study:
https://usethinkscript.com/threads/pivotalert-catch-the-setups.306/
Is this one similar to what you posted?

Have you been using the study, you posted? If you really want to garner some interest in your indicator, your best bet would be to explain in detail why you think yours is superior and to illustrate with screenshots: the comparisons, and differences between yours and the one above. When you put effort into providing the images, the differences, and in explaining how this will improve our trading. It makes it feel more like a team effort. Then armed with all those details, some enterprising poster might become interested in making enhancements to our current indicator.
https://usethinkscript.com/threads/how-to-insert-image-in-a-post-thread.277/

When you are posting your question, please follow the guidelines found here:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-58016

If you don't provide a marked-up screenshot of what you are attempting to accomplish w/ your question and provide at least one screenshot of the whole chart and then any close-up screenshots then you might not generate any interest in someone responding to you.

If you don't know how to upload screenshots to the forum, Here are directions.

When posting your question, make sure to include what aggregations you trade, examples of equities/futures.
Lastly, to generate enough interest for a poster to work on this, make sure you explain how this will enhance our trading.
 

Similar threads

Top