Bitcoin Forum

Economy => Trading Discussion => Topic started by: Husires on July 18, 2021, 06:18:02 PM



Title: [GUIDE] create your TA Indicators {TradingView}
Post by: Husires on July 18, 2021, 06:18:02 PM
Table of contents

      1. What is TradingView? (#post_point1)
      2. How Does TradingView Work? (#post_point2)
      3. What is Pine Script? (#post_point3)
      4. The Pine Editor (#post_point4)
      5.  “study” vs “strategy” (#post_point5)
      6. Plotting (RSI) indicator (#post_point5)

What is TradingView?

TradingView is cloud-based go-to charting and social-networking platform for both beginner and advanced active investment traders for tracking movements in the Forex, traditional stock markets and cryptocurrency.

TradingView have some features:

  • HTML5 Charts
  • Server-Side Alerts
  • Trading
  • Social Community of Active Traders
  • publish trading ideas within its social network


How Does TradingView Work?

When you log-in for a free account, you'll have access to the TradingView community and basic features.
You get one chart per layout and one alert with three indicators to use on one device.

we will work on free account and when you need to add more charts you can buy Pro/Pro+ and Premium account.


What is Pine Script?


Pine Script is a scripting language that can be used to control and edit your TradingView charts.It allows users to create custom indicators and run them on our servers.
each script uses computational resources in the cloud, some limits must be imposed in order to share these resources between users.

we will use BTCUSDT trading pair. you can find it  https://www.tradingview.com/symbols/BTCUSDT/

click on full-featured chart button and down for Pine Editor



The Pine Editor

we will write some codes and then click on click on Add to Chart to see our annotations.


study("First Script")  just setting up our annotation which have a new name (First Script in our case)
plot() gives us a line chart
overlay=true adds the indicator to the existing chart
now you can use some of TA indicators as moving averages, simple moving average (SMA), exponential moving average (EMA)


Code:
plotcandle(sma(open, 7))
EMA = (Close - Previous Day’s EMA) * Multiplier - Previous Day’s EMA
Multiplier = 2 / (Length of EMA + 1)


Example of a Pine script
Code:
//@version=4
study("MACD")
fast = 12, slow = 26
fastMA = ema(close, fast)
slowMA = ema(close, slow)
macd = fastMA - slowMA
signal = sma(macd, 9)
plot(macd, color=color.blue)
plot(signal, color=color.orange)

Source: https://www.tradingview.com/pine-script-docs/en/v4/Quickstart_guide.html


“study” vs “strategy”

Pine strategies: used to run backtests and normal script calculations, they also contain strategy.*() calls to send buy and sell orders. see https://www.tradingview.com/pine-script-docs/en/v4/essential/Strategies.html

Pine studies: cannot be used in backtesting. Because they do not make use of the broker emulator, they use less resources and will run faster.

Code:
study(title="New Script", overlay=true)
emaLength = input(title="EMA Length", type=input.integer, defval=20, minval=0)
emaVal = ema(close, emaLength)


Plotting (RSI) indicator

Click on New > RSI Strategy


Code:
//@version=4
strategy("ToDaMoon", overlay=true)
enter = input(11000)
exit = input(11300)
price = close

if (price <= enter)
    strategy.entry("BuyTheDip", strategy.long, comment="BuyTheDip")
if (price >= exit)
    strategy.close_all(comment="SellTheNews")


you can change entry and exit variables

this the basic codes and you can change it or build your own code



Sources

Code:
https://investorjunkie.com/reviews/tradingview/
https://www.tradingview.com/pine-script-docs/en/v4/Introduction.html
https://academy.binance.com/en/articles/how-to-create-ta-indicators-on-tradingview


Title: Re: [GUIDE] create your TA Indicators {TradingView}
Post by: Wind_FURY on July 20, 2021, 06:36:37 AM
Good job, OP. Discovering TradingView, learning Pine Script, and back-testing were what I missed during my newbie years in trading. Cryptocurrencies was my first time to be exposed in investing/trading. If I discovered TradingView from the first day, I would have learned more and might not have lost my initial investment. BUT, I would not have discovered HODL-type + DCA investing too. 8)


Title: Re: [GUIDE] create your TA Indicators {TradingView}
Post by: OcTradism on July 20, 2021, 09:21:42 AM
When Trading view launched that feature about 3 years ago, it was highly accepted by communities. Not all people who join the market knows coding but that feature brings more advantages to coders.

People who are not coders, can buy good scripts to use. There are free scripts but there are paid scripts and if scripts are good, can bring profits for your trading, it's worth to be paid.


Title: Re: [GUIDE] create your TA Indicators {TradingView}
Post by: Bitcoin_Arena on July 22, 2021, 02:28:54 AM
I have been seeing the pine editor on tradingview but I wasn't sure how it works and I don't know any of those programming languages which brings me to a couple of questions.

1. What does it take to learn pine scripting language? Any other Knowledge requirements one needs like knowing Java script, Python etc?
2. How long can it take for one to learn pine script language?


Title: Re: [GUIDE] create your TA Indicators {TradingView}
Post by: Zilon on July 24, 2021, 08:24:31 AM
Back testing has helped me a couple of times in making my trading decision. But for pine script I haven't used it before I only make use of the readily available indicators on my trading view mostly CCI and William's percentage. But with a job well done @Op I think giving pine script a trial would add more color and experience to my trading platform.