Migration from TradeStation

Migration from TradeStation

Concept mapping

TradeStation / EasyLanguageAlgolang
Strategy (file)Package (directory with .go file)
InputsStrategy struct fields with algolang: tags
VariablesStrategy struct fields (any Go type)
Buy / SellShortrs.Buy() / rs.SellShort()
Sell / BuyToCoverrs.ExitLong() / rs.ExitShort()
MarketPositionrs.MarketPosition()
Close / Close[1]rs.Close(0).Value() / rs.Close(0).Value(1)
Close of Data2rs.Close(1).Value()
Average(Close, 20)rs.Close(0).Average(20).Value()
Highest(High, 20)rs.High(0).Highest(20).Value()
CurrentBarrs.BarNumber(0)
Date / Timers.Time(0)
SetStopLossrs.SetStopLoss(dollars)
SetProfitTargetrs.SetProfitTarget(dollars)

Key differences

  1. Zero-based indexing: Algolang data series are indexed from 0 (primary), not 1 (Data1).
  2. Lookback syntax: Use Value(1) instead of [1] for previous bar values.
  3. Explicit position size: Pass quantity to Buy() or set --position-size.
  4. No implicit exits: TradeStation reverses positions automatically; in Algolang, you must explicitly exit before entering the opposite direction (unless allowing both long and short simultaneously).
  5. Error handling: Strategy functions return error. Handle errors explicitly rather than relying on silent failures.
  6. Type safety: Go’s type system prevents many common EasyLanguage mistakes at compile time.
  7. No 32-bit limits: Arbitrary data structures, large datasets, and multi-threaded execution.
  8. Timezone awareness: Algolang handles timezones and DST automatically. No manual time offset calculations needed.

EasyLanguage parser limitations

TradeStation’s EasyLanguage parser has numerous limitations that Algolang does not share:

  • Named orders must be string literals – string expressions like Buy ("PyramidLong" + NumToStr(pyramidCount, 0)) ... are not supported
  • Cannot use DataN where N is a variable
  • Cannot query how many data series have been provided to the strategy
  • No custom optimisation metrics
  • Variable back-references are arbitrarily limited (numerous TradeStation functions have hard-coded limits to avoid this)
  • Can back-refer scalars but not arrays
  • Orders cannot be placed inside loops
  • Portfolio support is extremely limited
  • Complex data structures are non-existent (and, no, OOEL does not fix this)
  • No fill callbacks or linked orders – there is no way to place exit orders in response to an entry fill, forcing a one-bar delay between entry and exit

All of these limitations are absent in Algolang, where the full power of Go is available.