Bitcoin Forum
May 06, 2024, 09:34:17 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [GUIDE] create your TA Indicators {TradingView}  (Read 125 times)
Husires (OP)
Legendary
*
Offline Offline

Activity: 1596
Merit: 1285



View Profile WWW
March 21, 2021, 11:17:02 AM
 #1

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

.BEST..CHANGE.███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
1714988057
Hero Member
*
Offline Offline

Posts: 1714988057

View Profile Personal Message (Offline)

Ignore
1714988057
Reply with quote  #2

1714988057
Report to moderator
1714988057
Hero Member
*
Offline Offline

Posts: 1714988057

View Profile Personal Message (Offline)

Ignore
1714988057
Reply with quote  #2

1714988057
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Zilon
Sr. Member
****
Offline Offline

Activity: 966
Merit: 421

Bitcoindata.science


View Profile WWW
March 21, 2021, 08:55:32 PM
 #2

Do you mean with script I can run a code on my chart that would enable me create my own customized indicator. Something different from MACD, RSI, MA etc. How and where do I incorporate this code in other to make this development. And can one merge two indicators to form a single indicator using pine script. I would need more clarity thank you.
Husires (OP)
Legendary
*
Offline Offline

Activity: 1596
Merit: 1285



View Profile WWW
March 30, 2021, 09:24:12 AM
 #3

Do you mean with script I can run a code on my chart that would enable me create my own customized indicator. Something different from MACD, RSI, MA etc. How and where do I incorporate this code in other to make this development. And can one merge two indicators to form a single indicator using pine script. I would need more clarity thank you.
The first part will make us learn how to write the basic codes to show or hide the basic indicators using pine script. we can merge some old indicators to get a new one. from which we can use them to build our own investment indicator or even create a new indicator.
All you need is a mathematical rule and learn the basics of programming using trading view pine script and you will get your distinct way of investing

.BEST..CHANGE.███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!