Pinescript to Thinkscript...Thinkscript to Pinescript

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

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.
 

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)
 

tradermack

New member
Can someone Help me convert this pine script

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic

//@version=4
study("Trend Magic", shorttitle="TM", overlay=true, format=format.price, precision=2, resolution="")
period=input(20,"CCI period")
coeff=input(1,"ATR Multiplier")
AP=input(5,"ATR Period")
ATR=sma(tr,AP)
src=input(close)
upT=low-ATR*coeff
downT=high+ATR*coeff
MagicTrend=0.0
MagicTrend := cci(src,period)>=0 ? (upT<nz(MagicTrend[1]) ? nz(MagicTrend[1]) : upT) : (downT>nz(MagicTrend[1]) ? nz(MagicTrend[1]) : downT)
color1= cci(src,period)>=0 ? #0022FC : #FC0400
plot(MagicTrend, color=color1, linewidth=3)
alertcondition(cross(close, MagicTrend), title="Cross Alert", message="Price - MagicTrend Crossing!")
alertcondition(crossover(low, MagicTrend), title="CrossOver Alarm", message="BUY SIGNAL!")
alertcondition(crossunder(high, MagicTrend), title="CrossUnder Alarm", message="SELL SIGNAL!")
 

rad14733

Well-known member
VIP
@tradermack Welcome to the usethinkscript forums... Considering how you just joined to ask for code conversion it is considered poor forum etiquette to simply join to ask others to do your coding for you... Have you used the search feature to see whether there may already be comparable Thinkscript code here in the forums...??? We don't generally simply convert code upon request unless there has been interest from multiple members... We also expect members to learn Thinscript as that is a primary motive here - to help members learn rather than expecting others to do all their work for them... If you've been perusing these forums prior to joining you should know this... Not to mention the fact that not many members are well versed in Pinescript, myself included... That doesn't mean I haven't taken the time to figure out several conversions of code that I was personally interested in for my own use, however...
 

tradermack

New member
@rad14733 It would be nice of you to provide useful information on how to do some of the conversions or helpful links on how to create my own script. Rather you slam someone for asking a question and assuming I haven't done research based on the amount of time I've been a member. Notice how I said HELP ME and not simply to do the work for me. Also, the title of this forum is pinescript to thinkscript, so I believe I should be in the right place to get advice. You say in your signature "Give a man a fish and he'll be back mooching again tomorrow... Give a man a fishing pole and worms and he'll either learn to fish or starve once the worms are gone..." yet you did not prove the lake, fish, fishing pole, or the worms. you provided me with nothing in the response other than to not post asking for help. Maybe you should learn some proper etiquette yourself.
 

rad14733

Well-known member
VIP
@tradermack If you spend enough time here you'll see that I provide plenty of help but we also need a few adults in the room to keep these forums running properly... You don't have to like my delivery method, but you should heed the message just the same... I'm to the point in my messaging as there is much work to be done here... Not to mention that I have my own coding to do and also have a life outside of these forums...
 

MerryDay

Well-known member
VIP
@tradermack You say that we shouldn't assume you haven't done your research. So, I will take you at your word and NOT post the links to the Trend Magic Indicators on this forum that you have already looked at.

Instead, I will ask you to post screenshots of your pinescript chart along w/ the TOS indicators that you already researched. Tell us, what about the already existing indicators that didn't work for you. It will be better to modify one of the existing scripts rather than add yet another one.
HTH
 

tradermack

New member
@MerryDay Thank you. I might have needed to add more context so that is my fault. you might be right about adding to a script already written.

To give the best example there was a code that I found called super trend by Mobius

https://usethinkscript.com/threads/supertrend-indicator-by-mobius-for-thinkorswim.7/

My primary problem is the ability to structure my buy and sell signals. I've found that the levels don't match how I trade and find sensitivity for the indicator can be too high or low. I trade primarily off of VWAP and EMA when I don't have strong indications to hold a position. Most trend indications will show the direction of the trend but they might say sell when it's just one red candle closing larger than the green and MOBIUS, among others, will change the chart colors. I Like the magic trend pinescript because it doesn't have buy or sell signals, keeps my candle sticks normal, and I like using the Average True Range (ATR) Multiplier like the mobius script. However Mobius also doesn't have the Commodity Channel Index that I like.
simply want to use it with VWAP and my EMA.


Long-winded but short and simple is there a way to add the CCI to the super trend indicator and have the smoother lines of the ATR in the Pinescript indicator and take out the buy and sell signals.
 

MerryDay

Well-known member
VIP
@tradermack You provided most of what we needed to know. What you are looking for might be beyond my abilities. Perhaps others will chime in now that you have given us all a much clearer idea of what you are looking for and how you are using it.

The screenshots are still important. Being able to see what it looks like and how you are using it gets other posters interested in creating it not just for you but for the rest of us.
 

tradermack

New member
@irishgold I will look into it. already looks close to what i want. ill most likely ty to build it because i want more info.

@MerryDay thank you for the guidence i will offer screenshot once i figure out how to do that.

@rad14733 I appologize if my words were harsh. I simply dont like information I deem useless and you were trying to help a new user navigate the site. i should have had a cooler head when replying.
 

Similar threads

Top