0

I’m testing a PineScript strategy based on a simple EMA crossing on a Renko chart.

One problem I’ve come across is simply that, if in any given timeframe, multiple Renko bricks are printed that cause my EMA crossover to trigger, it will say my entry occurred at the crossover price (or the Renko brick nearest to it). However we know that in reality, the entry is actually whatever price really was at the close of the timeframe.

For example: I have a Renko bar the size of 5 on a timeframe of 15m, at from 10:00 to 10:15, price goes from 400 to 430 creating 5 (or 6) new Renko bricks. At price 415 my EMA crossover is triggered, and at 10:15 it will show my long entry being taken at 415. However since all of the new bricks print exactly at 10:15, the actual long entry is at 430, since that’s where price actually was at 10:15.

To alleviate this discrepancy, I simply want my entry to wait for the open of the timeframe immediately following the timeframe my strategy was triggered on. Hope that makes sense!

// Determine the long and short signals longSignal = crossover(fast_ema, slow_ema) shortSignal = crossunder(fast_ema, slow_ema)`

// Place orders based on the signals if (longSignal) strategy.entry("Buy", strategy.long) if (shortSignal) strategy.entry("Sell", strategy.short)

Thanks in advance everyone!

0 Answers0