toodegrees

forex_factory_utility

toodegrees Atualizado   
Library "forex_factory_utility"
Supporting Utility Library for the Live Economic Calendar by toodegrees Indicator; responsible for data handling, and plotting news event data.

isLeapYear()
  Finds if it's currently a leap year or not.
  Returns: Returns True if the current year is a leap year.

daysMonth(M)
  Provides the days in a given month of the year, adjusted during leap years.
  Parameters:
    M (int): Month in numerical integer format (i.e. Jan=1).
  Returns: Days in the provided month.

size(S, N)
  Converts a size string into the corresponding Pine Script v5 format, or N times smaller/bigger.
  Parameters:
    S (string): Size string: "Tiny", "Small", "Normal", "Large", or "Huge".
    N (int): Size variation, can be positive (larger than S), or negative (smaller than S).
  Returns: Size string in Pine Script v5 format.

lineStyle(S)
  Converts a line style string into the corresponding Pine Script v5 format.
  Parameters:
    S (string): Line style string: "Dashed", "Dotted" or "Solid".
  Returns: Line style string in Pine Script v5 format.

lineTrnsp(S)
  Converts a transparency style string into the corresponding integer value.
  Parameters:
    S (string): Line style string: "Light", "Medium" or "Heavy".
  Returns: Transparency integer.

boxLoc(X, Y)
  Converts position strings of X and Y into a table position in Pine Script v5 format.
  Parameters:
    X (string): X-axis string: "Left", "Center", or "Right".
    Y (string): Y-axis string: "Top", "Middle", or "Bottom".
  Returns: Table location string in Pine Script v5 format.

method bubbleSort_NewsTOD(N)
  Performs bubble sort on a Forex Factory News array of all news from the same date, ordering them in ascending order based on the time of the day.
  Namespace types: News
  Parameters:
    N (News): Forex Factory News array.
  Returns: void

bubbleSort_News(N)
  Performs bubble sort on a Forex Factory News array, ordering them in ascending order based on the time of the day, and date.
  Parameters:
    N (News): Forex Factory News array.
  Returns: Sorted Forex Factory News array.

weekNews(N, C, I)
  Creates a Forex Factory News array containing the current week's Forex Factory News.
  Parameters:
    N (News): Forex Factory News array containing this week's unfiltered Forex Factory News.
    C (string): Currency filter array (string array).
    I (color): Impact filter array (color array).
  Returns: Forex Factory News array containing the current week's Forex Factory News.

todayNews(W, D, M)
  Creates a Forex Factory News array containing the current day's Forex Factory News.
  Parameters:
    W (News): Forex Factory News array containing this week's Forex Factory News.
    D (News): Forex Factory News array for the current day's Forex Factory News.
    M (bool): Boolean that marks whether the current chart has a Day candle-switch at Midnight New York Time.
  Returns: Forex Factory News array containing the current day's Forex Factory News.

impFilter(X, L, M, H)
  Creates a filter array from the User's desired Forex Facory News to be shown based on Impact.
  Parameters:
    X (bool): Boolean - if True Holidays listed on Forex Factory will be shown.
    L (bool): Boolean - if True Low Impact listed on Forex Factory News will be shown.
    M (bool): Boolean - if True Medium Impact listed on Forex Factory News will be shown.
    H (bool): Boolean - if True High Impact listed on Forex Factory News will be shown.
  Returns: Color array with the colors corresponding to the Forex Factory News to be shown.

curFilter(A, C1, C2, C3, C4, C5, C6, C7, C8, C9)
  Creates a filter array from the User's desired Forex Facory News to be shown based on Currency.
  Parameters:
    A (bool): Boolean - if True News related to the current Chart's symbol listed on Forex Factory will be shown.
    C1 (bool): Boolean - if True News related to the Australian Dollar listed on Forex Factory will be shown.
    C2 (bool): Boolean - if True News related to the Canadian Dollar listed on Forex Factory will be shown.
    C3 (bool): Boolean - if True News related to the Swiss Franc listed on Forex Factory will be shown.
    C4 (bool): Boolean - if True News related to the Chinese Yuan listed on Forex Factory will be shown.
    C5 (bool): Boolean - if True News related to the Euro listed on Forex Factory will be shown.
    C6 (bool): Boolean - if True News related to the British Pound listed on Forex Factory will be shown.
    C7 (bool): Boolean - if True News related to the Japanese Yen listed on Forex Factory will be shown.
    C8 (bool): Boolean - if True News related to the New Zealand Dollar listed on Forex Factory will be shown.
    C9 (bool): Boolean - if True News related to the US Dollar listed on Forex Factory will be shown.
  Returns: String array with the currencies corresponding to the Forex Factory News to be shown.

FF_OnChartLine(N, T, S)
  Plots vertical lines where a Forex Factory News event will occur, or has already occurred.
  Parameters:
    N (News): News-type array containing all the Forex Factory News.
    T (int): Transparency integer value (0-100) for the lines.
    S (string): Line style in Pine Script v5 format.
  Returns: void

method updateStringMatrix(M, P, V)
  Namespace types: matrix<string>
  Parameters:
    M (matrix<string>)
    P (int)
    V (string)

FF_OnChartLabel(N, Y, S)
  Plots labels where a Forex Factory News has already occurred based on its/their impact.
  Parameters:
    N (News): News-type array containing all the Forex Factory News.
    Y (string): String that gives direction on where to plot the label (options= "Above", "Below", "Auto").
    S (string): Label size in Pine Script v5 format.
  Returns: void

historical(T, D, W, X)
  Deletes Forex Factory News drawings which are ourside a specific Time window.
  Parameters:
    T (int): Number of days input used for Forex Factory News drawings' history.
    D (bool): Boolean that when true will only display Forex Factory News drawings of the current day.
    W (bool): Boolean that when true will only display Forex Factory News drawings of the current week.
    X (string): String that gives direction on what lines to plot based on Time (options= "Past", "Future", "Both").
  Returns: void

newTable(P)
  Creates a new Table object with parameters tailored to the Forex Factory News Table.
  Parameters:
    P (string): Position string for the Table, in Pine Script v5 format.
  Returns: Empty Forex Factory News Table.

resetTable(P, S, headTextC, headBgC)
  Resets a Table object with parameters and headers tailored to the Forex Factory News Table.
  Parameters:
    P (string): Position string for the Table, in Pine Script v5 format.
    S (string): Size string for the Table's text, in Pine Script v5 format.
    headTextC (color)
    headBgC (color)
  Returns: Empty Forex Factory News Table.

logNews(N, TBL, R, S, rowTextC, rowBgC)
  Adds an event to the Forex Factory News Table.
  Parameters:
    N (News): News-type object.
    TBL (table): Forex Factory News Table object to add the News to.
    R (int): Row to add the event to in the Forex Factory News Table.
    S (string): Size string for the event's text, in Pine Script v5 format.
    rowTextC (color)
    rowBgC (color)
  Returns: void

FF_Table(N, P, S, headTextC, headBgC, rowTextC, rowBgC)
  Creates the Forex Factory News Table.
  Parameters:
    N (News): News-type array containing all the Forex Factory News.
    P (string): Position string for the Table, in Pine Script v5 format.
    S (string): Size string for the Table's text, in Pine Script v5 format.
    headTextC (color)
    headBgC (color)
    rowTextC (color)
    rowBgC (color)
  Returns: Forex Factory News Table.

timeline(N, T, F, D)
  Shades Forex Factory News events in the Forex Factory News Table after they occur.
  Parameters:
    N (News): News-type array containing all the Forex Factory News.
    T (table): Forex Facory News table object.
    F (color): Color used as shading once the Forex Factory News has occurred.
    D (bool): Daily Forex Factory News flag.
  Returns: Forex Factory News Table.

News
  Custom News type which contains informatino about a Forex Factory News Event.
  Fields:
    dow (series string): Day of the week, in DDD format (i.e. 'Mon').
    dat (series string): Date, in MMM D format (i.e. 'Jan 1').
    _t (series int)
    tod (series string): Time of the day, in hh:mm 24-Hour format (i.e 17:10).
    cur (series string): Currency, in CCC format (i.e. "USD").
    imp (series color): Impact, the respective impact color for Forex Factory News Events.
    ttl (series string): Title, encoded in a custom number mapping (see the toodegrees/toodegrees_forex_factory library to learn more).
    tmst (series int)
    ln (series line)
Notas de Lançamento:
v2

Updated:
FF_OnChartLabel(N, Y, S, O)
  Plots labels where a Forex Factory News has already occurred based on its/their impact.
  Parameters:
    N (News): News-type array containing all the Forex Factory News.
    Y (string): String that gives direction on where to plot the label (options= "Above", "Below", "Auto").
    S (string): Label size in Pine Script v5 format.
    O (bool)
  Returns: void
Notas de Lançamento:
v3
Notas de Lançamento:
v4

Added:
NewsAMPM_TOD(N)
  Reformats the Time of the Day in the Forex Factory News Table to AM/PM format.
  Parameters:
    N (News): Forex Factory News array.
  Returns: Reformatted Forex Factory News array

Updated:
method updateStringMatrix(M, P, V)
  Updates a string Matrix containing the tooltips for Forex Factory News Event information for a given candle.
  Namespace types: matrix
  Parameters:
    M (matrix): String matrix.
    P (int): Position (row) of the Matrix to update based on the impact.
    V (string): information to push to the Matrix.
  Returns: void

FF_OnChartLabel(N, Y, S, O)
  Plots labels where a Forex Factory News has already occurred based on its/their impact.
  Parameters:
    N (News): News-type array containing all the Forex Factory News.
    Y (string): String that gives direction on where to plot the label (options= "Above", "Below", "Auto").
    S (string): Label size in Pine Script v5 format.
    O (bool): Show outline of labels?
  Returns: void

historical(T, D, W, X)
  Deletes Forex Factory News drawings which are outside a specific Time window.
  Parameters:
    T (int): Number of days input used for Forex Factory News drawings' history.
    D (bool): Boolean that when true will only display Forex Factory News drawings of the current day.
    W (bool): Boolean that when true will only display Forex Factory News drawings of the current week.
    X (string): String that gives direction on what lines to plot based on Time (options= "Future", "Both").
  Returns: void
Notas de Lançamento:
v5

Added:
MMM(M)
  Converts a month from a numerical integer format to a MMM format (i.e. 'Jan').
  Parameters:
    M (int): Month in numerical integer format (i.e. Jan=1).
  Returns: Month in MMM format (i.e. 'Jan').

dow(D)
  Converts a numbered day of the week string in format to 'DDD' format (i.e. "1" = Sun).
  Parameters:
    D (string): Numbered day of the week from 1 to 7, starting on Sunday.
  Returns: Returns the day of the week in 'DDD' format (i.e. "Fri").

Updated:
NewsAMPM_TOD(N)
  Reformats the Time of the Day in the Forex Factory News Table to AM/PM format.
  Parameters:
    N (array): Forex Factory News array.
  Returns: Reformatted Forex Factory News array.

timeline(N, T, F, TZH, TZM, D)
  Shades Forex Factory News events in the Forex Factory News Table after they occur.
  Parameters:
    N (array): News-type array containing all the Forex Factory News.
    T (table): Forex Facory News table object.
    F (color): Color used as shading once the Forex Factory News has occurred.
    TZH (int): Custom Timezone hour, if any.
    TZM (int): Custom Timezone minute, if any.
    D (bool): Daily Forex Factory News flag.
  Returns: Forex Factory News Table.
Notas de Lançamento:
v6

Added:
adjustTimezone(N, TZH, TZM)
  Transposes the Time of the Day, and Date, in the Forex Factory News Table to a custom Timezone.
  Parameters:
    N (array): Forex Factory News array.
    TZH (int): Custom Timezone hour.
    TZM (int): Custom Timezone minute.
  Returns: Reformatted Forex Factory News array.
Notas de Lançamento:
v7
Notas de Lançamento:
v8
Notas de Lançamento:
v9
Notas de Lançamento:
v10
Notas de Lançamento:
v11
Notas de Lançamento:
v12
Notas de Lançamento:
v13
Notas de Lançamento:
v14

homo faber fortunæ suæ
Biblioteca do Pine

No verdadeiro espírito TradingView, o autor publicou este código de Pine como uma biblioteca de código aberto para que outros programadores de Pine de nossa comunidade possam reutilizá-lo. Um brinde ao autor! Você pode usar esta biblioteca em particular ou em outras publicações de código aberto, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Gostaria de usar essa biblioteca?

Copie a seguinte linha e cole-a em seu script.