Convert PineScript to ThinkScript. Tradeview to TOS - futures io
futures io



Convert PineScript to ThinkScript. Tradeview to TOS


Discussion in Platforms and Indicators

Updated
    1. trending_up 3,359 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Convert PineScript to ThinkScript. Tradeview to TOS

(login for full post details)
  #1 (permalink)
SHASHA
Vineland, New Jersey
 
 
Posts: 3 since Jan 2021
Thanks: 0 given, 0 received

Can anyone convert this TradingView PineScript to TOS ThinkScript?
Thank you very much in advance!!


//@version=4

study(title="Beep Boop", shorttitle="Beep Boop", resolution="")

fast_length = input(title="Fast Length", type=input.integer, defval=12)

slow_length = input(title="Slow Length", type=input.integer, defval=26)

EMATrend = input(title="EMA Trend", type=input.integer, defval=50)



src = input(title="Source", type=input.source, defval=close)

signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)

sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false)

sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false)

col_grow_above = #26A69A

col_grow_below = #FF0000

col_fall_above = #FFFFFF

col_fall_below = #FFFFFF

col_macd = #0094ff

col_signal = #ff6a00

fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)

slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)

macd = fast_ma - slow_ma

signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)

hist = macd - signal



if (hist > 0)

hist := 0.1



if (hist < 0)

hist := 0.09



fastMA = ema(close, EMATrend)

//fastMA = 0







plot(hist, title="Histogram", style=plot.style_columns, color=(hist == 0.1 ? ((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) ? col_grow_above : col_fall_above) : ((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA)? col_grow_below : col_fall_below) ), transp=0 )

Reply With Quote

Can you help answer these questions
from other members on futures io?
1 min chart v-shape scan help please
ThinkOrSwim
TradingView help in improving Anchored Vwap
Platforms and Indicators
Eurex Denali vs dxFeed
Sierra Chart
Double Sell Order Placed
NinjaTrader
For the experts of Metastock
Platforms and Indicators
 
 
(login for full post details)
  #2 (permalink)
 JayC 
San Diego, CA
 
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
 
Posts: 55 since Mar 2019
Thanks: 8 given, 43 received

Not really sure I have this right but here's an attempt.

Jay

 
Code
declare lower;
declare zerobase;

input fast_length = 12;
input slow_length = 26;
input EMATrend = 50;
input src = close;

input signal_length = 9; 
input sma_source = {default "No", "Yes"};
input sma_signal = {default "No", "Yes"};

def fast_ma = if sma_source then SimpleMovingAvg(src, fast_length) else MovAvgExponential(src, fast_length);
def slow_ma = if sma_source then SimpleMovingAvg(src, slow_length) else MovAvgExponential(src, slow_length);

def macd = fast_ma - slow_ma;
def signal = if sma_signal then SimpleMovingAvg(macd, signal_length) else MovAvgExponential(macd, signal_length);
def hist = if macd - signal > 0 then 0.1 else if macd - signal < 0 then 0.09 else macd - signal;

def fastMA = MovAvgExponential(close, EMATrend);

plot histPlot = hist;

histPlot.DefineColor("grow_above", CreateColor(38, 166, 154));
histPlot.DefineColor("grow_below", CreateColor(255, 0, 0));
histPlot.DefineColor("fall_above", CreateColor(255, 255, 255));
histPlot.DefineColor("fall_below", CreateColor(255, 255, 255));
histPlot.DefineColor("macd", CreateColor(0, 148, 255));
histPlot.DefineColor("signal", CreateColor(255, 106, 0));

histPlot.AssignValueColor(
if hist == 0.1 and close > fastMA and open > fastMA and low > fastMA then 
    histPlot.color("grow_above") 
else if hist == 0.1 then 
    histPlot.color("fall_above")
else if hist == 0.09 and close < fastMA and open < fastMA and high < fastMA then 
    histPlot.color("grow_below")
else histPlot.color("fall_below")
);

histPlot.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);

Reply With Quote
 
(login for full post details)
  #3 (permalink)
SHASHA
Vineland, New Jersey
 
 
Posts: 3 since Jan 2021
Thanks: 0 given, 0 received



JayC View Post
Not really sure I have this right but here's an attempt.

Jay

 
Code
declare lower;
declare zerobase;

input fast_length = 12;
input slow_length = 26;
input EMATrend = 50;
input src = close;

input signal_length = 9; 
input sma_source = {default "No", "Yes"};
input sma_signal = {default "No", "Yes"};

def fast_ma = if sma_source then SimpleMovingAvg(src, fast_length) else MovAvgExponential(src, fast_length);
def slow_ma = if sma_source then SimpleMovingAvg(src, slow_length) else MovAvgExponential(src, slow_length);

def macd = fast_ma - slow_ma;
def signal = if sma_signal then SimpleMovingAvg(macd, signal_length) else MovAvgExponential(macd, signal_length);
def hist = if macd - signal > 0 then 0.1 else if macd - signal < 0 then 0.09 else macd - signal;

def fastMA = MovAvgExponential(close, EMATrend);

plot histPlot = hist;

histPlot.DefineColor("grow_above", CreateColor(38, 166, 154));
histPlot.DefineColor("grow_below", CreateColor(255, 0, 0));
histPlot.DefineColor("fall_above", CreateColor(255, 255, 255));
histPlot.DefineColor("fall_below", CreateColor(255, 255, 255));
histPlot.DefineColor("macd", CreateColor(0, 148, 255));
histPlot.DefineColor("signal", CreateColor(255, 106, 0));

histPlot.AssignValueColor(
if hist == 0.1 and close > fastMA and open > fastMA and low > fastMA then 
    histPlot.color("grow_above") 
else if hist == 0.1 then 
    histPlot.color("fall_above")
else if hist == 0.09 and close < fastMA and open < fastMA and high < fastMA then 
    histPlot.color("grow_below")
else histPlot.color("fall_below")
);

histPlot.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);

Thanks for the attempt. Seems slightly off but very close. Much appreciated.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
SHASHA
Vineland, New Jersey
 
 
Posts: 3 since Jan 2021
Thanks: 0 given, 0 received

Anybody else with an attempt? Thanks

Reply With Quote


futures io Trading Community Platforms and Indicators > Convert PineScript to ThinkScript. Tradeview to TOS


Last Updated on January 12, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

Your Charts Should Speak To You w/Bob Cometta

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts