Reading Assignment: Pinescript

Reading Assignment: Pinescript

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

open[1], it’ returns the open price on the previous candle.

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

The input annotation function makes it possible for script users to modify selected values, which the script can use in its calculation or logic, without the need to modify the script’s code. As an example you can set the length of the moving average in the tradingview GUI to test out different values of the MA. Specific widgets are supplied in the Settings/Inputs dialog box for each type of input

3.What does the Strategy function do?

Strategies allow you to perform backtesting (emulation of a strategy trading on historical data) . So you can determinate if your idea working or not.

4.What information does the Volume variable contain?

The traded (buy/sell) numbers of contract a per candle.

1 Like

1. What does the language operator [] do? (Hint: It’s not for regular arrays)
Access previous values(number) of series expr1. expr2, it is the number of bars back and must be numerical.

2. What does the input function do? (Hint: Try it in Tradingview)
Adds input to your script indicator, in the format of a dialog with Bool, integer, float, string or series.

3. What does the Strategy function do?
Allows you to set up properties as entry, close, exit, order, risk and etc for trading strategies. also used for backtesting.

4. What information does the Volume variable contain?
Uses a float format and its value shows the current bar volume, previous volume values can be accessed using the square brackets operator [].

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

2Adds 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: Volume of current and previous bar

I’d like to start off by saying that these docs are less-than-stimulating, to put it nicely.

  1. The [] allow you to access previous values of a variable
  2. input() adds input to your script indicator
  3. The strategy function allows you to set properties in your strategy
  4. Volume retrieves the… volume. Previous values can be accessed with the [] operator.

Provides access to previous values of series of the numbers of bars back.

Adds an input to your script indicator e.g. bool, integer, etc.

Strategy function sets a number of strategy properties e.g. strategy.cancel , strategy.close etc.

Volume variable contains current bar volume.

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.

A few of the Strategy properties :

        * title
        * overlay
        * pyramiding
        * scale

4. What information does the Volume variable contain?

Current bar volume.

Answers:

  1. Functions and operators within commands are used for common tasks that include extracting a year from a date, combining two numeric values, or testing logical conditions.

2.Input function allow us to write a script exactly the way we wanted it to be executed.

  1. Strategy functions allow us to script out entry and close position base on n== x and if > high / low [x]

  2. Volume indicator have the number of shares traded in a stock or contracts traded in futures or options. Its based on how many contracts have changed hands and from there we can determine volume data.

1 Like

The language operator [] provides access to avalueor previous values in a series. For example it can be used to derive a particlar value from the numberedcandle enclosed within the brackets.
An input function adds an input to a script indicator. astrategy function allows the programmer to define the specific properties for actions taken within a trading strategy.
The volume variable contains the value of the volume of a candle specified within the language operator[]

  1. It is a OPEN operator, it lets you access previous candle states.

  2. Allows Input data on Script .

  3. Sets up a number of Different Strategy properties.

  4. The Volume measures today’s volume (current bar)

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

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

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

  4. What information does the Volume variable contain?
    It contains the volume of the current bar and can access previous volume bar values with the [].

  1. What does the language operator [] do? (Hint: It’s not for regular arrays)
    Gives you access to previous values of series expr1. expr2 is the numbers of bars back and must be numerical.
expr1[expr2]
  1. What does the input function do? (Hint: Try it in Tradingview)
    Input provides a UI to edit variable value using the script settings. It also allows you to set default, minimum and max allowed value.

  2. What does the Strategy function do?
    It lets you set a number of arguments for trading. It allows you to input logic into the series of data.

  3. What information does the Volume variable contain?
    It contains buy and sell volumes for the current bar.

  1. Allows you to access the previous element in the series.

  2. This adds inputs to the script

  3. Allows you to set certain parameters for your strategy script.

  4. Tells the current volume for that period.

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? The function sets a number of strategy properties.
  4. strategy(title, shorttitle, overlay, format, precision, scale, pyramiding, calc_on_order_fills, calc_on_every_tick, max_bars_back, backtest_fill_limits_assumption, default_qty_type, default_qty_value, initial_capital, currency, slippage, commission_type, commission_value, process_orders_on_close, close_entries_rule) → void
  5. What information does the Volume variable contain? Previous values may be accessed with square brackets operator [], e.g. volume[1], volume[2].

1)It provides access to previous value of series expr1. expr2 is the number of bars back , and must be numerical. Float will be rounded down.
2)it adds new input
3)The function sets a number of strategy properties.
4)It contains the current bar volume.

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

Series subscript. Provides access to previous values of series expr1. Expr2 is the number of bars back.

expr1[expr2]

  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. Script inputs look and behave exactly as inputs of built-in TA indicators.

  1. What does the Strategy function do?

Sets a number of strategy properties.

  1. What information does the Volume variable contain?

Current bar volume

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

  2. What does the input function do? (Hint: Try it in Tradingview)
    it is for inputting data into your script

  3. What does the Strategy function do?
    it sets paremeters for the strategy

  4. What information does the Volume variable contain?
    it contains the current value of trade volume bars and pevious bars using the square brackets

1.it accesses the the n:th bar before the current one in a series a := a[n]
2. The input function makes you mad
3. it lets you initiate different parts of your strategy, such as enter the market or close a position
4. It returns the trading volume of the current bar

1 Like

1. What does the language operator [] do? (Hint: It’s not for regular arrays)
This allows access to a previous reference. The reference could be a previous candle as in Fillip’s examples.

2. What does the input function do? (Hint: Try it in Tradingview)
This input function seems to get information from the given input. It is always assigned to a variable. Thus we end up getting a variable, which we can manipulate in the script, and it is the data from our input.

3. What does the Strategy function do?
This is a function which can be called to operate on and with strategy properties. (strategy._____)

4. What information does the Volume variable contain?
The volume variable is the data of the total amount (volume) traded. (This is for a given asset in a given time frame)

  1. [ ] is used to call back to previous data, the number in the [ ] indicates what candle is being called.
  2. Used to input data to edit and set parameters.
  3. Defines the strategy properties.
  4. The current bar volume.
  • What does the language operator [] do? (Hint: It’s not for regular arrays)
    [] = Series subscript. It gives one access to previous values of a particular series. The numerical number contained within [] is the number of bars back.

  • What does the input function do? (Hint: Try it in Tradingview)
    It adds an input to the script indicator.

  • What does the Strategy function do?
    It allows one to set a number of strategy properties.

  • What information does the Volume variable contain?
    It indicates the volume of trading that occurs during a specific time period.