title: How to convert variables from version 2 to version 4 of pinescript?
body: <p>I have a pinescript written in Version #2. I am trying to convert it to version #4.
  In version #2, I have something like below. What I am doing is declaring two variables persistent_bull, &amp; persistent_bear.</p>
  
  <p>After some work done in the script, I initialize this variable with values.
  I check if a bull has been printed. If a bull has been printed, I turn the variable persistent_bear=0 and persistent_bull=0. I do the viceversa for bear.</p>
  
  <p>When it comes to printing the signs, I check &amp; show.</p>
  
  <p>I am having trouble converting this to version 4. Is there anyone that can convert this properly for me please?</p>
  
  <pre><code>persistent_bull = nz(persistent_bull[1],0) 
  persistent_bear  = nz(persistent_bear[1],0) 
  
  
  bull = ....certain condition ....
  bear =  ....certain condition ....
  
  if bull  
      persistent_bull := 1 
      persistent_bear := 0
  
  if bear 
      persistent_bull := 0
      persistent_bear := 1
  
  plotshape( bull and (persistent_bull[1] != 1 or bear), style=shape.labelup, location=location.belowbar, color=colorBuy, text="Buy", textcolor=#000000, transp=0)
  plotshape( bear and (persistent_bear[1] != 1 or bull), style=shape.labeldown, color=colorSell, text="Sell", location=location.abovebar, textcolor =#ffffff, transp=0)
  </code></pre>