admin管理员组

文章数量:1180551

I'm struggling to get high volume point zones in pinescript but stuck on releasing array at end. following my script on V5

  int lookback = input.int(50, title="Lookback Period", minval=1)
  float volumeThreshold = input.float(1.5, title="Volume Threshold (Multiplier of 
  Average Volume)", minval=1.0)
  int zoneWidth = input.int(5, title="Zone Width (in ticks)", minval=1)

  // Calculate average volume
  avgVolume = ta.sma(volume, lookback)

  // Identify significant volume levels
  significantVolume = volume > avgVolume * volumeThreshold

  // Store high and low of significant volume bars
  var float[] zoneHighs = array.new_float()
  var float[] zoneLows = array.new_float()

  if significantVolume
  array.push(zoneHighs, high)
  array.push(zoneLows, low)

  // Keep only the last 'lookback' zones
  if array.size(zoneHighs) > lookback
     array.remove(zoneHighs, 0)
     array.remove(zoneLows, 0)

  // Plot liquidity zones
  for i = 0 to array.size(zoneHighs) - 1
      zoneTop = str.tostring(array.get(zoneHighs, i))
      zoneBottom = str.tostring(array.get(zoneLows, i))
      ///ERROR getting here with ZONETOP & ZONEBOTTOM           
      box.new(bar_index - lookback, zoneTop, bar_index, zoneBottom, 
      border_color=color.new(color.blue, 0), bgcolor=color.new(color.blue, 90), 
      text="Liquidity Zone")

      // Highlight significant volume bars
      bgcolor(significantVolume ? color.new(color.orange, 90) : na, title="Significant 
      Volume")

Any question, feel free to ask, please leave if you don't understand

本文标签: