Support Board
Date/Time: Wed, 15 Jan 2025 16:11:34 +0000
[Programming Help] - Help on compiling an automated trading system
View Count: 1068
[2017-06-23 02:29:02] |
User513952 - Posts: 84 |
Hi, Please refer to the following Tradestation autotrading code and convert it into Sierra Chart Automated trading script. Please provide the quotation and development duration. Requirements: (1) Set Trade size, K1 and K2 as variable (can be changed if needed) with 100, 0.5 and 0.5 as default value; (2) Can trade multiple timeframe bars (5-minute bar as default); (3) Can trade futures with 1 as default size; Remarks: Mday--Current bar, Nday-Next bar, HH-Highest price of current bar, HC-Close price of current bar, LL-lowest price of current bar ____________________________________________________________________ Inputs: K1(.5),K2(.5),Mday(1),Nday(1); Vars: BuyRange(0), SellRange(0); Vars: BuyTrig(0),SellTrig(0); Vars: HH(0),LL(0),HC(0),LC(0); If CurrentBar > 1 Then Begin HH = Highest(High,Mday); HC = Highest(Close,Mday); LL = Lowest(Low,Mday); LC = Lowest(Close,Mday); If (HH - LC) >= (HC - LL) Then Begin SellRange = HH - LC; End Else Begin SellRange = HC - LL; End; HH = Highest(High,Nday); HC = Highest(Close,Nday); LL = Lowest(Low,Nday); LC = Lowest(Close,Nday); If (HH - LC) >= (HC - LL) Then Begin BuyRange = HH - LC; End Else Begin BuyRange = HC - LL; End; BuyTrig = K1*BuyRange; SellTrig = K2*SellRange; If MarketPosition = 0 Then Begin Buy at next bar Open of next bar + BuyTrig Stop; Sell at next bar Open of next bar - SellTrig Stop; End; If MarketPosition = -1 Then Begin Buy at next bar Open of next bar + Buytrig Stop; End; If MarketPosition = 1 Then Begin Sell at next bar Open of next bar - SellTrig Stop; End; End; _____________________________________________________________________ ___________________________________________________________________ |
[2017-06-23 04:05:38] |
Sierra Chart Engineering - Posts: 104368 |
Contact Jim@SierraChart.com For a quotation. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: