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.
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.