Strategy example
Breakout Strategy v1
Readonly source from tests/EasyLanguage/dorian-draper-learning, generated Pine Script v6, and an expiry-free example EX5.
Original EasyLanguage
{-------------------------------------------------------------------Breakout v1Description:- Breakout strategy based on the highest high and lowest low of the last 8 bars- Uses stop orders to enter the market on breakouts-------------------------------------------------------------------}Input:TrlgBars(8);Vars:BuyPx(0),SellPx(0);BuyPx = Highest(High, TrlgBars) + .02;SellPx = Lowest(Low, TrlgBars) - .02;{Setup entrada}Buy ("BrkLE") Next Bar at BuyPx Stop;SellShort ("BrkSE") Next Bar at SellPx Stop;
Generated Pine Script v6
//@version=6strategy("Breakout_v1", overlay=true)trlgbars = input.float(8.0, "trlgbars")var float buypx = 0var float sellpx = 0__el_call1 = ta.highest(high, int(trlgbars))__el_call2 = ta.lowest(low, int(trlgbars))if bar_index >= 7buypx := __el_call1 + .02sellpx := __el_call2 - .02strategy.entry("BrkLE", strategy.long, stop=buypx)strategy.entry("BrkSE", strategy.short, stop=sellpx)
Compiled MetaTrader 5 example
The EX5 uses the original script filename stem and has no PineAnywhere expiration guard.