Video Transcript: Create TradeStation® Strategies Using Point-&-Click with Quagensia T Edition – Full Tutorial

<< Back to Video’s Home Page

Quagensia T Edition makes it easy to create algorithmic trading strategies for TradeStation® 9.5 and TradeStation® 10 without code by simply clicking choices on a screen as you would verbally describe your trading ideas. You can then backtest, optimize, and trade your trading strategies in live markets with TradeStation®.

In this video, we will build a simple algorithmic trading strategy in Quagensia T Edition without code by simply clicking choices on a screen as you would verbally describe the trading idea. Then, we will generate our strategy’s code and copy it to the clipboard with the click of a button, then paste it into TradeStation®. Then, we will backtest and optimize our strategy on 10 years of historical market data that comes free with TradeStation®. The goal of this video is to answer as many FAQs as possible in 1 hour 7 minutes and onboard new users quickly and efficiently. The pace of the video is relatively fast, and most users will likely benefit from watching it a second time and rewatching certain sections multiple times. We recommend watching this video with Quagensia T Edition open and following along with the video by frequently pausing it and pointing and clicking in your own Quagensia Strategy to build the same trading logic without code.

Video Transcript: Create TradeStation® Strategies Using Point-&-Click with Quagensia T Edition – Full Tutorial

Quagensia T Edition makes it easy to create algorithmic trading strategies for TradeStation® 9.5 and TradeStation® 10 without code by simply clicking choices on a screen as you would verbally describe your trading ideas. You can then backtest, optimize, and trade your trading strategies in live markets with TradeStation®.

In this video, we will build a simple algorithmic trading strategy in Quagensia T Edition without code by simply clicking choices on a screen as you would verbally describe the trading idea. Then, we will generate our strategy’s code and copy it to the clipboard with the click of a button, then paste it into TradeStation®. Then, we will backtest and optimize our strategy on 10 years of historical market data that comes free with TradeStation®.

This video is merely a “how to” tutorial that shows you how to do something very simple and basic rather than impress you with the extreme power of Quagensia. If you want to learn more about Quagensia’s advanced features and compare Quagensia to your current codeless strategy builder, please read the features list at the bottom of our home page and watch our other video tutorials.

Before we begin, note that once you install the Quagensia free trial, the clock starts ticking on your free trial period. The free trial is full-featured and the strategy code you generate with Quagensia is yours to keep and use on an unlimited number of computers even after your free trial ends. So once you install Quagensia you should use it as much as you can to make as many algos as you can before your free trial ends.

If you decide not to go with Quagensia at the end of your free trial, you won’t be able to edit your algos codelessly from within Quagensia, but you will still be able to open Quagensia and generate the code for algos, including the ones you built, the built-in strategies you see here, and the free algos you download from third parties.

If you’d like to follow along, you can pause this video, go to quagensia.com, quickly download and install the Quagensia T Edition free trial, and restart this video.

Let’s get started.

To create a new Quagensia Strategy, click on the “Plus” icon on the left side of the toolbar and click “Create New Quagensia T Edition Strategy”.

This creates a new Quagensia Strategy in a new tab.

Give your strategy a name. This will be its name in Quagensia T Edition.

Change its “Strategy Name Used in Quagensia Code Archive File & Folder Names” to something relatively short.

Save this new strategy to your “My Algos” folder by clicking on the “Save” icon in the toolbar or by holding down the “Control” key, then pressing the “S” key.

Then click the “Save” button in the “Save As” dialog.

We now have a new strategy in our “My Algos” folder. Now let’s build out its trading logic by simply clicking choices on the screen.

Scroll down to the “Input Parameters” section.

This section is where you define the input parameters of your strategy that you will be able to change from within the TradeStation® user interface.

We will be creating a basic moving average crossover strategy, so let’s create input parameters for the periods of each moving average.

Name the first one “Fast MA Period”, change its type to “Whole Number”, set its initial value to 3, and click the “Add Parameter” button.

Name the second one “Slow MA Period”, change its type to “Whole Number”, set its initial value to 6, and click the “Add Parameter” button.

We also want to make it possible to choose a position size from the TradeStation® user interface, so let’s also create an input parameter named “Order Quantity”, change its type to “Whole Number”, set its initial value to 100, and click the “Add Parameter” button.

Before we move on, notice the large number of data types that our input parameters can use. In addition to the basic ones that most codeless strategy builders support, Quagensia T Edition lets you pass input parameters of advanced data types from the TradeStation® user interface, including five kinds of dates and times, colors, advanced numeric types, and “Lists of Choices” types such as the “Trade Direction” or “Instrument Type”, which show up as drop-down lists in the Quagensia user interface and whole numbers in the TradeStation® user interface.

Now, scroll down to the “Internal Variables” section.

This section contains variable definitions used to store values that are part of the internal logic of our strategy.

Let’s create two internal variables of type “Read-Only Time Series”, one for the slow moving average in our strategy and one for the fast moving average.

Name the first one “Fast MA” and change its type to “Read-Only Time Series”. Note that its “Data Type of Individual Time Series Items” field defaults to “Decimal Number”, which is correct for our example.

Click on the gear icon to the right of the text box next to the “Value” label to open up a context menu containing the context-sensitive list of all of the allowable expressions we can use at this location.

Then, roll your mouse over “Replace Item” to see all the functions that can be used as read-only time series in TradeStation®. Examples of read-only time series of decimal numbers that can be used at this location include indicators, a property of the primary price bars data series or a secondary price bars data series such as the open, high, low, or close price, or another internal variable of type “Read-Only Time Series” or “Editable Time Series” that is defined above this internal variable, which makes it possible to create nested indicators. “Editable Time Series” are particularly powerful because they allow you to create your own custom time series or indicator that is populated by your own custom calculations in your strategy and then use it in the logic of your strategy. Note that TradeStation® also allows any single-valued numeric expression, like the number 10, to be used as a read-only time series of decimal numbers, which is why you are seeing single-valued numeric expressions in the context-sensitive list of all the allowable expressions we can use at this location.

Before we choose an indicator, notice the very large number of indicators you can select from, and how they are nicely organized into categories for easy discovery. Note that if you cannot find a particular indicator you can add it to Quagensia the easy way by copying one of the over 170 built-in Quagensia T Edition Functions that you see here and making small changes to match your indicator’s name, input parameters, and other attributes.

Although Quagensia T Edition has over 1,000 functions, this context menu is only showing the subset of functions that can be used as indicators or other read-only time series of decimal numbers since the location we clicked only allows read-only time series of decimal numbers. Some codeless strategy builders don’t filter their functions to only include those that are allowed at the location you want to add something. This wastes your time and mental energy by forcing you to browse through many functions that aren’t allowed at the location of interest. It also introduces a major source of errors because it makes it your responsibility to figure out what functions are valid at a given location and which functions are not. Quagensia limits the choices in its context-sensitive context menus to only the choices that are valid at the location you clicked, which stops you from making serious mistakes like putting text where a number should go or putting a date where an indicator should go.

If you want to learn more about an indicator, place your mouse pointer over the icon to the left of the menu item, read the tooltip that appears, and press F1 to go the documentation web page for that indicator. If you want to learn about other topics that are the most relevant to the location where you clicked, roll your mouse pointer over the “Help / Tutorials” menu item and click on any help topic you want to learn more about.

Let’s choose the weighted moving average from the large list of moving average indicators and click the “Add Variable” button to add it to our strategy.

One more note about getting context-sensitive help when you need it: Rolling your mouse pointer over icons, reading tooltips, and pressing F1 to get help also works for all gear icons that appear on the right side of any location in your strategy. For example, when you place your mouse pointer over the gear icon that appears when your mouse pointer is over “The Current Bar of Close”, an informative tooltip appears, and pressing F1 opens the TradeStation® help topic titled “Close (Reserved Word)” located on TradeStation®’s website. Clicking on the gear icon and rolling your mouse over “Help / Tutorials” displays other related help topics, such as the “Using Read-Only Time Series” help topic.

Note how moving our mouse pointer over another element in our strategy also refreshes the “Context-Sensitive Help” panel on the right side of the application’s main window to show the tooltip, the link to the most relevant help topic, and links to the related help topics. Clicking one of these links opens the help topic in your default browser.

Quagensia gives you the help you need, right when you need it, which is an indispensable time-saving feature.

If you want to view all our help topics, click the “Using Quagensia (The Main Help Page)” link at the bottom of the Context-Sensitive Help Panel, click on the appropriate link on the Start Page, or choose the appropriate item in the main menu’s “Help” menu. As you can see, Quagensia’s help documentation is quite extensive.

Let’s get back to building our strategy.

Change the “Length” field from a hard-coded number to the input parameter we created called “Fast MA Period”.

Check the “Plot” check box so the indicator will appear on TradeStation® charts, and style the indicator’s plot as you wish.

Now, let’s repeat this process to add another internal variable of type “Read-Only Time Series” named “Slow MA”. Instead of using the weighted moving average again, let’s use the triangular moving average instead. We already know that it can be found in the same subfolder as the weighted moving average but let’s pretend that we don’t know where to find it. If you can’t find the indicator you are looking for, enter part of its spoken name or even its keyword in EasyLanguage® code in the text box at the bottom of the context menu, click the “Search for a Function…” button, and you should quickly be able to find the indicator you are looking for in the search window and choose to insert it at that location. To see how search works, just click on the gear icon to the right of the text box next to the “Value” label, enter the word “triangular” into the search box, and click the “Search for a Function…” button. Our search found two variations of the triangular moving average. Note that the search window is context-sensitive in the same way that the context menus are, so the search results only include choices that are allowed at the location you clicked. For example, if there was a function with the word “triangular” in it that wasn’t an indicator or other read-only time series, it wouldn’t show up in this search because you opened the search window from a location that only allows read-only time series. Also note that the search results show us that we could have found these two indicators in the context menu’s subfolder located at “Indicators” >> “Moving Averages” so we won’t need to search for it next time. Click on the search result for the variation of the triangular moving average that ends with “(10 Rounds To 6,6)”, click “Add this function to your algo at the location you specified”, and click the “Add Variable” button to add it to our strategy.

Change the “Period” field from a hard-coded number to the input parameter we created called “Slow MA Period” and plot this indicator as previously described, but this time choosing a different plot color or plot style.

Before we move on, notice the large number of additional data types that we can use as internal variables. In addition to the ones that most codeless strategy builders support, Quagensia T Edition lets you create and use internal variables of extremely powerful and highly advanced data types, including lists that can hold anywhere from zero values to millions of values, arrays which are like lists but can be single-dimensional or multi-dimensional, editable times series that allow you to create your own time series that you can plot and use in your trading logic similar to how you would use an indicator, read-only time series that let you add indicators and time series for multiple instruments and multiple bar periods to your strategy, eight kinds of dates and times, colors, advanced numeric types, and “Lists of Choices” types.

Now that we have set everything up, it’s time to create the logic for our strategy in the “When Bar Updates” section. The logic in this section is executed on each eligible bar update event, which could be on each bar close or on each tick representing a trade in the market. If the “Intra-Bar Order Generation” field in the Strategy Details section of your Quagensia Strategy is set to “Use Default Value”, then you can change this behavior in the TradeStation® user interface. If the “Intra-Bar Order Generation” field is set to “true” or “false”, the logic in the “When Bar Updates” section will be executed unconditionally on each tick or on each bar close, respectively, and you will not have the ability to change this value in the TradeStation® user interface.

Click the “Add Trading Logic” link at the bottom of this section to open a context menu with all the actions that our strategy is allowed to take in this section. You will learn about the many kinds of powerful actions available to you in future videos. For now, just add a “Conditional Logic (If Block)” action. Note that while some codeless strategy builders only support “If” blocks and do not support “Else If” or “Else” blocks, Quagensia allows you to add unlimited “Else If” blocks beneath each “If” block and add “Else” blocks as well.

Furthermore, while some strategy builders do not allow you to nest conditional blocks inside one another, Quagensia allows you to nest “If”, “Else If”, and “Else” blocks inside other “If”, “Else If”, and “Else” blocks which can be further nested inside even more “If”, “Else If”, and “Else” blocks.

Let’s enter a long position using a market order when a bunch of conditions are true, and we are not currently in a position.

Our first entry condition is that we can’t already be in a position. Let’s use context-sensitive search to find a function that sounds right then insert it at this location from the search window. Just click on the location where you want to insert a function and enter a search term. Whether you search for “Position”, “Flat”, “Short”, or “Long”, you won’t be able to miss multiple functions that will allow us to check if we are currently flat, but we will choose the function called “Market Position (Current) (As a Choice From a List: Long, Short, or Flat)”.

Click on that row in the search results and click the context menu item to add it to our strategy at the location we specified, and let’s finish the condition by saying that this must be equal to “Flat”.

Once again, we’ve used context-sensitive search to find and insert a function without knowing how else to find it. When we roll our mouse pointer over the gear icon to the right of this function, we can see in the tooltip and the Context-Sensitive Help panel on the right of the application’s main window that its location in the context menu hierarchy is “More Expressions…” >> “Orders, Fills, and Positions” >> “Position Info”, and there it is. We could have inserted it by clicking on it from this context menu as well.

Now let’s add a moving average crossover condition. Click the condition we just made and click “Add Condition After Me Using AND”. Click on the comparison operator to change it to “Crossed Above a Time Series (While Time Series Shown on Left Going Up)”. Before we click on a choice, notice the large number of comparison operators that you can use in conditions. In addition to the ones that most codeless strategy builders support, Quagensia T Edition gives you many variations of “Crossed Above”, “Crossed Below”, “Is Between”, and “Is Within X Units of Y”.

Now let’s set the left side to our “Fast MA” indicator variable and the right side to our “Slow MA” indicator variable that we defined in the “Internal Variables” section.

Note the order of the three things we just did to create a condition. When creating a new condition, always start by choosing a comparison operator like we just did instead of filling in the left side or the right side of the comparison operator, because the choice for the comparison operator filters the choices in the context menus that appear when you click on the left side or the right side of it. To see an example of this, notice how there are a lot more choices when we click on the left side of the “Is Equal To” comparison operator than when we click on the left side of the “Crossed Above a Time Series (While Time Series Shown on Left Going Up)” operator, since only functions that return time series are allowed to go on the left side or the right side of a “Crossed Above” operator, but almost all functions return a value that can be equal to another value. Once you choose your comparison operator, you should build an expression on the left side first, because your choice for the left side further filters your choices on the right side. For instance, if you choose a numeric expression for the left side, the context menu that opens when you click on the right side will only have numeric expressions. If you then decided that you wanted to change the comparison to compare a date or time with another date or time, remember that you need to do this from the left side first, because in our example the right side will be filtered to only have numeric expressions whereas the left side will let you choose any expression that is compatible with the “Is Equal To” comparison operator, including date and time expressions. In summary, to create a condition, first set the comparison operator to properly filter the context menu that opens from the left side, then choose an expression for the left side to properly filter the context menu that opens from the right side.

Now let’s add conditions that say we want the low of the price bar that just closed to be higher than the low of the previous price bar and the low of the previous price bar to be higher than the low of the price bar before it.

Click on the condition we just created and click “Add Condition After Me Using AND”. Change the comparison operator to “Is Greater Than” since we should always set the comparison operator before we set the left or right sides. Set the left side to “Price Data” >> “Low”, copy and paste the left side onto the right side, then on the right side change “The Current Bar” to “The Previous Bar”. Now let’s create a condition that compares the previous price bar to the bar two bars ago. Click on the condition we just created and click “Add Condition After Me Using AND”. Since this condition will be almost the same as the one we just made, let’s simply copy and paste the completed condition we just made on top of the empty condition we just added beneath it. Change the left side to “The Previous Bar” and change the right side to “The Bar 2 Bars Ago”.

Now let’s add a condition merely for instructional purposes that says we only want to consider a signal if it occurs on a bar whose close price is either more than 3% higher than the close price of the bar 20 bars ago or is more than 5% higher than the close price of the bar 40 bars ago. Click on the condition we just created and click “Add Condition After Me Using AND”. Change the comparison operator to “Is Greater Than” since we should always set the comparison operator before we set the left or right sides. Set the left side to “Price Data” >> “Close”, copy and paste the left side onto the right side, then on the right side change “The Current Bar” to “The Bar a Custom Number of Bars Ago”. The text box that appears expects a whole number greater than or equal to 0. The number 0 indicates “The Current Bar”, the number 1 indicates “The Previous Bar”, and so on. Enter the number “20” in this text box to get the close price of the price bar 20 bars ago.

Unlike in some other codeless strategy builders, you can also replace this text box with any other expression that returns a whole number, including an input parameter, an internal variable, or a highly complex mathematical formula that combines functions, input parameters, and internal variables together so long as the end result is a whole number rather than a decimal number.

Let’s multiply the close of the bar 20 bars ago by 1.03 to ensure that the current close price is at least 3% above the close of the bar 20 bars ago. To do this, click on the gear icon to the right of “The Bar 20 Bars Ago of Close” and choose “This Number * [A New Number]” and enter 1.03 in the text box. Note that while this arithmetic example is a simple multiplication, you can keep adding, subtracting, multiplying, and dividing terms together and use parentheses to change the order of operations of the arithmetic equation. Furthermore, each term in the arithmetic equation can be a very complex numeric expression made up of many expressions nested together, with each expression’s input parameters being set to other expressions whose input parameters are set to even more nested expressions, and where each expression can actually be a complex arithmetic combination of many terms, like the most complicated mathematical formulas that you’ve ever seen in any advanced math textbook. This ability to create incredibly complex expressions at a location where a single expression of a certain data type is expected works on all simple data types, such as dates, text, and Booleans, and it works on individual items in time series, lists, and arrays, not just numbers.

Now let’s also allow signals to occur if the current close price is at least 5% above the close of the bar 40 bars ago. Click on the condition we just made and choose “Add Condition After Me Using OR”. Since this filter is almost identical to the filter we just made, let’s just copy and paste the filter we just made on top of the empty condition beneath it, change “20” to “40”, and change “1.03” to “1.05”.

Let’s add parentheses around the “20 bars ago” and “40 bars ago” conditions so that they are evaluated as a group. Click on the “20 bars ago” condition, click on “Add Parentheses”, then click on the right parenthesis below the “20 bars ago” condition and click “Move Down”. Now the “20 bars ago” and “40 bars ago” conditions will be executed as a group instead of the “20 bars ago” condition being executed in an AND’ed fashion with the conditions above it, and the “40 bars ago” condition erroneously being considered by itself, which would likely cause an entry every single time the current close price is at least 5% above the close of the bar 40 bars ago.

Note that some codeless strategy builders only give you the choice of using either the “AND” operator or the “OR” operator in a given condition, but you cannot combine the two in the same condition. Quagensia lets you use the “AND” operator, the “OR” operator, and parentheses in the same condition to create much more advanced sets of conditions. Furthermore, while some codeless strategy builders do not allow you to nest sets of conditions inside of one another, Quagensia allows you to nest sets of conditions inside of other sets of conditions which can be further nested inside of even more sets of conditions.

Let’s take a look at what we just built. We now have a condition set that is checked every bar close that says “If our strategy is not in a position, i.e. it is flat, our fast moving average indicator variable crossed above our slow moving average variable while our fast moving average was going up, the last two bars have higher lows than their previous bars and the current bar’s close price is either more than 3% higher than the close price of the bar 20 bars ago or is more than 5% higher than the close price of the bar 40 bars ago, then do something”.

Let’s make it do something when this condition set is true.

First, let’s enter a long position with a market order by clicking the “Add Trading Logic” link that is directly beneath the “Then do the following…” header and choosing “Submit an Order” >> “Enter Long” >> “Enter Long Position Using A Market Order”. Change the “Quantity” field from a hard-coded number to the input parameter we created called “Order Quantity”.

Second, let’s draw a tiny diamond a little above the high of the signal bar by clicking the “Add Trading Logic” link that is directly beneath the action we just added and choosing “Draw Something” >> “Tiny Shapes” >> “Create New” >> “Draw Solid Diamond (◆)”. Then click on the color button in the “Color” input parameter of this action and choose a different color.

To draw the diamond a little above the high of the signal bar, the “Price” parameter needs to be set to the High of the Current Bar. If this is not already done by default, you can do this by choosing “Price Data” >> “High”.

Let’s multiply this number by 1.01 to draw the diamond 1% above the high. To do this, click on the gear icon to the right of “The Current Bar of High” and choose “This Number * [A New Number]” and enter 1.01 in the text box.

Let’s add one more action inside our “If” block. Let’s write a message to the EasyLanguage® Print Log window that includes the timestamp and the close price of the signal bar. Writing the values of certain variables to the EasyLanguage® Print Log window is one of the best ways to troubleshoot, or “debug”, strategies that aren’t working correctly inside of TradeStation®. So far we’ve always added actions by clicking the “Add Trading Logic” link at the end of all the other actions. This time, let’s insert this action above the “Draw Solid Diamond (◆)” action by clicking on the “Draw Solid Diamond (◆)” action and choosing “Add Item Before Me” >> “Output (Alerts and Logging)” >> “Print To Log / Output Window” >> “Print To Print Log (With Primary Data Series Time Stamp)”. This function automatically writes the timestamp, so we only need to write the close price of the signal bar.

First, type “Entry Close:” in the “Message” input parameter’s text box. To append the numeric close price of the signal bar as text to the end of the text “Entry Close:”, first click on the gear icon to the right of the text box and choose “This Piece of Text + [A New Piece of Text]”. A plus sign and an empty text box are added to the right of the first text box. To replace the empty text box with the close price of the signal bar, click on the gear icon to the right of the empty text box and select “Close” in the context menu under “Price Data”. When you do this, “The Close of The Current Bar” replaces the text box. Notice how “The Close of The Current Bar” on the canvas is wrapped inside of a function called “Convert Non-Text To Text”. Whenever you attempt to place a non-text expression, such as a number or date, at a location where text is expected, Quagensia will automatically wrap the non-text expression you selected inside of a “Convert Non-Text To Text” function so that your non-text expression will be automatically converted into text, allowing it to be used as text. One of the best things about Quagensia is that its validation system stops you from making serious mistakes like putting text where a number should go or putting a number where text should go. This is why whenever you click on a location that expects an expression of a certain data type, you will only see choices for expressions whose data types are compatible with the expected data type of the location, and Quagensia will automatically convert your selected expression into an expression with the expected data type of the location. If Quagensia didn’t do this, many bad things would frequently happen such as your strategies not compiling or not running within TradeStation®.

We’ve now finished our entry logic. Let’s create our exit logic, using copying and pasting as much as possible. First, we need an “Otherwise, If (Else If)” block beneath our “If” block by clicking on our “If” block and choosing “Add ‘Otherwise, If’ (Else If)” Block.

This is different from adding another separate “If” block, because the condition set in “Else If” blocks is only considered if the conditions in the “If” block and the conditions in all other “Else If” blocks above the “Else If” block are false, whereas the condition set in another separate “If” block is checked unconditionally. An “Else If” block is good in this case because if the entry condition is true on a bar and an entry order is placed, we don’t even want to check for the exit condition. If we did, we might attempt to enter and exit a position on the same bar, and this could cause unexpected behavior and therefore possibly trading losses.

Copy and paste the “Crossed Above” condition from the “If” condition set into the “Else If” condition set. Make sure you click on the inner gear icon in the “Else If” condition set, because the inner gear icon is for the empty condition we want to paste on top of whereas the outer gear directly to its right is the gear icon for the entire condition set, which if clicked won’t give you the option to paste a single condition. Change the comparison operator to “Crossed Below a Time Series”. Add an AND’ed condition above the condition you just pasted, and let’s set it to check if our strategy’s current position is “Long”. Copy and paste the “Market Position (Current) (As a Choice From a List: Long, Short, or Flat) Is Equal To Flat” condition from the “If” condition set into the “Else If” condition set, then change the drop-down list’s value from “Flat” to “Long” to check if we are currently long.

That’s it for our exit criteria. To exit the entire long position with a market order if the exit condition set is true, click on the “Add Trading Logic” link beneath the “Then do the following…” header and choose “Submit an Order” >> “Exit Long” >> “Flatten Long Position Using A Market Order”.

Let’s get the other actions into the exit block the quick way using a multi-action copy and paste. To do this, in the “If” block, click on the “Print To Print Log (With Primary Data Series Time Stamp)” action, choose “Start Multi-Selection Here”, then click the “Draw Solid Diamond (◆)” action and choose “Copy Selected Items”, then click on the “Add Trading Logic” link of the “Else If” block and choose “Paste”.

Note that while some codeless strategy builders have rather limited copy and paste functionality, Quagensia lets you easily copy and paste single expressions, single actions, and multiple actions within the same strategy, between two different strategies and between strategies and functions. In fact, the quickest way to make a Quagensia Function that you can use in all your Quagensia Strategies is to copy and paste some trading logic from a Quagensia Strategy into a new Quagensia Function.

When you do this, not only is the trading logic copied over, but even the input parameters of the Quagensia Strategy that are used by the trading logic are copied over, making it really fast to create a reusable Quagensia Function out of logic in a strategy, and then you don’t even need to copy and paste anymore, because the Quagensia Function shows up in context menus when you click on locations where the trading logic is valid.

Back to our strategy.

Let’s just change the “Entry Close:” text in the first pasted action to say “Exit Close:” so we will know if the output is for an entry or an exit. To finish up, let’s draw the diamond 1% below the low of the exit signal bar by replacing “The Current Bar of High” with “The Current Bar of Low” by choosing “Price Data” >> “Low” and changing 1.01 to 0.99.

Congratulations. You have now created a complete trading strategy.

We are now ready to generate our strategy’s code and copy it to the clipboard by clicking this button, so we can paste it into TradeStation®.

Before we do this, we need to open TradeStation® and the TradeStation® Development Environment.

We will be using TradeStation® 10 in this tutorial, but you could follow a similar procedure in TradeStation® 9.5 to accomplish the same thing.

Open up TradeStation® 10. Log in with the “Simulated Trading” button.

While TradeStation® is loading, it should be noted that Quagensia T Edition is a product of Quagensia, Inc., a company which has no affiliation with TradeStation Technologies, Inc.

Also, TradeStation® and EasyLanguage® are registered trademarks of TradeStation Technologies, Inc.

When TradeStation®’s main window opens, verify that you are using a simulated trading account, not a live account, by making sure that the account name displayed at the bottom of the window starts with “SIM”. Then, roll your mouse over the “Apps” menu item beneath the main menu and then click the “EasyLanguage®” button to open the TradeStation® Development Environment. Then, either create a new strategy in a new tab or select the tab of a pre-existing strategy whose text you want to replace with the code generated in Quagensia T Edition. To create a new, empty strategy tab from the main menu of the TradeStation® Development Environment, select “File” >> “New” >> “Strategy”, give your strategy a name, and set the value of the “Select Template” drop-down list to “(None)”. Delete any text in the strategy that you want replaced with code generated from Quagensia T Edition.

Now let’s generate our strategy’s code and copy it to the clipboard by clicking this button.

Then, paste your strategy’s code from the clipboard into the new strategy in the TradeStation® Development Environment. You can do this the same way that you would usually paste text, for instance by right clicking on the location where you want to paste your strategy’s code then selecting “Paste” from the context menu that appears, or by left clicking on the location where you want to paste your strategy’s code, clicking the “Edit” main menu, then selecting the “Paste” menu item, or by left clicking on the location where you want to paste your strategy’s code then holding down the Control key and pressing the V key.

Finally, click the “Verify” button in the toolbar at the top of the TradeStation® Development Environment in order to check for syntax errors and compile your strategy from plain text into a form that enables you to backtest, optimize, and trade your strategy in live markets from within TradeStation®.

Our trading strategy is now ready to be backtested and optimized from within TradeStation®.

From TradeStation®’s main window, open a daily chart for the symbol “SPY” for this tutorial. “SPY” is the symbol for the SPDR S&P 500 ETF, which is designed to track the S&P 500. To do this, roll your mouse over the “Apps” menu item beneath the main menu and then click the “Chart Analysis” button to open a new chart. Then, change the symbol to SPY by clicking on the chart, typing SPY, and pressing the “Enter” key. Then, click the chart, type the word “daily”, and press the “Enter” key. Now, load 10 years of daily bars by clicking the on the chart, typing “10 years”, and clicking the “Enter” key.

Let’s also open the EasyLanguage® Print Log by clicking on the “View” main menu and selecting “EasyLanguage® Print Log”. This is where our “Print To Print Log” actions will print messages.

In order to backtest our strategy on the data loaded in the chart, we need to add our strategy to the chart. To do this, first click on the “Studies” menu item in the toolbar above the chart and select “Add Strategy…” Then, select our strategy from the list in the “Add Strategies” window that appears and click “OK”. This opens up the “Customize Studies & Strategies” window, highlights its “Strategies” tab, and adds our strategy to the list of strategies that will be applied to the chart. In this example, our strategy is the only one that we will be applying to the chart.

We want our backtest to include realistic commission and slippage, so click the “Properties for All…” button to open the “Strategy Properties for All Strategies on this Chart” window, then in its “General” tab enter a realistic amount of commission and slippage based on your experience and click “OK”. For this tutorial, we will use a commission of $4.95 and a slippage of $0.02 per share.

Back in the “Customize Studies & Strategies” window, with your strategy selected, click the “Customize” button. This opens the “Customize Strategy” window for our strategy. Select this window’s “Inputs” tab if it is not already selected. There are six input parameters displayed in this list. All of them can be manually changed from this window. The first three input parameters are the ones we created in the “Input Parameters” section of our strategy in Quagensia T Edition. The other three input parameters will be explained shortly.

Now, run the backtest by clicking “OK” to close the “Customize Strategy” window for our strategy and click “Close” or “OK” in the “Customize Studies & Strategies” window.

Our backtest was successfully executed by TradeStation®, as can be seen by the fact that our chart now shows trades on it.

If you don’t see any trades on the chart, something went wrong.

First, maybe the chart’s market data is the problem. Make sure that you are plotting 10 years of daily bars for the symbol “SPY”. Second, maybe there are trades on the chart, but you need to scroll your chart horizontally to find a bar on which a trade occurred. Third, maybe TradeStation® encountered an error during the backtest, which TradeStation® may alert you of in a dialog box or which may appear as an error in the “EasyLanguage® Print Log” tab that we opened earlier. If no errors are displayed in the print log, maybe the logic of your Quagensia T Edition Strategy is wrong. For instance, maybe the condition that must be true to enter a position will never be true in any scenario, or maybe the condition is too strict such that it is so rarely true that it wasn’t true even once between the start date and end date of your backtest.

When you are trying to troubleshoot, or debug, your strategy’s trading logic, you can use “Print To Print Log” actions just like we did in our strategy to print output to the EasyLanguage® Print Log to first determine if and on what price bars or ticks a given “If”, “Else If”, or “Else” block’s condition set is true and second to determine the values of prices, indicators, and variables at a given point in your strategy’s logic on each price bar or tick where the “Print To Print Log” action was executed.

When we look at the EasyLanguage® Print Log we can see the dates and times of the price bars when entries and exits occurred, and we can see the close prices of those bars, because this was part of the logic that we added to our Quagensia T Edition Strategy.

Before we look at the backtest results of our strategy, notice that the indicator plots we configured in Quagensia’s “Internal Variables” section are only plotted on the last 100 bars. This is because the “QS_ShowPlots_NumberOfBarsBack” input parameter of our strategy was set to 100, which is its default value. Our strategy also has a “QS_ShowPlots” input parameter, which allows you to turn off the custom plots for these two indicators entirely. Enter the word “false” to turn off these custom plots or “true” to turn them back on. Our strategy also has a “QS_ShowCustomDrawnObjects” input parameter, which allows you to turn off all other custom drawn objects on the chart, such as the solid diamonds that we are drawing from our strategy.

We will discuss the reason for these three additional input parameters in a minute, but first let’s manually add the same moving average indicators with the same input parameters as those in our Quagensia Strategy to the chart from within the TradeStation® user interface. To do this, click the “Studies” menu and select “Add Study…” and add the indicators from the window that appears. We used a 3-bar weighted moving average and a 6-bar triangular moving average in our Quagensia Strategy, so we can select the “Mov Avg Triangular” indicator, then select the “Mov Avg Weighted” indicator while holding the control key down to allow us to select two indicators at once, then click “OK”. The indicators are then plotted on the charts, but with the wrong input parameters. To fix this, double click on each of the indicators, one at a time, and enter the correct input parameters in the window that opens for each indicator. Notice how the plots configured from within Quagensia appear to have the same values as the indicators we manually added from within TradeStation®’s user interface for the last 100 bars which is what we would expect.

Getting back to the discussion of the last three input parameters of our strategy, the reason Quagensia T Edition added these last three input parameters to our strategy is because plotting a time series or thousands of other custom drawing objects from within a TradeStation® EasyLanguage® strategy is a highly resource-intensive operation and can greatly slow down a chart to which your strategy is applied and can even cause TradeStation® to freeze. Due to this issue, the plots you configure in Quagensia T Edition will only be drawn on the last 100 bars of the chart by default. If you want to draw the plots on the bars that are further back in history, you can increase the value of the “QS_ShowPlots_NumberOfBarsBack” input parameter.

Note that the further back in history you choose to draw your plots, the more your charts will slow down and the greater the danger that TradeStation® will freeze.

Despite the performance impact that plotting time series has on TradeStation® charts, it is still valuable for a few reasons. First, plotting your time series on the last few hundred bars is a great help while you are creating a strategy since it helps you visualize the time series on which your strategy’s logic depends so you can ensure that your times series’ values appear to be correct. Second, these plots are particularly useful when you trade your strategy in live markets since when you are trading live you are likely to only be interested in the last few hundred bars anyway. Third, even if you need to plot your time series on thousands of bars at once because you are backtesting on a large amount of data and need to check the values of your time series thousands of bars ago, you should still be able to do this on a reasonably powerful computer, but the chart will slow down greatly. Once you are done visually checking your time series’ values on thousands of bars of data, you can then make your charts fast again by either changing the “QS_ShowPlots_NumberOfBarsBack” input parameter to a small number again or you can turn off all plotting by changing the value of the “QS_ShowPlots” input parameter to “false”.

If the time series you are plotting from your strategy is based on a Quagensia T Edition Function that has a corresponding TradeStation® indicator in TradeStation®’s “Add Study” window as in this example strategy, it is recommended that once you have visually inspected the custom plot of your time series to ensure that your times series’ values appear to be correct, you should add the TradeStation® indicator manually to your chart from the “Add Study” window as we just did and then either turn off the custom plotting of your time series or reduce the number of bars that your strategy is plotting as just described.

The great thing about replacing your custom plotted time series with manually added TradeStation® indicators from TradeStation®’s “Add Study” window whenever possible is that the TradeStation® platform’s plotting of manually added TradeStation® indicators doesn’t slow down the charts like custom plotting of a time series from a strategy does. Another benefit of adding an indicator to the chart from within the TradeStation® user interface to replace or augment the plot drawn by the Quagensia plotting code is that plots drawn by the Quagensia plotting code can only plot through the last bar if “Intra-Bar Order Generation” is set to “true” for your strategy, either from the Quagensia user interface or from the TradeStation® user interface, whereas indicators added to the chart from within the TradeStation® user interface are able to plot through the last bar on the chart regardless of whether Intra-Bar Order Generation is set to “true” or “false”.

It still makes sense to plot the last 100 bars or so of your time series separately from the indicator plot, however, because this helps you verify that the values of the time series your strategy’s logic are actually using match those of the indicators you intended to use in your strategy’s logic. This should always be the case if you selected the indicator that you intended to from within Quagensia, but this extra check allows you to ensure that you didn’t accidentally select the wrong indicator from within Quagensia.

Let’s take a quick look at the backtest results of our strategy, bearing in mind that they are only hypothetical performance results obtained with the benefit of hindsight and are not necessarily representative of the actual trading results that would be achieved by trading this strategy in actual markets. Also, note that we do not offer trading advice, so the example strategy we built for this tutorial and our commentary on its backtest results are meant for educational purposes only and should not be construed as a recommendation to trade using any particular strategy or as a recommendation to buy or sell any particular instrument. Finally, note that trading and investing in the financial markets can involve a high degree of risk of financial losses, including losing your initial investment or more.

Now, let’s look at the backtest results of the strategy we just built by clicking the “Data” menu above the chart and selecting “Strategy Performance Report”.

The backtest results screens on each of the tabs of TradeStation®’s “Strategy Performance Report” window contain a wealth of valuable information and deserve many tutorial videos, but for the purposes of this video, we will only take a cursory look at two of them.

First, the “Performance Summary” tab gives us a high-level view of our backtest results. A key metric is “Profit Factor”. It is the ratio of gross profit and gross loss. If it is less than 1, our trading strategy lost money. And if it is barely above 1, the gross profit is barely above the gross loss on a percentage basis, so it lost almost as much as it gained.

Now, let’s look at the equity curve of our strategy over time by choosing the “Performance Graphs” tab at the bottom of this window then selecting “Equity Curve Detailed” in the drop-down list in the upper left-hand corner of this window. As you can see, while our strategy was slightly profitable, it did not perform well until the very end of the backtest period.

Finally, let’s close this window and take a closer look at the chart with our strategy’s trades displayed on it. Here we can see that the indicators we configured in our Quagensia Strategy are displayed on the last 100 bars on the chart, and we can see that our strategy entered and exited long positions based on our criteria.

Note that the positions are entered and exited on the price bar directly after the signal bar, not on the signal bar itself.

This is correct and follows the basic principle that if we submit a market order based on a signal occurring on a bar close or tick, our market order won’t get filled on that bar close or tick because the bar close or the tick occurred in the past. Instead, the soonest our market order could possibly be filled would be directly after the bar close or tick event occurred. In a backtest, this will be on the bar open of the next bar or the next tick. In actual markets, even this cannot be assumed.

Now that we have backtested our strategy using a fast moving average period of 3 and a slow moving average period of 6, let’s quickly run many backtests of our strategy, but using different values than 3 and 6 for our input parameters. To do this, we need to open the “Edit Strategies” window by clicking on the “Studies” menu item above the chart and selecting “Edit Strategies…” With our strategy selected, click “Customize…”, click on the “QX_FastMAPeriod” input parameter, click the “Optimize…” button, set the “Start” and “Stop” values to 3 and 15, and click “OK”. Then, click on the “QX_SlowMAPeriod” input parameter, click the “Optimize…” button, set the “Start” and “Stop” values to 6 and 30, and click “OK”.

Then, click “OK” in the “Customize Strategy” window and click the “Optimize” button in the “Customize Studies & Strategies” window.

That was fast. This video was not sped up. TradeStation® just backtested our strategy with 325 combinations of fast and slow moving average lengths in under ten seconds. When you do this, the strategy is reloaded on the chart but using the input parameters that produced the backtest results that the optimization process determined were the “most optimal” based on the optimization criteria that the optimization process used to order the 325 variations of our strategy from “most optimal” to “least optimal”.

Before we look at the optimization results, it must be stated that not only are these results hypothetical, but that the “most optimal” of the 325 variations of our strategy were determined by searching over a large number of strategy backtests. So even if our strategy is non-predictive it is likely that at least some of its 325 variations produced highly profitable backtest results merely by chance.

With that said, let’s view our optimization results. To do this, open the “Strategy Optimization Report” window by clicking the “Data” menu above the chart and selecting “Strategy Optimization Report”. Each row displayed in the grid in this window represents a separate backtest of each of the 325 variations of our strategy’s input parameters. You can sort these backtests by a column’s values by double clicking the column header to sort them on different optimization criteria. To load a different variation of our strategy into the main chart window, right click a row and select the “Apply Test to Chart” context menu item.

Congratulations. You have now created, backtested, and optimized a complete trading strategy, albeit a very basic one.

Due to lack of time, we barely scratched the surface of the kinds of advanced algorithmic trading strategies you can easily build in Quagensia T Edition without code by simply clicking choices on the screen. Advanced features are covered in other tutorials.

It’s the advanced features of Quagensia T Edition that most set it apart from other codeless strategy builders.

For instance, while some codeless strategy builders don’t allow you to extend their functionality by creating your own functions without code, Quagensia makes this easy and even lets you create functions that call other functions that call even other functions, which allows you to build an increasingly powerful library of trading logic components that grows with you.

Also, while most codeless strategy builders don’t support loops, Quagensia makes it easy to create multiple types of loops without code, and you can even create loops inside of loops inside of other loops.

Also, most codeless strategy builders don’t have any support for lists, single-dimensional arrays, and multi-dimensional arrays of data, but Quagensia makes it easy to use these advanced data types without code by simply clicking choices on the screen. You may not start out using lists, arrays, and loops on day one, but soon enough you will probably find out that the use of lists, arrays, and loops is often the only way to accomplish an intermediate or advanced level task, and you will realize that the lack of support for lists, arrays, and loops would severely limit your ability to create many kinds of advanced trading strategies.

Also, unlike most codeless strategy builders, since Quagensia T Edition supports arrays and lists, intermediate-level users will find it easy to codelessly create the equivalent of in-memory data tables using parallel arrays or lists and then create, modify, and delete the equivalent of rows of data using the parallel arrays or lists like data tables, and then write this data to data files on disk. This allows you to run a backtest or optimization of a TradeStation® strategy that outputs a report containing tabular data that you can load into any database, use as input data in MATLAB® or R, or load into Microsoft Excel to manipulate further and use to create visually powerful charts and graphs that answer your questions about the markets in ways that backtest performance reports cannot, all done codelessly by simply clicking choices on the screen.

To learn more about the other powerful features of Quagensia T Edition, go to Quagensia.com, and watch our other videos where you will learn how to create strategies with far more advanced, interesting logic than the basic one we just built.

You will see how Quagensia T Edition really shines when it comes to enabling you to create advanced, complex trading strategies that are better able to model your most complex trading ideas.

If you haven’t downloaded and installed the Quagensia T Edition free trial, go to Quagensia.com and download it today.

Use the free trial period to create as many algos as you can because they are yours to keep after the free trial ends.

When you download the free trial you will also get all our free no-code trading strategies which you can use as-is and customize without code.

Have a great day.

Submit your high-quality Quagensia tutorials for consideration for free inclusion on our website.

If you publish high-quality Quagensia tutorials on a social media platform like YouTube, please consider submitting them to us. We may promote them for free by linking to them from relevant pages on our website.

To submit your Quagensia tutorials for consideration for free inclusion on our website, use the How to Submit Your Quagensia-Enhanced Content page. We are available by phone or email to help you create, publish, and promote Quagensia-enhanced content. You can also get questions answered in our Content Creator Support Center and in the official Quagensia® Discord community’s content-creators channel.

Thanks for Sharing!

Ready to get started?

Download the Quagensia no-code strategy builder free trial and build your trading strategies now.

Under a dollar a day.

Priced to be an easy decision for most traders.

Join Us on Discord

Build point-&-click strategies for NinjaTrader® and TradeStation® using Quagensia®. Collaborate with other traders to get and give help, build and backtest strategies together, and grow your skills.

Subscribe to our Newsletter

We'll send you product updates and company news from Quagensia as well as curated lists of Quagensia-enhanced content.

Welcome
Content Creators

Quagensia enables content creators to make interactive content. We invite you to create Quagensia-enhanced content and share it on YouTube and other social media channels. You may submit your high-quality Quagensia-enhanced content for consideration for free inclusion on our website.

Screenshots

For larger and additional screenshots, see large Quagensia N Edition screenshots (for NinjaTrader®) and large Quagensia T Edition screenshots (for TradeStation®).

For additional screenshots, see the list of Strategies Built into Quagensia N Edition (for NinjaTrader®) and Strategies Built into Quagensia T Edition (for TradeStation®). Select a built-in strategy that interests you and scroll down for the screenshot. Then scroll up to the top of the page and click the “Overview” link to watch the video on how to use that built-in strategy.

This is a screenshot of the point-and-click trading strategy you will build in Quagensia N Edition (for NinjaTrader®) if you follow along with the video titled Create NinjaTrader® Strategies Using Point-&-Click with Quagensia N Edition – Full Tutorial.

This is a screenshot of the point-and-click trading strategy you will build in Quagensia N Edition (for NinjaTrader®) if you follow along with the video titled "Introduction to Quagensia N Edition".

Click the gear icon that appears when you place your mouse pointer over the location to which you would like to add trading logic. A context menu will appear with filtered options to choose from.

Click the gear icon that appears when you place your mouse pointer over the location to which you would like to add trading logic. A context menu will appear with filtered options to choose from.

Thanks for Sharing!

Ready to get started?

Download the Quagensia no-code strategy builder free trial and build your trading strategies now.

Under a dollar a day.

Priced to be an easy decision for most traders.

Join Us on Discord

Build point-&-click strategies for NinjaTrader® and TradeStation® using Quagensia®. Collaborate with other traders to get and give help, build and backtest strategies together, and grow your skills.

Subscribe to our Newsletter

We'll send you product updates and company news from Quagensia as well as curated lists of Quagensia-enhanced content.

Welcome
Content Creators

Quagensia enables content creators to make interactive content. We invite you to create Quagensia-enhanced content and share it on YouTube and other social media channels. You may submit your high-quality Quagensia-enhanced content for consideration for free inclusion on our website.