Author

Topic: [GUIDE] create your TA Indicators {TradingView} (Read 135 times)

sr. member
Activity: 966
Merit: 421
Bitcoindata.science
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.
copper member
Activity: 2114
Merit: 1814
฿itcoin for all, All for ฿itcoin.
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?
hero member
Activity: 1722
Merit: 801
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.
legendary
Activity: 2898
Merit: 1823
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. Cool
legendary
Activity: 1596
Merit: 1288
Table of contents

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

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
Jump to: