Script Structure Flashcards

(20 cards)

1
Q

What is the purpose of Pine Script?

A

Used in TradingView for custom indicators and strategies

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What must be defined at the start of a Pine Script?

A

Pine Script version and whether you’re creating an indicator or strategy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does //@version=5 signify?

A

Specifies that we are using Pine Script v5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the indicator function do?

A

Defines an indicator instead of a strategy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does overlay=true indicate?

A

Plots on the main price chart

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the purpose of the input function?

A

To create configurable user inputs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What type of input does length = input(14, title=’Length’) create?

A

Configurable numeric input

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does src = input(close, title=’Source’) allow the user to do?

A

Choose a data source

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of ma = ta.sma(close, length)?

A

Calculates a 14-period Simple Moving Average

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does highBreakout = high > ta.highest(high, length) check?

A

If current high is highest in last length bars

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What do the variables bullishSignal and bearishSignal represent?

A

Trading signals based on closing price relative to the SMA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What happens if bullishSignal is true?

A

A label is plotted above the price

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does plot(ma, title=’Moving Average’, color=color.blue) do?

A

Plots the moving average

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Fill in the blank: To open a long position, use _______.

A

strategy.entry(‘Long’, strategy.long)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does strategy.close(‘Long’) do?

A

Closes the long position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the function of alertcondition(bullishSignal, title=’Bullish Alert’, message=’Price above SMA!’)?

A

Sends an alert when bullishSignal is true

17
Q

What does the full Pine Script indicator example plot?

A

A simple moving average and displays buy/sell signals

18
Q

What are the two colors defined for buy/sell signals in the example?

A
  • Bullish Color: green
  • Bearish Color: red
19
Q

What is the role of plotshape in the Pine Script?

A

Plots buy/sell signals on the chart

20
Q

True or False: The script provides alerts when the price crosses the SMA.