title: Pine Script Strategy - How to trigger entry when *price* (not close) crosses a certain value? Currently entering trade one candle too late
body: <p>Just playing around, learning how to write strategies. The one I'm trying right now is (pseudo-code)...</p>
  <pre><code>if(previousCandle == red 
     ... AND previousCandle.high &gt;= sma
     ... AND previousCandle.low &lt;= sma 
     ... AND currentPrice &gt; previousCandle.high)
      
      enter trade
  </code></pre>
  <p>What I have in Pine Script is...</p>
  <pre><code>redTouch = close &lt; open and high &gt;= ma and low &lt;= ma
  
  longCond = redTouch[1] and close &gt; high[1]
  
  strategy.entry(&quot;Long&quot;, strategy.long, when = longCond)
  </code></pre>
  <p>The <code>redTouch</code> candles are all identified correctly (checked previously using BG colors), but for the <code>longCond</code> I don't want <code>close &gt; high[1]</code>, because that enters the trade only on the next candle (and too late).</p>
  <p>The following screenshot shows where the trade is currently being entered (blue line on red candle), and where I'd like it to trigger/enter (yellow line on green candle).</p>
  <p><a href="https://i.stack.imgur.com/qrn9u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qrn9u.png" alt="Late and desired trades" /></a></p>
  <p>How do I change <code>close &gt; high[1]</code> to <code>price &gt; high[1]</code> or a similar intra-candle crossover trigger? Or can you only enter trades in the <em>next</em> candle in Pine Script?</p>