Reading Assignment: Pinescript

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

Provides access to previous values of a series. ex. open[7] will query the opening price 7 instances prior

  1. What does the input function do? (Hint: Try it in Tradingview)
    The input function opens a “properties/settings” window for any given “object” (plot,chart etcetera)
    the window allows you to turn on/off object or customize its properties, symbol, resolution, etc…

  2. What does the Strategy function do?

it allows you to define specific parameters/logic for the programmed trading strategy (when to pyramid, max # of candles referenced ect)

  1. What information does the Volume variable contain?

The amount exchanging hands of a particular instrument at a particular time

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
reference to a previous value, a number of previous bars
[5] 5 bars back

2
adds input to the script

3
is for setting/defining your strategy properties

4
the current bar volume, can also refer back to a previous bar of course with []

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

open[1] shows the previous bar on the left. open[2] shows the bar left to open[1]. Must be numerical and is a way to reference historical price bars.

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

It allows the user to input numbers into the parameters from a menu.

  1. What does the Strategy function do?

It reveals the parameters for the strategy so that the system can execute the code with our input.

  1. What information does the Volume variable contain?

It exposes the current bar volume, can access and reveal previous bar volume with [].

1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)acess the previous values of a series
  2. What does the input function do? (Hint: Try it in Tradingview)
    allow user to see and edit inputs on format object dialog
  3. What does the Strategy function do?
    sets up different strategy properties
  4. What information does the Volume variable contain?
    current bar volume
1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    the language operator “[ ]”, is an operator that allows you to go back and use previous values of series, depending on the number inbetween the operator, depends on how far back you go.

  2. What does the input function do? (Hint: Try it in Tradingview)
    the input function lets you add technical analysis indicators to your script indicator.

  3. What does the Strategy function do?
    the strategy function is so you can set a number of strategy properties to your script.

  4. What information does the Volume variable contain?
    volume variable, gives current bar volume, you can also look at previous bars using the “[ ]” operator.

1 Like

1. What does the language operator [] do?
Allows you to accesses previous values.
2. What does the input function do?
Adds an input to your script indicator. User can see and edit input.
3. What does the Strategy function do?
Sets a number of strategy properties.
4. What information does the Volume variable contain?
It contains the current bar volume.

  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    The [] operator is used to get Values from previous days.

  2. What does the input function do? (Hint: Try it in Tradingview)
    The input function is used to add an input to a script. You can view/edit variables.

  3. What does the Strategy function do?
    Used to choose/set the properties of a trading strategy.

  4. What information does the Volume variable contain?
    The volume variable contains information on the current or previous bar(s)

1 It lets you use values from previous candles.
2 The input function adds settings/properties to an object, such as a plot/chart, where you can have an input to toggle it on/off, or to set a given symbol or the time resolution, etc…
3 The function sets a number of strategy properties.
4 Current bar volume.

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

It is a numerical operator and it defines how many bars we go back.

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?

It shows the current bar volume.

  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    it defines how many candles we move back from the last one

  2. What does the input function do? (Hint: Try it in Tradingview)
    it adds a variable to the script

  3. What does the Strategy function do?
    it enables to enter conditions for entering and exiting the market

  4. What information does the Volume variable contain?
    it contains the market volume of the current candle

  1. The [] symbols allow you to access the data from previous candles in the loop.

  2. The input function allows you to change values in your script at run-time.

  3. The strategy function allows you to simulate trades based on your trading algorithm. It can be used to backtest your strategy.

  4. Volume tells you how much of an asset was traded during that bar.

1, Its a subscript that provides access to previous data values for example, comparing current open candle data to earlier candles.
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 such as cancel, close, entry, exit, order etc.
4, Current bar volume.

  1. [] is series subscript. It provides access to previous values of some series. Lets say we have series a, with a[1] we get previous value in series.
  2. Input function adds an input to our script indicator.
  3. Function sets different strategy properties.
  4. It contains current bar volume. Previous values can be accessed with volume[1].
  1. [] provides access to to previous values of series.
  2. It adds an input to the script indicator.
  3. It sets a number of strategy properties.
  4. It indicates the current bar volume
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    series subscript gets the number back that is in the box. e.g. series[2] would go 2 increments back in the series where 0 is our value we start at
  2. What does the input function do? (Hint: Try it in Tradingview)
    provides an interface to edit hte variable value in the script
  3. What does the Strategy function do?
    strategy emulates entering or exiting positions for back testing.
  4. What information does the Volume variable contain?
    volume variable has buy/sell volume for the current bar

Complete

1. What does the language operator [] do? (Hint: It’s not for regular arrays)
The [] operator is also called the history reference operator. It is possible to refer to the historical values of any variable of the series type with the [] operator. Historical values are variable values for the previous bars.
Almost all built-in functions in Pine’s standard library return a series result. It is therefore possible to apply the [] operator directly to function calls, as is done here:
sma(close, 10)[1]
Despite the fact that the [] operator returns a result of series type, it is prohibited to apply this operator to the same operand over and over again.
In some situations, the user may want to shift the series to the left. Negative arguments for the operator [] are prohibited. This can be accomplished using the offset parameter in the plot annotation, which supports both positive and negative values.
There is another important consideration to keep in mind when using the [] operator in Pine. We have seen cases when a history reference may return the na value. na represents a value which is not a number and using it in any math expression will produce a result that is also na (similar to [NaN] in JavaScript).

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?
This function sets a number of strategy properties. Below the most common functions for entering or exiting a market position are listed.

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. order. 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?

The Volume variable has the format float and its value describes the volume of the current bar.
Previous values may be accessed with square brackets operator [], e.g. volume[1], volume[2].

3 Likes
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    Allows you to recheck past performance data of price action.
  2. What does the input function do? (Hint: Try it in Tradingview)
    Allows input of data
  3. What does the Strategy function do?
    Your programming trading from open to close
  4. What information does the Volume variable contain?
    Current Bar Volume
  1. the nunbers in [] indicates how many previous bar of a series the value is referred

2.Adds an input to your script indicator

3.sets a number of strategy properties.

4.Current bar volume