TradeStation EasyLanguage for Algorithmic Trading - Domenico D'Errico - E-Book

TradeStation EasyLanguage for Algorithmic Trading E-Book

Domenico D'Errico

0,0
28,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

With AI revolutionizing financial markets, every trader will soon get easy access to AI models through free Python libraries and datasets, with all of them making the same trades! This behavior will modify prices and trading volumes, potentially altering future datasets, leading to major corporations investing heavily in technology, big data, and expert teams.
However, individual traders need not be intimidated because this dynamic has been seen before whenever new technologies have entered the trading market. Written by a quantitative algorithmic trading developer with over 15 years of experience in the finance industry, this book will ground you by taking a rational approach to algorithmic trading, where EasyLanguage, datasets, charts, and AI are tools for your journey toward mastering the markets. Your unique human intelligence remains invaluable in navigating and understanding market complexities as you explore the realm of institutional insights, satisfying your hunger to learn real-world algorithmic trading applications from the institutional perspective.
By the end of this book, you’ll be able to confidently apply TradeStation EasyLanguage to algorithmic trading, integrate machine learning to refine your strategies, and craft a personalized approach to confidently navigate the financial markets.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 286

Veröffentlichungsjahr: 2024

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



TradeStation EasyLanguage for Algorithmic Trading

Discover real-world institutional applications of Equities, Futures, and Forex markets

Domenico D’Errico

TradeStation EasyLanguage for Algorithmic Trading

Copyright © 2024 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Kunal Sawant

Publishing Product Manager: Akash Sharma

Book Project Manager: Manisha Singh

Senior Editor: Nithya Sadanandan

Technical Editor: Vidhisha Patidar

Copy Editor: Safis Editing

Language Support Editor: Safis Editing

Proofreader: Nithya Sadanandan

Indexer: Pratik Shirodkar

Production Designer: Shankar Kalbhor

Senior DevRel Marketing Coordinator: Shrinidhi Manoharan

First published: September 2024

Production reference: 1100924

Published by Packt Publishing Ltd.

Grosvenor House

11 St Paul’s Square

Birmingham

B3 1RB, UK.

ISBN 978-1-83588-120-0

www.packtpub.com

My thanks go to everyone who, during my adventures in financial markets, has taught me—sometimes unintentionally—how things work and how algorithms are just a small part of a much more complex world where human relationships and psychological aspects play the true key role.

A special thanks to Antonio Zaffino, whose extensive trading experience in the markets has taught me that when navigating financial markets, it’s better to make mistakes on my own than by following someone else’s advice.

A special thanks to the team at The Gandalph Project and to Giovanni Trombetta, without whom the idea of AI applied to financial markets would still be a closed book to me.

- Domenico D’Errico

Contributors

About the author

Domenico D’Errico is a Certified SIAT Technical Analyst (CSTA). After having held various managerial roles within multinational companies, he has been working as a quant developer for algorithmic hedge funds for the past 15 years, being involved in several trading ventures.

He is an EasyLanguage specialist and a two-time winner of the 2011 TradeStation Developers contest. He published several articles in the Stocks & Commodities magazine.

He has developed a strong interest in AI research applied to the financial world, finding numerous similarities between some AI techniques and traditional technical trading.

Domenico is based in Matera, Italy. If you happen to be in the area or need anything, feel free to reach out to him at [email protected].

About the reviewer

Giovanni Trombetta is an entrepreneur and electronic engineer specializing in AI algorithms applied to quantitative finance.

Since 2012, he has been the founder and head of R&D at the Gandalf Project, a fintech and training company based in Italy. Since 2019, he has also served as one of the founders and CIOs of Rocket Capital Investment, a fintech company based in Singapore.

He is the president of the Scientific Committee at SIAT and has been a member of the IFTA Board of Directors since October 2019.

Giovanni has taught the data science module in the SIAT Master’s program, as well as the data science course for asset management for institutional operators.

Giovanni’s articles have been featured in Milano Finanza, Traders, and Technical Analysis of Stocks & Commodities. In 2020, he published his latest book on Python and Quantitative Analysis with Hoepli.

Table of Contents

Preface

1

Introduction to Algorithmic Trading and the TradeStation Platform

Introducing algorithmic trading

Algorithmic trading definition

Algorithmic trading in quantitative hedge funds

Introducing the TradeStation platform

The TradeStation story

Download and installation procedure

Introducing TradeStation apps

Workspaces and desktops

Summary

2

Getting Hands-On with EasyLanguage

Understanding the basics of EasyLanguage

What is EasyLanguage?

How EasyLanguage works

EasyLanguage words

EasyLanguage expressions

EasyLanguage statements

EasyLanguage punctuation

Writing indicators

Exercise 01—Close

Exercise 02—Close Open

Exercise 03—Real Body

Exercise 04—MidPrice

Exercise 05—NetCh

Exercise 06—NetCh with variables

Exercise 07—Momentum

Exercise 08—Moving Average

Exercise 09—Crossover

Exercise 10—Uptrend

Exercise 11—Time

Writing strategies

How to program a basic strategy

EasyLanguage order syntax

MaxBarsBack

How to program take profit and stop loss levels

Summary

3

Writing a Trend Strategy

Developing trading ideas

Market rationale behind a trend strategy

Information

Market participants

Prices and volumes

Identifying a trend algorithmically

Moving averages

Higher highs

Handling market noise

Entry confirmations

Volatility bands

Summary

4

Strategy Backtesting and Validation

Understanding backtesting and overfitting

Strategy complexity

Strategy robustness

Sensitivity analysis

One-way sensitivity analysis

Double-way sensitivity analysis

Multiple-way sensitivity analysis

Backtesting across symbols

TradeStation stock symbol universe

ROA report in Excel

Equity lines chart on Excel

Backtesting versus buy-and-hold

In-sample, out-of-sample analysis

Modifying EasyLanguage scripts for in-sample, out-of-sample purposes

An example of in-sample, out-of-sample validation

Summary

5

Reversal Strategies

The market rationale behind a reversal strategy

Reversal up

Reversal down

Writing a reversal strategy

Existing trend

Volatility compression

Final trend

Backtesting long strategies

Identifying stock to start with

Running a multiple sensitivity analysis on HD (Home Depot Inc.)

Exporting data into Excel and creating an ROA heatmap

Selecting the best parameter set

Backtesting the strategy on the full Dow Jones 30 index

Backtesting short strategies

Running multiple-sensitivity analysis on the SPY

Exporting data into Excel and creating an ROA heatmap

Selecting the best parameter set

Summary

6

Trend Pullback Strategies

The market rationale behind a trend pullback strategy

Writing trend pullback components

Existing trend

Pullbacks

Final impulse

Assembling components

Sensitivity analysis

Out-of-sample analysis

Summary

7

Risk Management

Money management

Price-based exits

Percent-based exits

Volatility-based exits

Position sizing

The P&L equation

Equal dollar risk technique without technical exit levels

Incorporating technical exits in equal dollar risk formulas

Summary

8

Futures and Forex Algorithmic Trading

Algorithmic trading for futures markets

The basic concepts of futures

How to write algorithms for time breakout strategies

Forex algorithmic trading

The basic concepts of forex

How to write algorithms for the forex market

Breakout versus fake breakout

Summary

9

The Trading Operational Plan

What is an operational plan?

A fully automated trading plan for futures

How to manage futures symbols for real trading

How to size the four futures portfolio

How to manage live fully automated strategies

A semi-automated trading plan on large stock lists

How to track entries with RadarScreen

How to calculate volatility-based sizes

How to monitor real positions

Summary

10

EasyLanguage in AI – Bridging Traditional Trading and Advanced Analytics

Python versus EasyLanguage

Volatility Predictor on gold futures by the Gandalf Project

Bridging Python and EasyLanguage

Embedding AI predictions into EasyLanguage indicators

Embedding AI predictions into EasyLanguage strategies

Using the Volatility Predictor model as a filter

Using the Volatility Predictor model for money management

Using the Volatility Predictor model for position sizing

Creating a volatility dashboard for multiple assets

Using TradeStation to collect predictions from multiple AI models

Summary

11

EasyLanguage for Machine Learning

A definition of machine learning for pattern recognition

The Iris dataset and Fisher’s project

Labeling trading sessions

Project N.1—recognizing an up session

Selecting the target

Selecting the features

Building the pipeline

The confusion matrix

Project N.2—recognizing down sessions

Selecting the target

Selecting features

Final results

Summary

Index

Preface

Embarking on a professional journey in the world of financial market trading is like setting sail on an adventurous voyage: captivating on one side, but dangerous on the other. You will set off, or perhaps you’ve already set off, along with many others who share the same goal: the treasure island, symbolizing your professional success determined by financial performance. Know that very few will make it, as storms, lack of food, exhaustion, mutinies, and daily disappointments will lead the luckiest to give up before they shipwreck.

Along the journey, you might encounter pirates and sharks—people who will try to exploit your good faith. Ignore them and stay on your course, following your map. This book will teach you how to build your own personal map to navigate because having an action plan during the inevitable financial and psychological drawdowns will save your life.

Try not to work alone because, on such a difficult journey, you’ll need trustworthy companions by your side. Remember that software, algorithms, and AI models are just tools—don’t fall in love with them, and be ready to change them if you realize they’re not helping you achieve your true goal: navigating the markets with peace of mind.

Note

EasyLanguage® is a registered trademark and every use of this word EasyLanguage is a registered trademark of TradeStation Technologies, Inc. All product names, logos, and brands mentioned in this book are the property of their respective owners.

Who this book is for

Tailored for individual traders with over a year’s experience in discretionary trading, with no programming skills, this book is designed for those who’ve grappled with market losses and the inundation of trading theories lacking statistical backing. Dive into the realm of institutional insights, satisfying the hunger to learn real-world algorithmic trading applications from the institutional perspective.

This book might also interest experienced traders and fund managers who are curious to gain another perspective on the market, with a particular focus on AI integration with TradeStation and machine learning for pattern recognition.

What this book covers

Chapter 1, Introduction to Algorithmic Trading and the TradeStation Platform, aims to define what is meant by algorithmic trading in this book and to introduce the TradeStation platform features.

Chapter 2, Getting Hands-On with EasyLanguage, provides a basic EasyLanguage training course.

Chapter 3, Writing a Trend Strategy, shows you how to develop a trend-following strategy in the stock market, providing the rationale behind trends, a strategy development method, and the programming code.

Chapter 4, Strategy Backtesting and Validation, provides the methodology for backtesting and validating algorithmic strategies using EasyLanguage and TradeStation.

Chapter 5, Reversal Strategies, demonstrates how to develop a reversal strategy in the stock market, providing the rationale behind reversals, a strategy development method, and the programming code.

Chapter 6, Trend Pullback Strategies, explains how to use the techniques learned in Chapters 3 and 5 to merge the two methodologies in order to create Trend Pullback trading strategies.

Chapter 7, Risk Management, addresses the critical aspect of managing financial risk in trading. While previous chapters have focused on identifying optimal entry points for trades, this chapter emphasizes the importance of managing risk through effective exits and position sizing. Given the inherent unpredictability of financial markets, controlling how much one is willing to risk is paramount.

Chapter 8, Futures and Forex Algorithmic Trading, explains how Futures and Forex offer numerous trading opportunities on uncorrelated instruments, allowing for both long and short positions; this chapter demonstrates how to use TradeStation and EasyLanguage for algorithmic trading in this vast market.

Chapter 9, The Trading Operational Plan, provides a step-by-step guide on how to set up TradeStation to create and execute an operational trading plan.

Chapter 10, EasyLanguage in AI – Bridging Traditional Trading and Advanced Analytics, explains how to integrate TradeStation with various AI models, creating dashboards that combine proven market monitoring and trading techniques with advanced AI tools.

Chapter 11, EasyLanguage for Machine Learning, explains how to program EasyLanguage for machine learning in pattern recognition, by exploring one of the earliest supervised machine learning experiments conducted by the British scientist Sir R. Fisher in the 1930s.

To get the most out of this book

To make the most of this book, it is advisable to have a basic understanding of financial markets, including concepts such as stocks, futures, Forex, and the fundamental dynamics of trading and stock charts. It is advisable to have a basic knowledge of Microsoft Excel, such as copy and paste operations, inserting simple formulas, and using pivot tables and charts, as well as basic concepts in mathematics and statistics, such as mathematical expressions, the use of parentheses, moving averages, and standard deviation.

Software/hardware covered in the book

Operating system requirements

TradeStation 10.0

Windows

Microsoft Excel

Windows

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Tradestation-Easylanguage-for-Algorithmic-Trading. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter/X handles. Here is an example: “entryprice is a reserved word that provides the entry price for the current position.”

A block of code is set as follows:

Plot1(Open,"Open"); Plot2(Close,"Close");

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

Plot1( I_OpenEquity, !( "OpenEquity") ,black ) ; Plot2( I_ClosedEquity, !( "Equity") ,darkgreen ) ;

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “From the main menu on the chart, go to Studies | Edit Strategies | Customize.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read TradeStation EasyLanguage for Algorithmic Trading, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

Scan the QR code or visit the link below

https://packt.link/free-ebook/9781835881200

Submit your proof of purchaseThat’s it! We’ll send your free PDF and other benefits to your email directly

1

Introduction to Algorithmic Trading and the TradeStation Platform

There is a lot of confusion when it comes to the term algorithmic trading, the tools involved, and the professionals who utilize such tools in their day-to-day activities.

In the first part of this chapter, we will provide an overview of what is meant by algorithmic trading, which tools make sense for the individual trader, and which professionals utilize algorithms in their trading process.

In the second part of the chapter, we will introduce the TradeStation platform, showing the installation process and its main functionalities.

In this chapter, we’re going to cover the following main topics:

Introducing algorithmic tradingIntroducing the TradeStation platform

By the end, we will have demystified the concept of algorithmic trading and you will have gained a clear understanding of the tools relevant to individual traders.

You can find all the information related to TradeStation expenses at the following link: https://www.tradestation.com/pricing/service-fees/.

Introducing algorithmic trading

There are various definitions of algorithmic trading, so we need to first clarify what we mean by this term in this book and what the perspective of these tools is from the viewpoint of professional users.

To achieve this, we are now going to cover the following:

A definition of algorithmic tradingWhat a quantitative hedge fund is from an organizational point of view

Algorithmic trading definition

According to a very common definition from Wikipedia, “Algorithmic trading involves using computer algorithms to help traders execute trading strategies based on factors like price, volume, and timing. The main advantages of algorithmic trading are speed and efficiency, backtesting capabilities, reduced emotional bias and diversification.”

Such a definition reflects what most people think about algorithmic trading but it doesn’t fit exactly the professional environment view. Let’s see why:

First, let’s clarify execution. Using algorithms and automating trade execution are two different matters. We may use algorithms just to automate a research process to analyze the market or to develop tools to monitor the market. We can also use algorithms to fully auto-execute trades but, as you will learn, this is just a component of a wider trading project.Let’s clarify the concept of speed. The primary goal of algorithms is not always to make things faster; rather, it’s about providing support in the decision-making process and solving problems efficiently and effectively. In addition, fast trading is not suitable for individual traders, as it requires huge investments in technology and, therefore, it is a battlefield where big companies operate.

In the coming chapters, we will learn how to choose a wiser approach for trade execution than increasing trading speed.

The third misunderstanding is about emotions. At a certain point in the trading decision process, emotions will kick in. If you are a discretionary trader, emotions will kick in when you click the Buy/Sell button. If you are an algorithmic trader, they will kick in when you activate the ON/OFF system button. Emotions are just delayed, not removed. Algorithms will help you approach the market rationally and scientifically, increasing your confidence level, and thus reducing your stress during the trade, but you will never get rid of emotions.

In Figure 1.1, you can see how algorithmic trading tools can be classified:

Figure 1.1 - Algorithmic trading tools by trading speed and automation level

In Figure 1.1, we classify algorithmic trading tools by trading speed (ranging from a few ticks to monthly time frames) and automation level (ranging from 0 to 100%).

As you can see, there are several ways to deal with such tools. Apart from discretionary trading and high-speed tools, which are not suited for individual traders, this book will help you do the following:

Program analysis tools such as statistical tools and machine learning frameworksProgram monitoring tools, such as real-time trading dashboards and equity market scannersProgram mechanical trading tools such as execution macrosProgram trading systems with a full automation approach

In conclusion, when we use the term algorithmic trading in this book, we mean any computer-based tool able to help traders analyze, validate, monitor, and execute trading strategies.

Algorithmic trading in quantitative hedge funds

When we talk about algorithms, we often forget that they are going to be used by humans. Therefore, I think it is essential to briefly describe my experience in the finance sector, where I worked for small quantitative hedge fund start-ups.

A quantitative hedge fund generally originates from the idea of a trader who, after several years of experience in the markets, decides to start a hedge fund business. Subsequently, they partner with other individuals who will handle the legal, administrative, and commercial management of the company.

In this initial phase of the hedge fund start-up, it is generally not a priority to build a proprietary trading platform. Hence, such funds find it very useful to utilize platforms such as TradeStation, which are ready for use. So, these funds generally temporarily hire a specialist familiar with EasyLanguage (TradeStation’s programming language) to transform the senior trader’s market insights into algorithmic tools that can help the entire team in the trading process. Experienced traders generally have a visual approach to the market, relying on charts as their primary tools, which they have been using for decades. Therefore, the EasyLanguage specialist is partnered with the traders for a certain period, seeks to align with their approach, and then constructs trading tools based on that understanding. Depending on the trading strategy, sometimes such funds hire a traders’ team: let’s imagine a trading room with 5–10 workstations, where traders work following the same dashboard that provides the team with the market perspective of the head trader. Simultaneously, they may have the freedom to act within well-defined risk rules. In other words, this type of organization leverages the computational power of algorithms combined with the individual sensitivity of the human trader.

Some other funds are a one-man band, and the trading decision process is very similar to the individual trader’s—except for the investors’ pressure and compliance matters.

At times, these funds create a small development department to continue research while the rest of the organization operates in the market.

In this way, TradeStation’s EasyLanguage becomes an indispensable tool both in research and development activities and in daily trading operations.

Introducing the TradeStation platform

TradeStation is a financial brokerage and trading platform that allows users to trade various financial instruments. Key features of TradeStation typically include advanced charting and technical analysis tools, customizable trading strategies, and a variety of order types. It is known for its focus on providing tools for technical analysis and algorithmic trading.

Let’s get an overview of TradeStation by going through the following:

The TradeStation storyThe download and installation procedureTradeStation appsThe working environment: Workspaces and desktops

The TradeStation story

When I started using TradeStation and EasyLanguage many years ago, I had the impression that the platform and the language editor understood what I, as a trader, was looking for. It was a bit like using a co-pilot, but at that time, AI was just a movie.

Now, there are many software options available for algorithmic trading, but at an early stage as a programmer, TradeStation’s EasyLanguage (or PowerLanguage from MultiCharts, which is 90% supported) is the best choice because it doesn’t require previous programming experience and has a short learning curve.

MultiCharts PowerLanguage

MultiCharts (www.multicharts.com) is a trading platform very similar to TradeStation. The main differences are in the broker integration both for trading and data feeding, as MultiCharts supports integration with various brokers, and TradeStation is both a trading platform and a brokerage. All the EasyLanguage scripts provided in this book are 100% supported by MultiCharts.

TradeStation has quite a compelling story in the world of trading and financial technology. Originally founded in 1982 by William and Rafael Cruz, TradeStation started as Omega Research, Inc., focusing on developing tools for traders. In 1991, they launched the TradeStation platform, which quickly gained attention for its advanced charting, technical analysis tools, and strategy backtesting capabilities.

As the years progressed, TradeStation evolved into a comprehensive trading platform offering not just analysis tools but also order execution capabilities for equities, options, futures, and forex trading. It became known for its robustness in catering to active and professional traders, offering customizable features and algorithmic trading capabilities.

In 2011, TradeStation was acquired by Monex Group, a global financial services company. This acquisition further expanded TradeStation’s reach and resources, allowing for enhancements in technology and service offerings.

TradeStation has continued to innovate, adapting to changing market needs and technological advancements. It has remained a prominent player in the trading platform arena, often favored by traders seeking powerful analytical tools and a comprehensive trading environment.

The platform’s journey has been characterized by a commitment to providing traders with cutting-edge technology, a user-friendly interface, and a suite of tools to support their trading strategies across various financial markets.

Now that you know the story of TradeStation, let’s download and install it on your system.

Download and installation procedure

First of all, you need to open a TradeStation account at http://www.tradestation.com/ and follow the instructions provided on the main web page.

Once you have an account, you can log in to the website and download the desktop platform by going to Download Software | Download Platform. Then, follow the straightforward installation instructions.

There are some prerequisites for it, which are listed next. Please check the minimum requirements before installation:

Processor

Dual-core Intel® or AMD® processor at 1.5 GHz or faster

Memory (RAM)

8 GB

Hard Drive

5,400 RPM drive

400 MB free space or more

Video Cards

32-bit graphics support

256 MB for a single monitor

Screen Resolution

1280×1024 pixels or higher

Operating Systems

Windows® 10 64-bit

Windows® 10 32-bit

Internet Browser

Microsoft Edge browser

Internet Connection

Broadband connection

2 Mbps or better (download)

Table 1.1 - Technical minimum requirements

In case you need any kind of technical help related to the platform, you can find a very active community at https://community.tradestation.com/discussions/.

Once the installation is complete, double-click on the TradeStation icon that you will find on your desktop. The platform will look like Figure 1.2. Please note that every time we mention the main menu, we are referring to the menu you see in Figure 1.2:

Figure 1.2 - Main menu

We are going now to introduce the main TradeStation apps.

Introducing TradeStation apps

The latest release of the TradeStation platform (version 10, update 72) is made of 20 apps. by clicking on File | New Application, we can see the list of available applications (Figure 1.3):

Figure 1.3 - TradeStation apps

In Figure 1.3, you see the 20 applications available listed in alphabetical order. For the algorithmic training purpose of this book, we are mainly going to deal with four of them:

Chart Analysis: We can use this to visualize price charts and indicators or strategies applied to themRadarScreen: We can use this to monitor up to 1,000 markets in real timeScanner: We can use this to scan the entire symbols universe for specific trading opportunities based on predefined criteriaEasyLanguage: We can use this to manage the TradeStation Development Environment page (or EasyLanguage editor)

Chart analysis

A chart analysis is a chart that visually represents the historical price and volume data of a security over a specific period. It is the basic brick where you can add indicators or strategies; such functionalities will be illustrated starting in Chapter 2.

To create a chart analysis from the main menu, go to File | New Application | Chart Analysis. In Figure 1.4, you see a chart for SPY, which is the financial asset representing the main 500 US companies:

Figure 1.4 - Chart analysis for SPY ETF

As you can see in Figure 1.4, the chart settings can be modified by the menu available on top of the chart, where you can manage the following:

TimeframeDrawingStudiesStrategiesDataStyleSettings

To choose the chart’s timeframe, click on Timeframe, and then select your preferred one, as shown in Figure 1.5. For example, in Figure 1.4, we used the Dailytimeframe option:

Figure 1.5 - Chart timeframe

The Drawing menu allows you to incorporate drawings into the chart. However, this feature is seldom utilized in algorithmic trading.

To apply a study, from the chart menu, go to Studies | Add Study. A list similar to Figure 1.6 will show you the studies available: all your custom studies will be shown in this list.

Figure 1.6 - Chart studies

For example, in Figure 1.7, we applied a MACD indicator on the Daily chart of SPY:

Figure 1.7 - MACD indicator

To apply a strategy, from the chart menu, go to Studies | Add Strategy. A list similar to Figure 1.8 will show you the strategies available: all your custom strategies will be shown in this list.

Figure 1.8 - Chart strategies

For example, in Figure 1.9, we added a MACD strategy on the same Daily chart of SPY:

Figure 1.9 - MACD strategy

To manage the historical data or change the symbol properties, you can click on Data and navigate the list shown in Figure 1.10:

Figure 1.10 - Chart data

To manage the chart’s style, you can click on Style and navigate the list shown in Figure 1.11:

Figure 1.11 - Chart styles

If you click on Settings, you can find additional resources to customize your chart (Figure 1.12):

Figure 1.12 - Chart settings

We now understand how to manage TradeStation charts. Being familiar with them is crucial for algorithm programming because the charts are generated from the same datasets that will be used for creating both indicators and strategies. As you will see in the coming chapters, charts will be the primary tool you use to determine whether the strategies you have written are correct.

RadarScreen

RadarScreen is a real-time scanning and ranking tool that allows you to apply technical and fundamental indicators to a list of symbols in a tabular format. Each symbol row in RadarScreen is similar to a chart in that you can access historical data at any bar interval for any symbol as needed for your indicator calculations. There are hundreds of indicator columns covering all aspects of market analysis that can be inserted into RadarScreen. You can build symbol watch lists by inserting pre-built symbol lists or you can create your own custom lists. RadarScreen can dynamically sort and rank groups of symbols based on alert criteria, price information, or indicator calculations, and you can customize any calculation or alert for the way you trade.

To create a RadarScreen page, go to File |New Application | RadarScreen or press Ctrl + Alt + Q. The RadarScreen page will appear as in Figure 1.13:

Figure 1.13 - RadarScreen

There are two ways to insert symbols into a RadarScreen page.

The first way is to insert symbols manually by just typing the ticker into any cell in the Symbol column (Figure 1.14):

Figure 1.14 - RadarScreen—adding a symbol manually

Please note that on RadarScreen pages, you can manually edit just the symbol names.

The second way is to go to Data | Add Symbol List and choose your preferred symbol list among the many TradeStation lists available (Figure 1.15):

Figure 1.15 - RadarScreen—TradeStation symbol lists

For example, in Figure 1.16, we chose the Dow Jones 30 list:

Figure 1.16 - RadarScreen Dow Jones 30

To choose the RadarScreen timeframe, you need to click on Timeframe and select your preferred one. The list is the same as we saw for Chart Analysis.

To add indicators, from the RadarScreen menu, go to Studies and then select your preferred one from the list of available indicators.

From the Settings menu, you can customize the layout of the RadarScreen tool, such as managing the page settings, captions, and templates (Figure 1.17):

Figure 1.17 - RadarScreen settings

From Settings | Page, you can manage settings such as Color, Font, and Grid (Figure 1.18):

Figure 1.18 - Settings | Page

Using RadarScreen is similar to having the big picture of multiple charts showing just the last real-time reading both for the price and for any indicator applied. Please remember that RadarScreen has a limitation of 1,000 rows; if you need to manage longer lists, you may need to use Scanner.

Scanner

The Scanner app is a tool to scan lists with more than 1,000 symbols. It is not in real time, and it is very useful for equity traders interested in daily/weekly/monthly market analysis.

You can open an empty Scanner page from the main menu by going to File | New Application | Scanner. It will appear as shown in Figure 1.19:

Figure 1.19 - Empty Scanner page

Scanner pages are a must when you deal with thousands of stock symbols. We will see how to set and use Scanner in Chapter 3.

EasyLanguage

From the main menu, go to File | New Application | EasyLanguage to open the TradeStation Development Environment page (or EasyLanguage editor). It will appear as an empty space with a menu, as shown in Figure 1.20. Every time we talk about the EasyLanguage menu, we will be referring to this:

Figure 1.20 - TradeStation Development Environment (or EasyLanguage editor)

Try to create a new indicator from the EasyLanguage editor menu. Go to File | New | Indicator, give it the name myindicator, and then click OK:

Figure 1.21 - The myindicator indicator

In Figure 1.21, you can see what the editor will look like. For the purpose of this book, you are mainly going to use the text editor section, in which you will write 100% of your code, and the output bar, where compiling errors will appear.

Workspaces and desktops

TradeStation allows the creation of customized working environments by using the following:

WorkspacesDesktops

Workspaces

A workspace is a customizable environment where users can arrange and organize different apps such as Chart Analysis, RadarScreen, and other analysis tools. The workspace allows traders to have a tailored setup that suits their trading preferences and strategies.

In Figure 1.22, you can see a workspace populated with multiple charts:

Figure 1.22 - Workspace with multiple charts

In Figure 1.23, you can see a workspace containing one RadarScreen linked to one chart:

Figure 1.23 - Workspace with RadarScreen and chart linked

Remember that to link a chart to a RadarScreen, you need to give the Symbol Link button the same color, as shown in Figure 1.24:

Figure 1.24 - Symbol Link

Workspaces are a very useful tool to customize your working environment according to your needs. Remember that your needs may change during the week and/or during the day; for example, you might use a workspace with Scanner while markets are closed and a workspace with RadarScreen and Chart Analysis during the trading sessions. Workspaces can be managed by going to File | Workspace.

Multiple workspaces can be collected into one desktop.

Desktops

Desktops are very useful if you manage multiple