Migration from TradeStation
Concept mapping
| TradeStation / EasyLanguage | Algolang |
|---|---|
| Strategy (file) | Package (directory with .go file) |
| Inputs | Strategy struct fields with algolang: tags |
| Variables | Strategy struct fields (any Go type) |
Buy / SellShort | rs.Buy() / rs.SellShort() |
Sell / BuyToCover | rs.ExitLong() / rs.ExitShort() |
MarketPosition | rs.MarketPosition() |
Close / Close[1] | rs.Close(0).Value() / rs.Close(0).Value(1) |
Close of Data2 | rs.Close(1).Value() |
Average(Close, 20) | rs.Close(0).Average(20).Value() |
Highest(High, 20) | rs.High(0).Highest(20).Value() |
CurrentBar | rs.BarNumber(0) |
Date / Time | rs.Time(0) |
SetStopLoss | rs.SetStopLoss(dollars) |
SetProfitTarget | rs.SetProfitTarget(dollars) |
Key differences
- Zero-based indexing: Algolang data series are indexed from 0 (primary), not 1 (Data1).
- Lookback syntax: Use
Value(1)instead of[1]for previous bar values. - Explicit position size: Pass quantity to
Buy()or set--position-size. - 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).
- Error handling: Strategy functions return
error. Handle errors explicitly rather than relying on silent failures. - Type safety: Go’s type system prevents many common EasyLanguage mistakes at compile time.
- No 32-bit limits: Arbitrary data structures, large datasets, and multi-threaded execution.
- 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
DataNwhere 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.