title: Code for checking the type of last crossover
body: <p>I want my code to check if the last happened event is either Pitop or Pibottom then give out a signal either called bullish or bearish depending on the last event happened.</p>
  <pre><code>    Pitop = crossover(MA111, MA350) ? security + (security/100 * 10) : na
      Pibottom = crossover(MA471, EMA150) ? security + (security/100 * 10) : na
    
      Bearish = crossover(MA111, EMA150) ? security + (security/100 * 10) : na and 
      Bullish = crossover(MA111, EMA150) ? security + (security/100 * 10) : na and 
      
      plotshape(Pitop, style=shape.labeldown,size=size.normal, text=&quot;Cycle Top&quot;, color=color.orange, textcolor=color.white, location=location.absolute)
      plotshape(Pibottom, style=shape.labeldown,size=size.normal, text=&quot;Cycle Bottom&quot;, color=color.red, textcolor=color.white, location=location.absolute)
      
      plotshape(Bearish,style=shape.labeldown,size=size.normal, text= &quot;Bearish&quot;, color=color.teal,textcolor=color.white, location=location.absolute)
      plotshape(Bullish,style=shape.labeldown,size=size.normal, text= &quot;Bullish&quot;, color=color.teal,textcolor=color.white, location=location.absolute)
  </code></pre>
  <p>If last happened event is Pitop i want an output that says A so i can put it at the end of my &quot;and&quot; statement, and vice-versa.</p>