| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | Tradestation Code Help psudocode: if Hulls moves above 13 ema then if i am short then cover print string "cover" where i covered go long one contract print string "long" where i went long if hulls moves below 13 ema then if i am long then sell print "Closed" sell short one contract print "short" where i went short ---------- CODE ----------------------- inputs: Price( Close ), Hulls( 8 ), EMA( 13 ), Displace( 0 ), upColour(Blue), downColour(Red); variables: HullsAvg( 0 ), EMAvg( 0 ), MP( 1 ); HullsAvg = jtHMA( Price, Hulls ) ; EMAvg = AverageFC( Price, EMA ) ; MP = MarketPosition ; if HullsAvg crosses over EMAvg then begin if MP = -1 then begin Buy To Cover("Cover") this bar; end; Buy ( "Long" )this bar; end; if HullsAvg crosses under EMAvg then begin if MP = 1 then begin Sell ("Close") this bar; end; sellshort( "Short" ) this bar; end; | ||
| |
|
| | #2 | ||
![]() | Re: Tradestation Code Help eg. if HullsAvg crosses over EMAvg then begin Buy ( "Long" )this bar; end; if HullsAvg crosses under EMAvg then begin sellshort( "Short" ) this bar; end; if MP = -1 and HullsAvg crosses over EMAvg then Buy To Cover("Cover") this bar; if MP = 1 and HullsAvg crosses under EMAvg then Sell ("Close") this bar | ||
| |
|
| | #3 | ||
![]() | Re: Tradestation Code Help | ||
| |
|
| | #4 | ||
![]() | Re: Tradestation Code Help TS first sells any open positions that you and then enters a buy order and vice versa. so you do not need to explicitly define those orders | ||
| |
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TradeStation Strategy Code Help | jjthetrader | Coding Forum | 2 | 10-26-2010 09:06 AM |
| Quick TS Code Help Please | ephi144 | Coding Forum | 1 | 11-10-2008 02:15 PM |
| Help To Code My EA | pepe1 | Coding Forum | 0 | 06-24-2008 02:41 PM |
| Code for Trade Station | Shai | Beginners Forum | 2 | 04-02-2008 10:05 AM |
| Does Anyone have the TTM Scalper Code for Esignal??? | jphillips9 | Beginners Forum | 5 | 01-14-2008 08:26 PM |