Strategy example
Breakout Strategy v2
Readonly source from tests/EasyLanguage/dorian-draper-learning, generated Pine Script v6, and an expiry-free example EX5.
Original EasyLanguage
{-------------------------------------------------------------------Breakout v2Description:- Improve legibility and semantic intention of Breakout v1- Prepare code for future extensions (filters, risk management, post-analysis)-------------------------------------------------------------------}Inputs:LongPrice(High),LongLen(8),ShortPrice(Low),ShortLen(8),EntryBuffer(.02);Vars:LongBreakout(0),ShortBreakout(0);{🧮 Cálculo de niveles de ruptura}LongBreakout = Highest(LongPrice, LongLen) + EntryBuffer;ShortBreakout = Lowest(ShortPrice, ShortLen) - EntryBuffer;{🚀 Setup de entrada}Buy ("Brk LE") Next Bar at LongBreakout Stop;SellShort ("Brk SE") Next Bar at ShortBreakout Stop;
Generated Pine Script v6
//@version=6strategy("Breakout_v2", overlay=true)longprice = input.source(high, "longprice")longlen = input.float(8.0, "longlen")shortprice = input.source(low, "shortprice")shortlen = input.float(8.0, "shortlen")entrybuffer = input.float(.02, "entrybuffer")var float longbreakout = 0var float shortbreakout = 0__el_call1 = ta.highest(longprice, int(longlen))__el_call2 = ta.lowest(shortprice, int(shortlen))if bar_index >= 7longbreakout := __el_call1 + entrybuffershortbreakout := __el_call2 - entrybufferstrategy.entry("Brk LE", strategy.long, stop=longbreakout)strategy.entry("Brk SE", strategy.short, stop=shortbreakout)
Compiled MetaTrader 5 example
The EX5 uses the original script filename stem and has no PineAnywhere expiration guard.