The EasyLanguage ABC's: First Steps in Mastering TradeStation Programming On Tuesday, May 23rd @ 4:30PM Eastern US we held a webinar with futures.io, the largest Futures trading community. The webinar was recorded and a link to the recording and webinar thread on futures.io is below. The webinar deals with "The EasyLanguage ABC's:" and explains the "First Steps in Mastering TradeStation Programming". It covers a lot of helpful information that can really simplify your programming life. Some bullet points are: What is EasyLanguage and where can I use it? The EasyLanguage ABC - a foundation of the basics Good coding habits Working with the Tradestation Development Environment Tips and Tricks for finding code errors Make sure to check the webinar thread on futures.io, where you can find the links for the useful resources, codes and some of the slides that I used during the webinar. You can also ask questions there.
Working with Multicharts and Tradestation - Lesson 06: Functions Learn how to create and use functions in Multicharts and Tradestation Let’s take a look at what functions are and how they are used. We can use this as foundation for another lesson when we take a look at how to operate the function that comes with our free Value Area Indicator. In previous lessons we have looked at Moving Averages in various forms. The studies we wrote had all calculations within the main code block. This is fine to demonstrate things or when you only work with a few lines of code. However handling ten different moving averages within your code would require you to add the same code ten times. This would make your code much harder to read and the code maintenance would become harder, too. Think about a logic error you want to fix or a change in the average formula that you want to make. A mistake in the average logic is likely included in all ten code blocks. The change to the formula would have to be made at ten locations within the code. What are functions? Functions can be of help here. As the developer you can keep your code at one location, within a function. You can use this function now to provide the results of the computation to any other code. In case of a logic error in the code this can be a huge help. The error has to be corrected at one place only. At the same time this correction will effect all other codes that call your function. It doesn't even have to be as serious as an error. [...]
Learning EasyLanguage & PowerLanguage - Lesson 05: Text and Trendlines Tracking daily extremes with an indicator The goal for this lesson is to do some more programming and create a study that tracks the daily extremes of a symbol. If you haven't read the previous lessons, I suggest you start at the beginning with lesson 01, as this lesson will use basics covered in earlier sessions. As I wrote the goal is a study that is able to track the daily extremes and to display them on the chart. We want to be able to see the current extremes for the day and also show yesterday's extremes on today's data. Let's take a moment to consider what we need for this study and how we want to handle the objectives best: we need to be able to find the highest high and lowest low for each day the study should use trendlines to display yesterday's extremes we want to be able to change the appearance on the chart via inputs the study should display text on the chart that labels the lines This already gives you an idea about what we have to look at today. Besides being a useful study or framework for future modifications, drawing text and trendlines and updating them will be the focal point of this study. Multicharts and Tradestation provide functions that return the daily high and low, but for various reasons this is not what we want to use here. Instead we'll create two tracking variables that store the current highest high and lowest low. On a new day these variables need to be reset and their value will be stored in a second set of variables. [...]
Multicharts Tutorial - Lesson 04: If statements and conditional branching Learn how to execute code expressions based on conditions In today's lesson you will learn how to control your program flow and make it execute parts only when certain conditions are met. This is where if statements are used. You can find them in basically every high level programming language and they are the engine that drives each program. If statements can for example be used in coloring a moving average differently based on its relation to the close of a bar. If you want to close all open positions after a certain time, an if statement will come into play. In case you want to trigger an alert when a predefined condition is met, you will also use an if statement for that. This list could go on for quite some time, but I think you already understand that if statements are not only very useful, but also very important. No programming tutorial could be complete without going over them and a good understanding is essential before we can move to more complex things. if...then... The "if...then..." statement is the simplest form of a conditional statement. The condition is tested and if it's true the following code statement will be executed. If the test is false nothing will be done as the following code statement will not be executed. When I say the test is true, don't get confused and think you are limited to testing conditions that include "true" only. In case "ii" is a numeric variable and "MyCondition1" and "MyCondition2" are boolean variables these are three valid "if...then..." statements. In case of the first statement the code checks for [...]
EasyLanguage & PowerLanguage Tutorial - Lesson 03: The while loop Learn how to properly use the while loop in your programming Welcome back for the next lesson in our way to become fluent in Multicharts, Easylanguage and PowerLanguage. If you haven't read the previous lessons yet, I would suggest to start here. A new lesson will build up on the previous lessons and starting at the beginning will ensure you have a solid foundation. Lesson 02 showed how you can easily calculate a simple moving average and plot it on the chart. We used a "for loop" to sum the values over the previous bars that should compose the average. Today you will learn another type of loop and how to use the editor to print information to the output bar. In the first lesson we took a look at the main window within the PowerLanguage editor. When you open the editor it will probably show three different parts. If it looks very different on your end chances are that you changed the appearance under "View". Make sure that the "Output Bar" is checked as we will use this during the current lesson. Switch to the "Output" tab in the bottom window. This is where the PL editor will display information coming from print statements within your code. We will take a look at how this works now. Create a new indicator with a name of your choice. Again I am using a name that is easy for me to find within the editor and that displays the purpose of the indicator. We want the print statement only to appear one time in this demonstration. Easylanguage offers a convenient reserved word for [...]
EasyLanguage & PowerLanguage Tutorial - Lesson 02: Coding A Moving Average Creating the first real indicator and expanding the basics After you familiarized yourself with the PowerLanguage Editor in the previous PowerLanguage tutorial - lesson 01 we will now build up on this foundation. In case you haven't read the last lesson, I would suggest doing that first as it can help you with understanding this lesson, too. Let's start with today's lesson now. Open the PowerLanguage Editor and create a new Indicator study. I will name mine ABC_PowerLanguage Lesson 02 - Moving Average so I can find it easily within my editor later. The name is totally up to you of course and you could even change it later. As the last part of the indicator name suggests, we will create and plot a moving average today. You have probably seen a moving average on a chart before or remember the term average from math. The main use for averages is as a filter to smooth the data you input. The image displays a 200 period simple moving average that gives a very smooth outcome. The downside to this smoothness is that you introduce more lag. This means the average becomes less responsive to changes in price. If you take a look at the next image you will see how different the behavior of a 200 period simple moving average is when you compare it to the green 10 period average. The latter is much quicker in responding to price changes, but in turn there is a lot more "noise" in the average. There are many different types of averages that mainly vary in the impact each data point has [...]
EasyLanguage & PowerLanguage Tutorial - Lesson 01 The first steps towards Easylanguage & PowerLanguage proficiency Great, you are taking the first step towards learning to program in Multicharts and Tradestation. I am happy for you as this will be an interesting journey. This will bring up a new window. Set the study type to Indicator and click “OK”. Give the study a name of your choice. The only limitation is that the name can't be already in use by a different study. For example I will use ABC_PowerLanguage Lesson 01 as name and then click OK again. The name will be what you use later to add the study to the chart, so it helps when it displays the purpose of the study. I like using the ABC_ prefix to label the studies that I have worked on for myself or the website for example. For other work I will use different labels. This makes it easier to find something when I have to look up a study. Every study can have inputs that you can assign a default value to. For example you can use an input for the length of a moving average. The inputs for indicators and signals can be changed when you load the study on a chart. So it makes sense to have some inputs to allow a more user friendly study. When you declare an input by giving it a name and initialize it by assigning a default value, you also define the type of the input. There can be three different types: a Numeric input a String input a Boolean input i.e. a true/false input To declare an input you [...]
EasyLanguage Tutorial - Lesson 0 Learning EasyLanguage as easy as ABC A new school year starts after the summer holidays here. This seems to be the perfect time to finally start something I had in mind for a long time. I wanted to create a set of Easylanguage tutorials that help users with starting to learn how to program in Multicharts and Tradestation. At least help them in understanding basic coding principles. If you already have coding experience in either of the programs these EasyLanguage tutorials will probably not be for you. The lessons will be geared towards Multicharts, as the build in PowerLanguage is more powerful than Tradestation’s EasyLanguage. At the same time what works within EasyLanguage will usually work within PowerLanguage, too. I will highlight differences in the two languages, thus making sure you can use the lessons for Tradestation, too. Tradestation and Multicharts have expanded the programming capabilities of their software a lot over the last years. Tradestation has extended EasyLanguage with object oriented components. It’s called OOEL (object oriented EasyLanguage) which allows for more complex programming. Multicharts.NET even takes it one step further as you can program in C# or VB.NET. This offers great possibilities for experienced programmers. Some brokers even offer Multicharts.NET for free. As the EasyLanguage tutorials focus on the basics (and Multicharts.NET doesn’t use EasyLanguage or Powerlanguage anyway) I will concentrate on EasyLanguage and PowerLanguage first. My goal is to create one lesson per week and I will try to have a couple of lessons ready for publishing in advance. So in case there will be little time, I still have something to publish for you. As I said I will start with basic concepts [...]