PINE LIBRARY
업데이트됨

UTSStrategyHelper

655
Library "UTSStrategyHelper"
TODO: add library description here

stopLossPrice(sig, atr, factor, isLong)
  Calculates the stop loss price using a distance determined by ATR multiplied by a factor. Example for Long trade SL: PRICE - (ATR * factor).
  Parameters:
    sig (float)
    atr (float): (float): The value of the atr.
    factor (float)
    isLong (bool): (bool): The current trade direction.
  Returns: (bool): A boolean value.

takeProfitPrice(sig, atr, factor, isLong)
  Calculates the take profit price using a distance determined by ATR multiplied by a factor. Example for Long trade TP: PRICE + (ATR * factor). When take profit price is reached usually 50 % of the position is closed and the other 50 % get a trailing stop assigned.
  Parameters:
    sig (float)
    atr (float): (float): The value of the atr.
    factor (float)
    isLong (bool): (bool): The current trade direction.
  Returns: (bool): A boolean value.

trailingStopPrice(initialStopPrice, atr, factor, priceSource, isLong)
  Calculates a trailing stop price using a distance determined by ATR multiplied by a factor. It takes an initial price and follows the price closely if it changes in a favourable way.
  Parameters:
    initialStopPrice (float): (float): The initial stop price which, for consistency also should be ATR * factor behind price: e.g. Long trade: PRICE - (ATR * factor)
    atr (float): (float): The value of the atr. Ideally the ATR value at trade open is taken and used for subsequent calculations.
    factor (float)
    priceSource (float): (float): The current price.
    isLong (bool): (bool): The current trade direction.
  Returns: (bool): A boolean value.

hasGreaterPositionSize(positionSize)
  Determines if the strategy's position size has grown since the last bar.
  Parameters:
    positionSize (float): (float): The size of the position.
  Returns: (bool): A boolean value.

hasSmallerPositionSize(positionSize)
  Determines if the strategy's position size has decreased since the last bar.
  Parameters:
    positionSize (float): (float): The size of the position.
  Returns: (bool): A boolean value.

hasUnchangedPositionSize(positionSize)
  Determines if the strategy's position size has changed since the last bar.
  Parameters:
    positionSize (float): (float): The size of the position.
  Returns: (bool): A boolean value.

exporthasLongPosition(positionSize)
  Determines if the strategy has an open long position.
  Parameters:
    positionSize (float): (float): The size of the position.
  Returns: (bool): A boolean value.

hasShortPosition(positionSize)
  Determines if the strategy has an open short position.
  Parameters:
    positionSize (float): (float): The size of the position.
  Returns: (bool): A boolean value.

hasAnyPosition(positionSize)
  Determines if the strategy has any open position, regardless of short or long.
  Parameters:
    positionSize (float): (float): The size of the position.
  Returns: (bool): A boolean value.

hasSignal(value)
  Determines if the given argument contains a valid value (means not 'na').
  Parameters:
    value (float): (float): The actual value.
  Returns: (bool): A boolean value.
릴리즈 노트
v2

Added:
hasLongPosition(positionSize)
  Determines if the strategy has an open long position.
  Parameters:
    positionSize (float): (float): The size of the position.
  Returns: (bool): A boolean value.

Removed:
exporthasLongPosition(positionSize)
  Determines if the strategy has an open long position.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.