TradeStation’s EasyLanguage is a powerful but sometimes challenging coding language. What if artificial intelligence could simplify the process of learning and writing code for indicators and systems?
Table of Contents
Use the links above to jump to the topic that interests you.
The EasyLanguage Challenge
TradeStation’s proprietary EasyLanguage has been around for over 25 years. When it first appeared, it was revolutionary, allowing retail traders to code their own indicators and trading systems without extensive programming knowledge. Since then, similar languages have emerged – MultiCharts’ variation, NinjaTrader’s NinjaScript, and TradingView’s PineScript – but EasyLanguage remains relevant and valuable.
The challenge? Despite its name, EasyLanguage still has a learning curve that can be intimidating for non-programmers. This is where AI might offer a solution.
Testing AI Models for EasyLanguage Coding
Over the past year, several AI models have been tested for their ability to generate functional EasyLanguage code:
- ChatGPT (OpenAI)
- Claude (Anthropic)
- Gemini (Google)
- Notebook LM (Google)
- Grok (Twitter/X)
Each model was evaluated both “out of the box” and with their deep research/thinking options. Some tests included uploading EasyLanguage documentation like reference guides and example code to improve results.
The common problem? Most models generated hybrid code – a mixture of EasyLanguage and Python or other languages – making the code difficult to implement without significant editing.
The Breakthrough: Claude 3.7 Sonnet
About a month ago, Claude 3.7 Sonnet arrived and changed the game. Without any specific EasyLanguage documentation or deep research mode, this model demonstrated an exceptional ability to generate functional EasyLanguage code.
While not perfect, Claude 3.7 Sonnet produces code that’s extremely close to working immediately and can even help troubleshoot verification errors when they occur.
Five Ways AI Can Help with EasyLanguage
- Explaining code line by line: AI excels at breaking down existing code into understandable chunks, explaining each step in progressively simpler terms until you grasp the concepts.
- Debugging, improving, or commenting code: AI can identify errors, suggest improvements, and add explanatory comments to make code more readable and shareable.
- Converting other code to EasyLanguage: Though less tested, AI shows promise in converting indicators from different languages like PineScript to EasyLanguage and vice versa.
- Customizing existing code: For ‘Better’ indicator subscribers with access to open the code, AI can help modify and customize the existing indicators without requiring deep programming knowledge.
- Generating fresh code for indicators or systems: Perhaps most impressive, AI can create new indicators based on conceptual descriptions.
A Real-World Example: Hourly Volume Indicator
To test Claude’s capabilities, we requested an indicator that would calculate the average volume traded for each hour of the trading day, from the first bar to the current one, displayed as a histogram.
Claude generated the initial code quickly, though it required a few iterations to perfect:
- First, the code needed to be modified to handle 24-hour markets
- A small array declaration error needed fixing
- The plotting method needed simplification
After approximately 20 minutes of back-and-forth refinement, the result was an elegant, functioning indicator that efficiently used arrays to calculate and display hourly volume averages. Here is the EasyLanguage code:
{*
Hourly Average Volume Indicator
Purpose: Calculates the average volume traded for each hour of the trading day.
Plots a single value for the current hour as a histogram.
Suitable for continuous instruments like crude futures that trade day and night sessions.
*}
{ Array declarations }
Array: hourlyTotalVolume[24](0), hourlyBarCount[24](0), hourlyAvgVolume[24](0);
[IntrabarOrderGeneration = false]
Variables:
hourIndex(0), { Index for current hour }
i(0), { Loop counter }
barTime(0), { Time of current bar }
barHour(0), { Hour of current bar }
currentBar(0); { Current bar number in calculation }
{ Increment the bar counter }
currentBar = currentBar + 1;
{ Get the time and hour of the current bar }
barTime = Time;
barHour = Floor(barTime / 100);
hourIndex = barHour; { Map hour (0-23) to array index }
{ Accumulate volume data for this hour }
hourlyTotalVolume[hourIndex] = hourlyTotalVolume[hourIndex] + Volume;
hourlyBarCount[hourIndex] = hourlyBarCount[hourIndex] + 1;
{ Calculate average volume for the current hour }
If hourlyBarCount[hourIndex] > 0 Then
hourlyAvgVolume[hourIndex] = hourlyTotalVolume[hourIndex] / hourlyBarCount[hourIndex]
Else
hourlyAvgVolume[hourIndex] = 0;
{ Plot only the current hour's average volume }
Plot1(hourlyAvgVolume[hourIndex], "Avg_Volume_Hour_" , Cyan);
Practical Applications
The finished indicator is shown above on the 15 largest futures markets. The indicator revealed interesting insights about trading volume patterns across these 15 different futures markets:
- E-mini futures: Most active during first 3 hours (8:30 AM – 11:30 AM Chicago time)
- Forex markets: More active during London trading hours, before US markets open
- Crude oil and Natural gas: Consistent activity throughout the trading day
- Bitcoin: Relatively level activity across all hours
A variation of this indicator calculates the average range (high to low) during each hour of trading. Combining the volume activity and price (or range) activity gives valuable information for traders in different time zones looking to focus on the most active markets during their trading hours. See: What Are the Best Markets to Trade?
Key Takeaways for Traders
AI assistance, particularly from Claude 3.7 Sonnet, has fundamentally changed the accessibility of EasyLanguage coding. Tasks that once required significant programming knowledge can now be accomplished through conversational requests and iterative refinement.
AI presents a powerful alternative that dramatically reduces the time and expertise required for traders looking to create custom indicators or systems. Whether explaining, debugging, converting, customizing, or generating EasyLanguage code from scratch, AI has NOW become an invaluable partner for TradeStation users looking to gain an edge in the markets.