title: plotshape doesn't plot on correct candlestick
body: <p>I have written an indicator in pinescript and it doesn't work as expected. The idea is to make it plot a shape at a bar when price crosses over a moving average on the lower timeframe but only if price has crossed the same period moving average on a higher timeframe. A better explanation on what I try to achieve: let's say price is above the 5-period-SMA from 1h timeframe, and while it is above, at some point price will cross above the 5-period-SMA on 15m timeframe, and right then it should plot a shape on that bar on 15m timeframe. Who can help me? Here is the code:</p>
  <pre><code>study(&quot;MA Cross MTF Alert&quot;, shorttitle=&quot;MA Cross MTF Alert&quot;, overlay=true)
  
  smaPeriod = input(5, title=&quot;Period SMA&quot;)
  pricetype = input(close, title=&quot;Price Source For The SMA&quot;)
  lowerTfRes = input(title=&quot;Lower timeframe&quot;, type=resolution, defval=&quot;15&quot;)
  higherTfRes = input(title=&quot;Higher timeframe&quot;, type=resolution, defval=&quot;60&quot;)
  
  priceLowTf = security(tickerid, lowerTfRes, pricetype)
  priceHighTf = security(tickerid, higherTfRes, pricetype)
  
  smaLowTf = sma(priceLowTf, smaPeriod)
  smaHighTf = sma(priceHighTf, smaPeriod)
  
  Buy =  close &gt; smaLowTf and close &gt; smaHighTf
  Sell = close &lt; smaLowTf and close &lt; smaHighTf
  plotshape(Buy, style=shape.circle, location=location.abovebar, color=green)
  plotshape(Sell, style=shape.circle, location=location.belowbar, color=red)
  alertcondition(Buy, title=&quot;Buy alert&quot;, message=&quot;Buy &quot; + syminfo.root + &quot;MA Cross alert&quot;)
  alertcondition(Sell, title=&quot;Sell alert&quot;, message=&quot;Sell &quot; + syminfo.root + &quot;MA Cross alert&quot;)
  </code></pre>
  <p>Thank you</p>