PINE LIBRARY

SnowdexUtils

Library "SnowdexUtils"
the various function that often use when create a strategy trading.

f_backtesting_date(train_start_date, train_end_date, test_date, deploy_date)
  Backtesting within a specific window based on deployment and testing dates.
  Parameters:
    train_start_date (int): the start date for training the strategy.
    train_end_date (int): the end date for training the strategy.
    test_date (bool): if true, backtests within the period from `train_end_date` to the current time.
    deploy_date (bool): if true, the strategy backtests up to the current time.
  Returns: given time falls within the specified window for backtesting.

f_init_ma(ma_type, source, length)
  Initializes a moving average based on the specified type.
  Parameters:
    ma_type (simple string): the type of moving average (e.g., "RMA", "EMA", "SMA", "WMA").
    source (float): the input series for the moving average calculation.
    length (simple int): the length of the moving average window.
  Returns: the calculated moving average value.

f_init_tp(side, entry_price, rr, sl_open_position)
  Calculates the target profit based on entry price, risk-reward ratio, and stop loss. The formula is `tp = entry price + (rr * (entry price - stop loss))`.
  Parameters:
    side (bool): the trading side (true for long, false for short).
    entry_price (float): the entry price of the position.
    rr (float): the risk-reward ratio.
    sl_open_position (float): the stop loss price for the open position.
  Returns: the calculated target profit value.

f_round_up(number, decimals)
  Rounds up a number to a specified number of decimals.
  Parameters:
    number (float)
    decimals (int)
  Returns: The rounded-up number.

f_get_pip_size()
  Calculates the pip size for the current instrument.
  Returns: Pip size adjusted for Forex instruments or 1 for others.

f_table_get_position(value)
  Maps a string to a table position constant.
  Parameters:
    value (string): String representing the desired position (e.g., "Top Right").
  Returns: The corresponding position constant or `na` for invalid values.
strategiestechindicator

파인 라이브러리

진정한 TradingView 정신에 따라, 저자는 이 파인 코드를 다른 파인 프로그래머들이 재사용할 수 있도록 오픈 소스 라이브러리로 공개했습니다. 저자에게 박수를 보냅니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈 소스 출판물에서 사용할 수 있지만, 이 코드를 출판물에서 재사용하는 것은 하우스 룰에 의해 관리됩니다.

면책사항