Firetron’s XTR

1 926 Views No Comments 3 years ago
  • Finds the average, maximum, median, or minimum true range or percent true range.
    Supports specifying a fraction of the range to use.
    Supports any period there is price data for, not capped at 200.
    Supports true percent range.

    Custom Command Dependencies:
    Firetron’s FractionGrab
    Firetron’s Median

    Test code:

    if not Load('done', false) then
    
      local period      = -1
      local interval    = 10
      local fullCandles = true
      local market      = PriceMarket()
      local hlcStyle    = false
    
      local medianHighPercent = CC_XTR('median', period, interval, fullCandles, market, hlcStyle, 8, 8, true)
    
      Log(' ')
      Log(medianHighPercent..' ('..Round(medianHighPercent * 100, 2)..'%)')
      Log('Median High True Percent Range:')
      Log(' ')
    
      local medianHigh = CC_XTR('median', period, interval, fullCandles, market, hlcStyle, 8, 8, false)
    
      Log(medianHigh)
      Log('Median High True Range:')
      Log(' ')
    
      local minimum = CC_XTR('minimum', period, interval, fullCandles, market, hlcStyle, 1, 1, false)
    
      Log(minimum)
      Log('Minimum True Range:')
      Log(' ')
    
      local median = CC_XTR('median', period, interval, fullCandles, market, hlcStyle, 1, 1, false)
    
      Log(median)
      Log('Median True Range:')
      Log(' ')
    
      local maximumPercent = CC_XTR('maximum', period, interval, fullCandles, market, hlcStyle, 1, 1, true)
    
      Log(maximumPercent..' ('..Round(maximumPercent * 100, 2)..'%)')
      Log('Maximum True Percent Range:')
      Log(' ')
    
      local maximum = CC_XTR('maximum', period, interval, fullCandles, market, hlcStyle, 1, 1, false)
    
      Log(maximum)
      Log('Maximum True Range:')
      Log(' ')
    
      local average = CC_XTR('average', period, interval, fullCandles, market, hlcStyle, 1, 1, false)
    
      Log(average)
      Log('Average True Range:')
      Log(' ')
    
      Save('done', true)
    
    end
    HaasScript Code
    Sign in or Register to download for free
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free