NexusFi: Find Your Edge


Home Menu

 





Convert Pinescript into Thinkscript...


Discussion in ThinkOrSwim

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




 
Search this Thread

Convert Pinescript into Thinkscript...

  #1 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19

Hi,

I'm interested in converting the following PineScript to Thinkscript:
 
Code
// Bill Williams Fractal Template
// Coded By: Matthew Spencer
// If you like this script or use it's code in one of yours, please donate.
// PayPal: [email protected] Bitcoin: 1foxypuyuoNp5n1LNCCCCmjZ4RAXntQ8X

// Define our title and that this script will overlay the candles.
study("Williams Fractals",shorttitle="Fractals", overlay=true)

// Define "n" as the number of periods and keep a minimum value of 2 for error handling.
n = input(title="Periods", defval=2, minval=2, type=integer)

// Williams Fractals are a 5 point lagging indicator that will draw 2 candles behind.
// The purpose of the indicator is to plot points of trend reversals.
// Often these are paired with trailing stop indicators such as Parabolic SAR, Volatility Stop, and SuperTrend.

// Down pointing fractals occur over candles when:
//   High(n-2) < High(n)
//   High(n-1) < High(n)
//   High(n + 1) < High(n)
//   High(n + 2) < High(n)
dnFractal = (high[n-2] < high[n]) and (high[n-1] < high[n]) and (high[n+1] < high[n]) and (high[n+2] < high[n])

// Up pointing fractals occur under candles when:
//   Low(n-2) > Low(n)
//   Low(n-1) > Low(n)
//   Low(n + 1) > Low(n)
//   Low(n + 2) > Low(n)
upFractal = (low[n-2] > low[n]) and (low[n-1] > low[n]) and (low[n+1] > low[n]) and (low[n+2] > low[n])

// Plot the fractals as shapes on the chart.
plotshape(dnFractal, style=shape.arrowdown, location=location.abovebar, offset=-2, color=olive, transp=0) // Down Arrow above candles
plotshape(upFractal, style=shape.arrowup, location=location.belowbar, offset=-2, color=maroon, transp=0)  // Up Arrow below candles

Anyone? Thanks in advance...


Source: https://www.tradingview.com/script/Uyv9vQc2-Williams-Fractals-Tutorial-Template/

Pinescript Introduction: https://blog.tradingview.com/en/tradingview-s-pine-script-introduction-203/

Pinescript Tutorial: https://www.tradingview.com/wiki/Pine_Script_Tutorial

Pinescript Language Reference: https://www.tradingview.com/study-script-reference/

Reply With Quote




Last Updated on May 24, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts