{------------------------------------------------------------------------------- Trading Strategy Code Population member: 122 Max bars back: 50 Created by: Adaptrade Builder version 4.1.0.0 Created: 3/28/2022 11:03:12 PM Scripting language: TradeStation 6 or newer Symbol: @ES#C 1 Day (Daily bars), Primary (Data1) (C:\...\@ES#C 1 Day.txt) Build dates: 9/4/2000 to 8/10/2013 Project file: C:\...\TestStratClone_BuildFromParams.gpstrat -------------------------------------------------------------------------------} { Strategy inputs } Inputs: NBarEnL1 (51), { Indicator look-back length (bars), long trades } NBarExL1 (28), { Number of bars from entry for market exit if profitable, long trades } TargSzL (920.00), { Value of fixed size exit target per share/contract, long trades } NBarExL2 (72), { Number of bars from entry for market exit, long trades } NBarEnS1 (17), { Indicator look-back length (bars), short trades } NMMS1 (10), { Indicator look-back length (bars), short trades } NMMS2 (10), { Indicator look-back length (bars), short trades } MMFrS (0.9624), { Multiple of price difference (e.g., ATR); exit, short trades } TargPctS (4.667), { Value of percentage exit target, 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 (100); { Maximum allowable position size } { Variables for entry and exit prices } Var: EntPrL (0), EntPrS (0), TargPrL (0), TargPrS (0), SStop (0); { Variables for entry and exit conditions } Var: EntCondL (false), EntCondS (false); { Variables for position sizing } Var: NShares (0); { Entry prices } EntPrL = Highest(H, NBarEnL1); EntPrS = Lowest(L, NBarEnS1); { Entry and exit conditions } EntCondL = true; EntCondS = true; { 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 then begin Buy("EnStop-L") NShares shares next bar at EntPrL stop; end; If MarketPosition = 0 and EntCondS then begin Sell short("EnStop-S") NShares shares next bar at EntPrS stop; end; { Exit orders, long trades } If MarketPosition = 1 then begin TargPrL = EntryPrice + TargSzL/BigPointValue; Sell("ExTarg-L") next bar at TargPrL limit; If BarsSinceEntry >= NBarExL2 or (BarsSinceEntry >= NBarExL1 and C > EntryPrice) 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 * (Highest(H, NMMS1) - Lowest(L, NMMS2)); end; Buy to cover("ExStop-S") next bar at SStop stop; TargPrS = (1 - TargPctS/100.0) * EntryPrice; Buy to cover("ExTarg-S") next bar at TargPrS limit; end;