top of page
TradeStation Script


We assume that you're using TradeStation 10.0. Some terminology has changed since previous versions, so we’ll stick to this most recent version. Also, we have provided one indicator and one strategy, both called, “UltraAlgo.”

In this document we’ll do four things:

  1. Load the indicator “UltraAlgo” (USE FOR MANUAL TRADING)

  2. Load the strategy “UltraAlgo” (USE FOR AUTOMATED TRADING)

  3. Load the indicator “Strategy Equity,” a useful help to monitor the performance of the strategy

  4. Activate the strategy "UltraAlgo" to execute automated trades

Step 1.
Loading Indicator

Please reference the section named “Studies”. This opens a window that we’ll use to add the indicator, the strategy, and to make changes to them (including the optimizer, only available for the strategy).


Click on “Add Studies” and go down the page until you find “UltraAlgo.’ Then Press "OK".


The chart will show that the indicator has been added.


You can modify the settings in the indicator by doing a similar process to what was done for loading it: you go to “Studies” and select “Edit Studies.” It will open a window “Customize Studies & Strategies,” shown below. 

Click on the indicator “UltraAlgo” and it will highlight “Customize.” You can click “Customize” now.


This will open another window that will allow to change the parameters manually by entering values in the corresponding fields.

In the windows below, notice how the default parameters "Gain," "number_stdev," "Bars_enter_UltraBull" and "Bars_enter_UltraBear" have been changed to new values. If you click “OK” and also click on “Close” at the “Customize Studies & Strategies” window, the new settings will be applied to the stock.


Below are the results of changes applied in the "number_stdev" values and "length" (referenced above). Specifically, notice that more trades are listed on the chart.

Step 2.
Loading Strategy

In this section, we can remove the indicator, as the strategy performs exactly the same way, but allows us to trade and do more automatic optimizations.

To remove the indicator, we go to “Studies,” “Edit Studies,” select “UltraAlgo”, and click on the “Remove” option to the right.


The procedure to load a strategy is similar to loading an indicator. We go to “Studies” and select “Add Strategy”. Look for “UltraAlgo.”


Click “OK.” This will open another window …


Click “OK” and the strategy can be seen applied to the stock.


Step 3.
Adding Strategy Equity

To see the performance of the strategy, add the indicator “Strategy Equity.” Go to “Studies”, “Add Studies,” and select “Strategy Equity.” After that, press “Import.”


The performance of the strategy is shown at the bottom of the screen: green bars for the gains, red bars for the losses.


Applying Optimizer

Instead of modifying the parameters of the strategy manually, as we did earlier with the indicator, we can use the computer to execute an optimizer and modify many parameters at once. (The optimizer works only with strategies, not with indicators.)

Open “Studies,” “Edit Strategies,” “Customize.” (left)

The following window pops up (right)


Let’s assume that we want to modify "Gain" [default: 2] and see how it behaves if we change it from 1 to 7 in steps of 1. The same for "number_stdev," changing from 2 to a range going from 1 to 5, also in steps of 1. Overall, the changes to the parameters can be shown in the following table:


(Please notice that in this case we’re optimizing many parameters simultaneously and it will take a few seconds for the test to complete.)

To execute the changes, in the “Customize Strategy: UltraAlgo” window, click on the value to be modified, for example, in Gain, it will be the number 2.


Now click “Optimize …”A little window will pop up and you will be able to place the Start, Stop, and Increment values.

Click "OK." The new parameters will be shown in the screen (right).


You can continue in the same fashion with the rest of the parameters. In the end, they will look identical to the screen listed below. Once you’re satisfied with the changes, click “OK.”


The window for “Customize Studies & Strategies” will show the options for the optimizer along with the total number of runs to be made (7,700 in this case).


Click on “Optimize.” The process starts and it shows that it will take some 47 seconds to be completed. We can see how the performance and the value of the parameters are updated continuously, as the optimizer finds new combinations that maximize the profit.


The results of the run with the new parameters can be seen below, and the profits are surely higher than before. Compare the first chart at a profit of $1,409 to the new profit of $2,319.

Step 4.
Activate Trading Automation

To enable automated execution for the strategy, we navigate to “Studies,” “Edit Strategies,” select “UltraAlgo”, and check the box “Automate execution using..” option to the bottom of the pop-up.


[Not Required] To modify the Automation Logic, select "Properties for All". Navigate to "Automation" and depending on the rate of trading and volatility, modify the boxes below "Strategy will fill non-historical orders based on price activity" to any desired range such as 15 seconds or less / more.

To continue, select "OK."


If customers choose to automate trading, they will be required to electronically confirm that they understand the disclaimers. It's important to be aware that past performance is not a guarantee of future performance. We also highly recommend that customers leverage simulated trading to validate any strategies. To continue, select "I Agree."


When strategy trading is activated the top right will display "SA" in Green, when disabled the color will turn Grey. Right click on the top right "SA" box to deactivate strategy trading.


Below is a video on how to execute the strategy for automated trading.

Additional Considerations

With this strategy customers have the ability to focus exclusively on Bullish or Bearish trades, therefore not needing to meet margin account requirements. In addition, we've included features that permit trades to be closed at the end of the day or run indefinitely. 

Installation Videos

Getting Started | Automated Trading in TradeStation

Getting Started | Executing Automated Trading in TradeStation

Getting Started | Strategy Optimization with Pyramiding in TradeStation

bottom of page