Reading Assignment: Pinescript

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

It provides access to previous values of series.

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

Adds an input to the script indicator

  1. What does the Strategy function do?

It sets the number of strategy properties --> strategy.XXXXX

  1. What information does the Volume variable contain?

Is the traded amount in a certain period of time

1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    It considers the nth previous candle so [1] would consider not the current candlestick but the previous one.

  2. What does the input function do? (Hint: Try it in Tradingview)
    Adds an input to the Inputs tab of your script’s Settings, which allows you to provide configuration options to script users. You can define a default inout value, but change it from the cog, settings menu.

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

  4. What information does the Volume variable contain?
    Volume of the candle stick as a float. Previous candles can be accessed by volume[1], volume[2] etc

2 Likes
  1. What does the language operator [] do?

Provide access to previous candle value. For example [1] means immediate candle value.

  1. What does the input function do?

Adds an input to your script indicator. User can see and edit inputs on the Format Object dialog of the script study.

  1. What does the Strategy function do?

Strategy function helps setting up different strategy properties.

  1. What information does the Volume variable contain?

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

1 Like

:one: The [] operator provides access to prior data, based on the value inside of the brackets, e.g. [2] would retrieve the data from periods (candles) back.
The preceding value to the [] operator is the value of series.

So for example, if the script were to say:
series[5], we would be looking at the data from 5 periods ago in the series data set.

:two: The input function adds an input to a script indicator.
This allows you to edit the variable inputs of the script indicator to modify it as you wish.

For example, if you wanted a 50-period Moving average, you could use an input function to change MA from 20 to 50 periods.
e.g. ma = input(title="50ma", type=integer, defval="DELL")

:three: The strategy function allows you to quantify when to enter and exit a position, based on a selection of conditions.

The strategy function also allows for you to define the parameters of the trade, such as going long/short, quantity, limit, stop-loss and when.

:four: The volume variable contains the current (and all historical if you signify [n]) volume quantity. This volume variable can be used in algorithms to determine conditions to enter and close positions.

1 Like

1-What does the language operator [] do? (Hint: It’s not for regular arrays)
Provides access to previous values. In this case could be information from previous candles, and it starts from present to back

2-What does the input function do? (Hint: Try it in Tradingview)
Adds an input to the script indicator.

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

4-What information does the Volume variable contain?
Contains the volume trade of the current bar.

1 Like
  1. It gives a value of previous series.

  2. It adds an input to your script indicator.

  3. It will apply your strategy on the given inputs.

  4. The amount being traded.

1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    It provides values of previous bars/series.
  2. What does the input function do? (Hint: Try it in Tradingview)
    It adds an input to the script indicator.
  3. What does the Strategy function do?
    Sets the strategy properties.
  4. What information does the Volume variable contain?
    The current volume of the trading bar.
1 Like

1)It allows to consult the previous values of variables. e.g. open[1], open[2].
2)Adds an input to your script indicator.
3)The function sets a number of strategy properties.
4)The current bar of volume.

1 Like
  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    Answer: perform different logical and mathematical functions.
  2. What does the input function do? (Hint: Try it in Tradingview)
    It adds script to an indicator. Most useful to pass parameters programmatically, while the code is running. For example, increase the no. of periods on an sma when the code executes
  3. What does the Strategy function do?
    Sets the values of different parameters of the strategy object; i.e. the name of the strategy, commission type, commission value, etc.
  4. What information does the Volume variable contain?
    direction (green is up or red is down), amount of asset bring traded (in no of shares, bonds, tokens, etc.), moving average. The settings are usually inputs, style, and visibility
2 Likes
  1. Provides access to previous values.
  2. Adds an input to the script editor.
  3. Sets a number of strategy properties.
  4. The current bar volume.
1 Like

1:) when a number is inserted between the brackets it tells the program which candle to start with. IE
[0] would be the first candle of the series [1] would be the next one/

2:) adds an input to the script indicators

3:) The strategy function is used to set up strategy properties

4:) The current bar volume

1 Like

1. What does the language operator [] do? (Hint: It’s not for regular arrays)
An easy way to think about the [] language operator, is an array that goes backwards instead of forwards (NOTE: pine script calls it a “series subscript” and not an array). Since we’re looking at chart data, the current position (the bar) on the chart is from the current time; there’s no going forward in time that doesn’t exist yet. So we start at an array position of [0]; to go back 1 bar in the time series the position changes to [1], back 2 bars is [2], and so on.
Docs source

2. What does the input function do? (Hint: Try it in Tradingview)
The input function allows you to add customizable options (which can be found in the chart cog settings) to the chart output. Inputs are set with default settings, where the user can alter them if desired (in the aforementioned chart settings).
(NOTE: the pine script reference here gives inaccurate definitions/examples on how to use inputs. See the user manual here for the updated way.)

3. What does the Strategy function do?
The strategy function is used for setting strategy properties for the current script. Properties that can be set are title, overlay, precision, scale, pyramiding, calculating order fills, calculating on every tick, max bars back, and more…
Docs source

4. What information does the Volume variable contain?
The volume variable contains the current bars volume in the series.
Docs source

1 Like

1. What does the language operator [] do? (Hint: It’s not for regular arrays)
The [] operator lets you access previous values of a variable. The number inside [] indicates how far back to go to get the value.

2. What does the input function do? (Hint: Try it in Tradingview)
The input function adds properties/values to an object.

3. What does the Strategy function do?
The Strategy Function allows you to set a number of properties for your strategy.

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

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.
4.Current bar 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.
  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. Examples can be: strategy(title, shorttitle, overlay and precision).
  4. What information does the Volume variable contain?
    the volume of the current bar.
1 Like

Hi everyone,

  1. It enables access to the previous values of a serie. For example for a daily time frame [1] will give you the value of the previous day, [2] 2 days ago, etc…if I understood correctly.
  2. It adds an input to a script indicator.
  3. It sets a number of strategy properties.
  4. The volume associated with the current bar. You can have past values using [] as well.
1 Like
  1. [ ] operator can be used to refer historical values. Historical values are variable values for the previous bars.

  2. The [input] function makes possible for script users to modify selected values from the script that can then use in its calculation or logic, without the need to modify the script’s code.

  3. A strategy is a Pine script that can send, modify and cancel buy/sell orders . Strategies allow you to perform backtesting and forwardtesting according to your algorithms.

  4. The volume Variable contains the current bar volume of trades.

1 Like
  1. What does the language operator [] do?
    It asks for the previous values or bars back.
  2. What does the input function do?
    Input adds input to the input tab of script setting.
  3. What does strategy function do?
    Adds parameters such as opening and closing a trade.
  4. What information does the volume variable contain?
    Current bar volume.
1 Like

1.It provides access to a value in the past of a given series. For instance ETH [3] is the value of 3 candels in the past.
2. It adds an input to our script
3.It sets up different strategy properties
4. It contains volume of the current bar

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

[] is used to reference numbers from previous candles

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

Adds an input to the script indicator.

  1. What does the Strategy function do?

Used to set the properties of a trading strategy

  1. What information does the Volume variable contain?

The volume bar, i.e. the volume being traded

1 Like