title: How to convert variables from version 2 to version 3 4 5 of pinescript?
body: <p>I have a pinescript written in Version #2. I am trying to convert it to version #3~#5</p>
  <p>I am having trouble converting this to version 3~5. Is there anyone that can convert this properly for me please?</p>
  <pre><code>//@version=2
  strategy(&quot;signal1&quot;, overlay=true, initial_capital=100000, default_qty_value=50000, default_qty_type=strategy.cash, slippage=3, commission_type=strategy.commission.percent, commission_value=0.075, pyramiding=0)
  decay = atr(10)*0.005
  stage1 = 7
  stage2 = 15
  stage3 = 35
  p1 = input(5)
  p2 = p1 + input(2)
  p3 = input(0.01,step=0.001)
  
  // 1day
  
  Price=close
  
  PriceTop=low
  PriceBot=high
  
  pretopvector01 = nz(topvector01[1], PriceTop)
  topvector01 = PriceTop &gt;= pretopvector01 ? PriceTop : pretopvector01 - (decay * topvector01finalcounter[1])
  topvector01counter = n - valuewhen(PriceTop &gt;= topvector01, n, 0)
  topvector01finalcounter = topvector01counter &lt;= p1 ? stage1 : topvector01counter &lt;= p2 ? stage2 : stage3
  
  prebotvector01 = nz(botvector01[1], PriceBot)
  botvector01 = PriceBot &lt;= prebotvector01 ? PriceBot : prebotvector01 + (decay * botvector01finalcounter[1])
  botvector01counter = n - valuewhen(PriceBot &lt;= botvector01, n, 0)
  botvector01finalcounter = botvector01counter &lt;= p1 ? stage1 : botvector01counter &lt;= p2 ? stage2 : stage3
  
  half=(topvector01[1]*2+botvector01[1])/3
  col=half&gt;=close 
  sig=col ? topvector01 : botvector01
  
  berate(a,b) =&gt;
      ab=abs(1-a/b)
  
  br_min=berate(sig,half)
  
  comm_cond=br_min&lt;p3 or br_min&gt;br_min[1]
  long_cond=close&gt;sig and comm_cond
  short_cond=close&lt;sig and comm_cond
  
  if long_cond
      strategy.entry(&quot;Long&quot;,strategy.long)
  if short_cond
      strategy.entry(&quot;Short&quot;,strategy.short)
  
  bgcolor(strategy.position_size&gt;0 ? lime : red)
  </code></pre>