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)