Reading Assignment: Pinescript

  1. A number is required inside and it looks back in that number
  2. It adds an input to the indicator that you call the input function in.
  3. This is where a user builds their strategy and gives the function all of the parameters to open and close positions.
  4. It contains the current bars volume but using [n] you can call back previous data.
1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    This operator allows to read values of previous bars. The number in the [] bracket indicates the number of bars back.

  2. What does the input function do? (Hint: Try it in Tradingview)
    The input function allows user to input and edit values.

  3. What does the Strategy function do?
    This sets a number of strategy properties.

  4. What information does the Volume variable contain?
    It shows the current bar volume or requests previous bar volumes with the [] bracket operator.

1 Like
  1. [] provides values to previous bars. The number in [] conveys the number of bars back.
  2. The input function lets us input/modify values.
  3. The strategy function sets up the properties of a particular strategy.
  4. It contains the volume for the current bar. By using [], you can go back to the volume of previous bars.
1 Like

What does the language operator [] do? (Hint: It’s not for regular arrays) []
Gets the value of the time series in the past. Can be applied to open/close/low/high.

What does the input function do? (Hint: Try it in Tradingview)
Adds a menu with parameters that can be specified by the user

What does the Strategy function do? Declares a strategy object which can be used to entry/exit/close

What information does the Volume variable contain? It contains the current bar volume of trades.

1 Like
  • What does the language operator [] do? (Hint: It’s not for regular arrays)
    Provides access to previous values of series
  • What does the input function do? (Hint: Try it in Tradingview)
    Adds an input to your script indicator. User can see and edit inputs on the Format Object dialog of the script study.
  • What does the Strategy function do?
    Strategy function sets up a number of different strategy properties.
  • What information does the Volume variable contain?
    The current bar of volume
1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)

Provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical. Floats will be rounded down.

expr1[expr2]

  1. What does the input function do? (Hint: Try it in Tradingview)

Adds an input to your script indicator. User can see and edit inputs on the Format Object dialog of the script study. Script inputs look and behave exactly the same as inputs of built-in Technical Analysis indicators.

  1. What does the Strategy function do?

The function sets a number of strategy properties.

  1. What information does the Volume variable contain?

The current bar volume. Previous values may be accessed with square brackets operator [], e.g. volume[1], volume[2].

1 Like
  1. It returns a series of values.
  2. The user can edit inputs on the format object dialog of the script study.
  3. It applies our strategy to a data set.
  4. The total ammount transacted at a specific period.
1 Like

1.- What does the language operator [] do?

It’s used to save variables between bars.

2.- What does the input function do?

It makes it possible to modify selected values which the script can then use in its calculations.

3,- What does the strategy function do?

Through the strategy function we can send, modify and cancel buy/sell orders. Also allow us to do backtesting and forward testing according to the algorithm designed.

4.- What information does volume variable contain?

Buy/sell volume for a determinate bar.

1 Like
  1. Provides access to previous values.
  2. Adds an input to your script indicator.
  3. The function sets a number of strategy properties.
  4. Current bar volume.
1 Like
  • What does the language operator [] do? (Hint: It’s not for regular arrays)
    It provides access to previous values
  • What does the input function do? (Hint: Try it in Tradingview)
    Adds an input to your script indicator.
  • What does the Strategy function do?
    This function sets up a number of different strategy properties.
  • What information does the Volume variable contain?
    Current bar volume
1 Like
  1. Series subscript. Provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical. Floats will be rounded down.
  2. Adds an input to your script indicator. User can see and edit inputs on the Format Object dialog of the script study. Script inputs look and behave exactly the same as inputs of built-in Technical Analysis indicators.
    3 The function sets a number of strategy properties.
  3. Current Bar Volume.
1 Like
What does the language operator [] do? (Hint: It’s not for regular arrays)
  • It gives an access to the previous values of a particular variable. The number in the bracket indicates the sequence of the previous variable one reffers to.

    What does the input function do? (Hint: Try it in Tradingview)

  • Allows to add an input to the script code. Also, the inputs can be seen on the Format Object dialog.
    What does the Strategy function do?
    The Strategy functions sets a number of strategy properties.

    What information does the Volume variable contain?
    The volume variable contains volume of a bar and can access previous values using the square brackets operator.

1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    Series subscript. Provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical. Floats will be rounded down.

  2. What does the input function do? (Hint: Try it in TradingView)
    Adds an input to your script indicator. User can see and edit inputs on the Format Object dialog of the script study. Script inputs look and behave exactly the same as inputs of built-in Technical Analysis indicators.

  3. What does the Strategy function do?
    The function sets a number of strategy properties.

  4. What information does the Volume variable contain?
    Current bar volume. Open, high, low, close, high, hl2, hlc3, ohlc4.

1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)

a) References previous values in a series.

  1. What does the input function do? (Hint: Try it in Tradingview)

a) Allows interaction between script and executer without modifying the script (code) directly.

  1. What does the Strategy function do?

a) Defines the parameters of a strategy.

  1. What information does the Volume variable contain?

a) The amount of trades, current bar, for the security selected in the defined time period (min, hr, day, wk, mnth)

1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    Series subscript. Provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical.
  2. What does the input function do? (Hint: Try it in Tradingview)
    Adds an input to your script indicator. User can see and edit inputs on the Format Object dialog of the script study. Script inputs look and behave exactly the same as inputs of built-in Technical Analysis indicators.
    3. What does the Strategy function do?
    The function sets a number of strategy properties.
    4. What information does the Volume variable contain?
    Current bar volume or previous bars volumes.
1 Like
  1. [] provides access to previous series of securities.
    2.Input adds an input to a script indicator.
  2. The function sets a number of strategy properties.
    4.Amount of the instrument traded on given time period.
1 Like
  1. Language operators are constructs defined within programming languages which behave generally like functions. They can include addition, subtraction, division etc. The language operator can define or add new meaning.

  2. The input function input( ) allow us to quickly alter script values by manually changing an input option (like the RSI overbought level). That way we can change the values used in the script without having to edit its source code.

  3. In Pine Script, the strategy.entry() function is a command to open a long or short trade (TradingView, n.d.). This function is quite flexible. It can open new positions, scale into an existing position, and reverse a position in the other direction.

  4. Volume Profile takes the total volume traded at a specific price level during the specified time period and divides the total volume into either buy volume or sell volume and then makes that information easily visible to the trader.

1 Like

1. What does the language operator [] do?
Provides access to previous values (bars).

2. What does the input function do?
Adds an input to the script indicator.

3. What does the Strategy function do?
It’s a function that sets a number of properties. For example, you can open or close a position, edit the name of the strategy etc.)

4. What information does the Volume variable contain?
The current bar volume.

1 Like

1. What does the language operator [] do?
The [] is a numerical operator that lets you go back and access values from previous candles. You define the number of bars / candle sticks on the chart you want to access data from or refer to by adding a number inside the bracket, e.g. [0] refers to current day candle; [1] refers to yesterday’s or previous candle; [2] refers to the day before last; etc.

2. What does the input function do?
Data Input: It adds an input to the script indicator, e.g. technical analysis indicators to your program. It also allows you to change values in your script.

3. What does the Strategy function do?
The strategy function allows you to define specific parameters and properties of your trading setup, such as conditions for market entry/exit/close, order or cancel, stop loss or taking profit, etc. so that the program can execute code in the trading environment. You can also simulate trades using this function, based on your trading algorithm.

4 most common functions for entering/exiting a market position:
strategy.close
It is a command to exit from the entry with the specified ID. If there were multiple entry orders with the same ID, all of them are exited at once. If there are no open entries with the specified ID by the moment the command is triggered, the command will not come into effect. The command uses market
strategy.entry
It is a command to enter market position. If an order with the same ID is already pending, it is possible to modify the order. If there is no order with the specified ID, a new order is placed. Every entry is closed by a separate market order.
strategy.exit
It is a command to exit either a specific entry, or whole market position. If an order with the same ID is already pending, it is possible to modify the order. If an entry order was not filled, but an exit order is generated, the exit order will wait till entry order is filled and then the exit order is placed.
strategy.order
It is a command to place order. If an order with the same ID is already pending, it is possible to modify the order. If there is no order with the specified ID, a new order is placed.

4. What information does the Volume variable contain?
It feeds your program with data on the current bar’s (buy/sell) volume level, or how much of an asset was traded during a given period. Not only current value of trade volume bars, but also previous bars/values can be accessed by indexing using square brackets operator: volume [1], volume [2], etc.

1 Like
  1. [] can be used to “save” variable value between bars

  2. The input function looks and behaves exactly like built-in inputs of any Technical analysis indicators.

  3. It sets a number of strategy properties. “title” “scale” “open” “close”

  4. The current bar volume.

1 Like