PINE LIBRARY

UtilityFunctions

已更新
Library "UtilityFunctions"
Utility functions written by me

printLabelOnLastBar_string(string)
  Prints string in a label on the last bar
  Parameters:
    string: value to print
  Returns: void

printLabelOnLastBar_float(float)
  Prints float in a label on the last bar
  Parameters:
    float: value to print
  Returns: void

printSeriesInReverseOnLabels(series)
  Prints a float series in labels in reverse (the first value is on the last candle, the second value is on the second to last candle, etc.)
  Parameters:
    series: float values to print
  Returns: void

isPeriodDailyBased(string)
  Returns true/false if the period is Daily based (1D, 3D, ...)
  Parameters:
    string: timeframe period
  Returns: true/false

get_multiplier(string)
  Gets the mutliplier of the timeframe passed compared to the current timeframe. If current TF is 5m and the passed timeframe period is 30m, the result will be 6
  Parameters:
    string: timeframe param
  Returns: simple float of the multiplier
發行說明
v2

Added:
printLabelOnEveryBar(the)
  Prints a float series - the value of the series for the particular candle
  Parameters:
    the: float series to print
  Returns: void
發行說明
v3

Added:
printLabelOnSpecificBar_string(string)
  Prints a string on a specific bar
  Parameters:
    string: text to be printed and series int bar index
  Returns: void
發行說明
v4

Added:
print_1_value_on_60_level_string()

print_1_value_on_60_level_float()

print_2_values_on_60_level_string()

print_2_values_on_60_level_float()

print_3_values_on_60_level_string()

print_3_values_on_60_level_float()

print_4_values_on_60_level_string()

print_4_values_on_60_level_float()
發行說明
v5 - added exported functions for the first time; will probably store more here, in order for them to be on only one place and to be able to apply them on many places more easily
發行說明
v6

Added:
func_strong_bullish_alignment_by_bar_index()
  returns if at a specific index, the array value on it is above ema1, above ema2, above ema3
  Returns: if at a specific index, the array value on it is above ema1, above ema2, above ema3

func_strong_bearish_alignment_by_bar_index()
  returns if at a specific index, the array value on it is below ema1, below ema2, below ema3
  Returns: if at a specific index, the array value on it is below ema1, below ema2, below ema3

func_turn_series_to_array()

func_get_bull_and_bear_cross_indexes(arr)
  returns if source has strong bull/bear alignment compared to its emas and the bull/bear cross index if there is such - so if the emas are 20,45 and 200, if price is above 20 and 45 and these two emas are bullishly crossed, but
they are below 200, the index will be -1
  Parameters:
    arr: - the array of values (could be close values of candles, could be asset vs market (index) values), which basically contains the source; source is e.g. price close, or index; the emas are of the source

func_generate_price_data()
發行說明
v7

Added:
func_generate_relative_strength_data()

func_cross_of_source_and_200_ema()
  creates an array with the source values you pass as a parametr; starts counting from the most recent element (the element now) and continues backwards and checks if the source had
bullishly or bearishly crossed the ema200 parameter that was passed; also writes in the table myTable some values
  Returns: bool- if the last index of crossing the source with the ema200 was a bull cross or not
發行說明
v8

Added:
printLabelOnEveryBar_at_80_level(the)
  Prints a float series - the value of the series for the particular candle
  Parameters:
    the: float series to print
  Returns: void

printLabelOnEveryBar_at_40_level(the)
  Prints a float series - the value of the series for the particular candle
  Parameters:
    the: float series to print
  Returns: void

printLabelOnEveryBar_at_0_level(the)
  Prints a float series - the value of the series for the particular candle
  Parameters:
    the: float series to print
  Returns: void

Removed:
printLabelOnEveryBar(the)
  Prints a float series - the value of the series for the particular candle
發行說明
v9

Added:
printLabelOnEveryBar_at_80_level_string(the)
  Prints a float series - the value of the series for the particular candle
  Parameters:
    the: float series to print
  Returns: void

printLabelOnEveryBar_at_40_level_string(the)
  Prints a float series - the value of the series for the particular candle
  Parameters:
    the: float series to print
  Returns: void

printLabelOnEveryBar_at_0_level_string(the)
  Prints a float series - the value of the series for the particular candle
  Parameters:
    the: float series to print
  Returns: void
發行說明
v10

Added:
print_on_specific_x_at_specific_y_level_float()

print_on_specific_x_at_specific_y_level_string()
發行說明
v11

Added:
print_on_specific_bar_index_on_candle_high_string()

print_on_specific_bar_index_on_candle_high_float()
發行說明
v12

Added:
print_on_current_bar_index_on_candle_high_string()

print_on_current_bar_index_on_candle_high_float()

print_on_current_bar_index_on_candle_low_string()

print_on_current_bar_index_on_candle_low_float()

Removed:
print_on_specific_bar_index_on_candle_high_string()

print_on_specific_bar_index_on_candle_high_float()
發行說明
v13

Added:
f_oscillator_resets(p_close, p_oscillator, p_should_draw_oscillator_pivot_vertical_arrows, p_should_draw_oscillator_pivots_connecting_lines, p_should_activate_log_mom_reading_bull, p_should_activate_hidden_div_bull, p_should_activate_regular_div_bull, p_should_activate_regular_bull_div_only_above_x_ema, p_above_x_ema_length, p_oscillator_reset_level_bull, p_should_activate_log_mom_reading_bear, p_should_activate_hidden_div_bear, p_should_activate_regular_div_bear, p_should_activate_regular_bear_div_only_below_x_ema, p_below_x_ema_length, p_oscillator_reset_level_bear)
  Parameters:
    p_close
    p_oscillator
    p_should_draw_oscillator_pivot_vertical_arrows
    p_should_draw_oscillator_pivots_connecting_lines
    p_should_activate_log_mom_reading_bull
    p_should_activate_hidden_div_bull
    p_should_activate_regular_div_bull
    p_should_activate_regular_bull_div_only_above_x_ema
    p_above_x_ema_length
    p_oscillator_reset_level_bull
    p_should_activate_log_mom_reading_bear
    p_should_activate_hidden_div_bear
    p_should_activate_regular_div_bear
    p_should_activate_regular_bear_div_only_below_x_ema
    p_below_x_ema_length
    p_oscillator_reset_level_bear

print_2_values_with_their_keys_on_current_bar_index_on_candle_high_string(key1, val1, key2, val2)
  Parameters:
    key1
    val1
    key2
    val2

print_2_values_with_their_keys_on_current_bar_index_on_candle_low_string(key1, val1, key2, val2)
  Parameters:
    key1
    val1
    key2
    val2
發行說明
v14

Added:
f_oscillator_resets_without_drawings(p_close, p_oscillator, p_should_activate_log_mom_reading_bull, p_should_activate_hidden_div_bull, p_should_activate_regular_div_bull, p_should_activate_regular_bull_div_only_above_x_ema, p_above_x_ema_length, p_oscillator_reset_level_bull, p_should_activate_log_mom_reading_bear, p_should_activate_hidden_div_bear, p_should_activate_regular_div_bear, p_should_activate_regular_bear_div_only_below_x_ema, p_below_x_ema_length, p_oscillator_reset_level_bear)
  Parameters:
    p_close
    p_oscillator
    p_should_activate_log_mom_reading_bull
    p_should_activate_hidden_div_bull
    p_should_activate_regular_div_bull
    p_should_activate_regular_bull_div_only_above_x_ema
    p_above_x_ema_length
    p_oscillator_reset_level_bull
    p_should_activate_log_mom_reading_bear
    p_should_activate_hidden_div_bear
    p_should_activate_regular_div_bear
    p_should_activate_regular_bear_div_only_below_x_ema
    p_below_x_ema_length
    p_oscillator_reset_level_bear
發行說明
v15

Added:
f_oscillator_resets_with_drawings(p_close, p_oscillator, p_should_draw_oscillator_pivot_vertical_arrows, p_should_draw_oscillator_pivots_connecting_lines, p_should_activate_log_mom_reading_bull, p_should_activate_hidden_div_bull, p_should_activate_regular_div_bull, p_should_activate_regular_bull_div_only_above_x_ema, p_above_x_ema_length, p_oscillator_reset_level_bull, p_should_activate_log_mom_reading_bear, p_should_activate_hidden_div_bear, p_should_activate_regular_div_bear, p_should_activate_regular_bear_div_only_below_x_ema, p_below_x_ema_length, p_oscillator_reset_level_bear)
  Parameters:
    p_close
    p_oscillator
    p_should_draw_oscillator_pivot_vertical_arrows
    p_should_draw_oscillator_pivots_connecting_lines
    p_should_activate_log_mom_reading_bull
    p_should_activate_hidden_div_bull
    p_should_activate_regular_div_bull
    p_should_activate_regular_bull_div_only_above_x_ema
    p_above_x_ema_length
    p_oscillator_reset_level_bull
    p_should_activate_log_mom_reading_bear
    p_should_activate_hidden_div_bear
    p_should_activate_regular_div_bear
    p_should_activate_regular_bear_div_only_below_x_ema
    p_below_x_ema_length
    p_oscillator_reset_level_bear

Removed:
f_oscillator_resets(p_close, p_oscillator, p_should_draw_oscillator_pivot_vertical_arrows, p_should_draw_oscillator_pivots_connecting_lines, p_should_activate_log_mom_reading_bull, p_should_activate_hidden_div_bull, p_should_activate_regular_div_bull, p_should_activate_regular_bull_div_only_above_x_ema, p_above_x_ema_length, p_oscillator_reset_level_bull, p_should_activate_log_mom_reading_bear, p_should_activate_hidden_div_bear, p_should_activate_regular_div_bear, p_should_activate_regular_bear_div_only_below_x_ema, p_below_x_ema_length, p_oscillator_reset_level_bear)
發行說明
v16
發行說明
v17

Added:
f_is_bull_candle(p_open, p_close, i)
  Parameters:
    p_open
    p_close
    i

f_is_bear_candle(p_open, p_close, i)
  Parameters:
    p_open
    p_close
    i
發行說明
v18
發行說明
v19

Added:
empty()

Removed:
func_green_red_combo_new(p_price_ema1, p_price_ema2, p_fsr_ema1, p_fsr_ema2, p_fsr)

f_oscillator_resets_without_drawings(p_close, p_oscillator, p_should_activate_log_mom_reading_bull, p_should_activate_hidden_div_bull, p_should_activate_regular_div_bull, p_should_activate_regular_bull_div_only_above_x_ema, p_above_x_ema_length, p_oscillator_reset_level_bull, p_should_activate_log_mom_reading_bear, p_should_activate_hidden_div_bear, p_should_activate_regular_div_bear, p_should_activate_regular_bear_div_only_below_x_ema, p_below_x_ema_length, p_oscillator_reset_level_bear)

f_oscillator_resets_with_drawings(p_close, p_oscillator, p_should_draw_oscillator_pivot_vertical_arrows, p_should_draw_oscillator_pivots_connecting_lines, p_should_activate_log_mom_reading_bull, p_should_activate_hidden_div_bull, p_should_activate_regular_div_bull, p_should_activate_regular_bull_div_only_above_x_ema, p_above_x_ema_length, p_oscillator_reset_level_bull, p_should_activate_log_mom_reading_bear, p_should_activate_hidden_div_bear, p_should_activate_regular_div_bear, p_should_activate_regular_bear_div_only_below_x_ema, p_below_x_ema_length, p_oscillator_reset_level_bear)

func_strong_bullish_alignment_by_bar_index(arr, ema1, ema2, ema3, i)
  returns if at a specific index, the array value on it is above ema1, above ema2, above ema3

func_strong_bearish_alignment_by_bar_index(arr, ema1, ema2, ema3, i)
  returns if at a specific index, the array value on it is below ema1, below ema2, below ema3

func_turn_series_to_array(source)

func_get_bull_and_bear_cross_indexes(arr, source, ema1, ema2, ema3)
  returns if source has strong bull/bear alignment compared to its emas and the bull/bear cross index if there is such - so if the emas are 20,45 and 200, if price is above 20 and 45 and these two emas are bullishly crossed, but
they are below 200, the index will be -1

func_generate_relative_strength_data(securityOfSymbolToCompare, securityOfComparedToSymbol)

func_cross_of_source_and_200_ema(source, ema200)
  creates an array with the source values you pass as a parametr; starts counting from the most recent element (the element now) and continues backwards and checks if the source had
bullishly or bearishly crossed the ema200 parameter that was passed; also writes in the table myTable some values

func_generate_price_data(source)

print_2_values_with_their_keys_on_current_bar_index_on_candle_high_string(key1, val1, key2, val2)

print_2_values_with_their_keys_on_current_bar_index_on_candle_low_string(key1, val1, key2, val2)

print_on_current_bar_index_on_candle_high_string(txt)

print_on_current_bar_index_on_candle_high_float(txt)

print_on_current_bar_index_on_candle_low_string(txt)

print_on_current_bar_index_on_candle_low_float(txt)

print_on_specific_x_at_specific_y_level_float(x, y, txt)

print_on_specific_x_at_specific_y_level_string(x, y, txt)

printLabelOnLastBar_string(txt)
  Prints string in a label on the last bar

printLabelOnLastBar_float(txt)
  Prints float in a label on the last bar

printLabelOnEveryBar_at_80_level(float_series)
  Prints a float series - the value of the series for the particular candle

printLabelOnEveryBar_at_40_level(float_series)
  Prints a float series - the value of the series for the particular candle

printLabelOnEveryBar_at_0_level(float_series)
  Prints a float series - the value of the series for the particular candle

printLabelOnEveryBar_at_80_level_string(string_series)
  Prints a float series - the value of the series for the particular candle

printLabelOnEveryBar_at_40_level_string(string_series)
  Prints a float series - the value of the series for the particular candle

printLabelOnEveryBar_at_0_level_string(string_series)
  Prints a float series - the value of the series for the particular candle

printSeriesInReverseOnLabels(func_series)
  Prints a float series in labels in reverse (the first value is on the last candle, the second value is on the second to last candle, etc.)

printLabelOnSpecificBar_string(txt, func_bar_index)
  Prints a string on a specific bar

isPeriodDailyBased(tf_period)
  Returns true/false if the period is Daily based (1D, 3D, ...)

get_multiplier(func_timeframe)
  Gets the mutliplier of the timeframe passed compared to the current timeframe. If current TF is 5m and the passed timeframe period is 30m, the result will be 6

print_1_value_on_60_level_string(txt)

print_1_value_on_60_level_float(txt)

print_2_values_on_60_level_string(txt1, txt2)

print_2_values_on_60_level_float(txt1, txt2)

print_3_values_on_60_level_string(txt1, txt2, txt3)

print_3_values_on_60_level_float(txt1, txt2, txt3)

print_4_values_on_60_level_string(txt1, txt2, txt3, txt4)

print_4_values_on_60_level_float(txt1, txt2, txt3, txt4)

f_is_bull_candle(p_open, p_close, i)

f_is_bear_candle(p_open, p_close, i)

f_condition_was_met_was_less_than_x_hours_ago(p_condition, p_hours_ago)

f_condition_was_met_was_less_than_x_hours_ago_and_is_currently_true(p_condition, p_hours_ago)

f_condition_was_met_was_more_than_x_hours_ago(p_condition, p_hours_ago)

f_condition_was_met_was_more_than_x_hours_ago_and_is_currently_true(p_condition, p_hours_ago)
debuggingdisplayMATHpinescriptutility

Pine腳本庫

在真正的TradingView精神中,作者將這段Pine程式碼發佈為開源程式庫,以便我們社群的其他Pine程式設計師可以重複使用它。請向作者致敬!您可以私下使用這個函式庫,或在其他開源出版品中使用,但在出版物中再次使用這段程式碼將受到網站規則的約束。

免責聲明