{------------------------------------------------------------------------------- Trading Strategy Code Population member: 45 Max bars back: 103 Created by: Adaptrade Builder version 4.2.0.0 Created: 9/2/2022 5:47:48 PM Scripting language: TradeStation 6 or newer Symbol: @ES#C 1 Day (Daily bars), Primary (Data1) (C:\Adaptrade\MarketData\@ES#C 1 Day.txt) Build dates: 9/4/2000 to 6/15/2020 Project file: C:\...\BreakoutStrats_nonsymmetric_no_stops.gpstrat -------------------------------------------------------------------------------} { Strategy inputs } Inputs: NL1 (88), { Indicator look-back length (bars), long trades } NS1 (49), { Indicator look-back length (bars), short trades } NS2 (53), { Indicator look-back length (bars), short trades } XS1 (57.0000), { Oscillator indicator value (0 to 100), short trades } NBarEntL3 (6), { Indicator look-back length (bars), long trades } EntFrL (1.5325), { Multiple of price difference (e.g., ATR); entry, long trades } NBarExL1 (11), { Number of bars from entry for market exit, long trades } EntPtsS (105.250000), { Number of points for stop price, short trades } NBarExS1 (8), { Number of bars from entry for market exit if profitable, short trades } NBarExS2 (48), { Number of bars from entry for market exit, short trades } NATRS (25), { Indicator look-back length (bars), short trades } MMFrS (1.9056), { Multiple of price difference (e.g., ATR); exit, short trades } PSParam (1.00), { Position sizing parameter value } RoundPS (true), { Round-to-nearest (true/false) } RoundTo (1), { Round-to position size value } MinSize (1), { Minimum allowable position size } SizeLimit (200); { Maximum allowable position size } { Variables for average true range for entry and exit orders } Var: ATRS (0); { Variables for entry and exit prices } Var: EntPrL (0), EntPrS (0), SStop (0); { Variables for entry and exit conditions } Var: VarL1 (0), VarL2 (0), VarL3 (0), VarS1 (0), VarS2 (0), EntCondL (false), EntCondS (false); { Variables for position sizing } Var: NShares (0); { Average true range } ATRS = AvgTrueRange(NATRS); { Entry prices } EntPrL = C + EntFrL * AbsValue(O - Average(L, NBarEntL3)); EntPrS = L - EntPtsS; { Entry and exit conditions } VarL1 = TrueRange; VarL2 = TrueRange; VarL3 = ZLTrend(VarL2, NL1); VarS1 = FastK(NS1); VarS2 = WAverage(VarS1, NS2); EntCondL = VarL1 < VarL3; EntCondS = XS1 crosses above VarS2; { Position sizing calculations } NShares = PSParam; If RoundPS and RoundTo > 0 then NShares = IntPortion(NShares/RoundTo) * RoundTo; NShares = MaxList(NShares, MinSize); NShares = MinList(NShares, SizeLimit); { Entry orders } If MarketPosition = 0 and EntCondL and C < EntPrL then begin Buy("EnStop-L") NShares shares next bar at EntPrL stop; end; If MarketPosition = 0 and EntCondS and C > EntPrS then begin Sell short("EnStop-S") NShares shares next bar at EntPrS stop; end; { Exit orders, long trades } If MarketPosition = 1 then begin If BarsSinceEntry >= NBarExL1 then Sell("ExMark-L") next bar at market; end; { Exit orders, short trades } If MarketPosition = -1 then begin If BarsSinceEntry = 0 then begin SStop = EntryPrice + MMFrS * ATRS; end; Buy to cover("ExStop-S") next bar at SStop stop; If BarsSinceEntry >= NBarExS2 or (BarsSinceEntry >= NBarExS1 and C < EntryPrice) then Buy to cover("ExMark-S") next bar at market; end;