PineConnector PineScript 101

Welcome to the PineConnector PineScript 101,
everything you should know when converting your TradingView script to be compatible with PineConnector.
If you are looking for a library with scripts already compatible with PineConnector, please visit the PineConnector Script Library.

If there is something that we should cover, please drop us a note.

Section Description Remarks
1 Creating a PineScript asdasd
2 Basics asd
3 Plotting Shapes asd
4 Best Practices asd

If you felt that this guide was helpful in your learning,
please consider buying us some beer. 

Buy the team some beer →

Section 1: Creating a PineScript

PineScript, the scripting language designed by TradingView.

Description Remarks
1 At the bottom of your TradingView tab, click "Pine Editor". PineConnector
2 At the bottom panel, click "Open" and then click "New blank indicator". PineConnector
3 You will see the default code shown in the attached image. PineConnector
4 You are now ready to code your script.

// Let's get started!
Top

Section 2: Basics

The fundamentals, explained like you are 15.

Component Remarks
1 Version PineConnector
On row 4 of the script, we can see the following:

//@Version=4
It represents the latest PineScript Version.
Accordingly, you should be referring to the Version 4 of the PineScript Manual.
2 Identifiers Identifiers are used for your variables and functions.
Identifiers cannot begin with a number and are case-sensitive.

IAmAnIdentifier = 25
IAmAnIdentifierToo = 3*3

plot(IAmAnIdentifier)
plot(IAmAnIdentifierToo)
3 Commenting Any text that starts with "//" is a comment.
Comments will not be run and are are used for documentation.
Remember to document frequently so you can refer back at a later point and understand the codes.

//Welcome to my script 
StopLoss = 10 // Crafting standardized 10 pips SL for my strategy
4 Strategy vs Study Strategy scripts are used for backtesting.

This means Strategy Codes can be used to simulate buy and sell orders.

//@version=4
strategy("My Strategy", overlay=true, margin_long=100, margin_short=100)

longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)
Study are for normal script calculations but cannot be used for backtesting.
Without the simulation of orders, less resources are used and will run faster.
Use this, unless backtesting.

study("My Script")
plot(close)
5 Overlay

//@version=4
study("PineConnector Super RSI", overlay=true)
SuperRSI = rsi(close,9)
plot(SuperRSI)
PineConnector With overlay=true, the plot was added on the chart itself.
With RSI ranging between 0 and 100 and EURUSD hovering around 1.18,
the combined output means you can only see the RSI.


//@version=4
study("PineConnector Super RSI", overlay=false)
SuperRSI = rsi(close,9)
plot(SuperRSI)
PineConnector With overlay=false, RSI has its own pane below the chart.
Perfect.
Top