Pine script for Intraday backtesting Previous Day high and Previous Day Low Breakout strategy
In this article, I will try to explain the backtesting of range breakout strategy using Pine Script. Intraday range breakout strategy is a well known concept among trading community. We will test previous day range breakout, as soon as underlying script crosses previous day high we will initate buy and opposite conditions for sell (if script goes below previous day low, we will sell it). We will keep fixed stop loss which is configurable. // © ObserveNifty //@version=4 strategy("Previous Day High and Low Breakout Strategy", overlay=true, calc_on_every_tick=true) D_High = security(syminfo.tickerid, 'D', high[1]) D_Low = security(syminfo.tickerid, 'D', low[1]) D_Close = security(syminfo.tickerid, 'D', close[1]) D_Open = security(syminfo.tickerid, 'D', open[1]) // Go Long - if prev day high is broken // Go Short - if prev day low is broken plot(timeframe.isintraday ? D_High : na, title="Daily High", style=plot.style_line, color=...