lyubooo

UtilityFunctions

lyubooo Обновлено   
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)
Библиотека Pine

В истинном духе TradingView автор опубликовал этот код Pine как библиотеку с открытым исходным кодом, чтобы другие разработчики Pine из нашего сообщества могли использовать его повторно. Поблагодарим автора! Вы можете использовать эту библиотеку приватно или в других публикациях с открытым исходным кодом, но повторное использование этого кода в публикации регулируется Правилами поведения.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать эту библиотеку?

Скопируйте текст в буфер обмена и вставьте в свой скрипт.