Pinescript to Thinkscript...Thinkscript to Pinescript

borntostun

borntostun

New member
Lifetime
Hi all. New member here. Really enjoying the site and warehouse tools.

Besides ToS, I'm a daily user of Tradingview. I just wanted to check with the group if there are any experts in transforming Pinescript to Thinkscript . . . and Thinkscript to Pinescript?

Thanks! -Kevin
 
BenTen

BenTen

Administrative
Staff
VIP
If you need help converting something from TradingView over to ThinkorSwim, you can always make a request via the Questions forum. Many members have done it in the past.
 
R

rwfarrell

New member
Hello,

I helped a friend locate a premarket high and low indicator for his TradingView platform. I have one for ToS but I really like the way his looked on his chart. Can anyone convert this Pinescript to Thinkscript? Thank you. Robhttps://www.tradingview.com/script/4TALcAck-4C-PreMarket-High-Low/

Code:
//@version=4
//@Author=4C

study("4C PreMarket High/Low", shorttitle="4C PM_H/L", overlay=true)
t = time("1440", "0000-0930")

is_first = na(t[1]) and not na(t) or t[1] < t
ending_hour = input(defval=9, title="Ending Hour", type=input.integer)
ending_minute = input(defval=30, title="Ending Minute", type=input.integer)

day_high = float(na)
day_low = float(na)

if is_first and barstate.isnew and (hour < ending_hour or hour >= 16 or hour == ending_hour and minute < ending_minute)
    day_high := high
    day_low := low
    day_low
else
    day_high := day_high[1]
    day_low := day_low[1]
    day_low

if high > day_high and ((hour < ending_hour or hour >= 16) and hour < 16 or hour == ending_hour and minute < ending_minute)
    day_high := high
    day_high

if low < day_low and ((hour < ending_hour or hour >= 16) and hour < 16 or hour == ending_hour and minute < ending_minute)
    day_low := low
    day_low


plot(day_high, style=plot.style_line, color=color.yellow, linewidth=1)
plot(day_low, style=plot.style_line, color=color.orange, linewidth=1)
 

Similar threads

Top