Tuesday, June 17, 2014

About Trading with Linux

This blog is about trading with Linux, software tip and trick to trade with Linux, and other trading information. I have used Linux of different varieties off and on for many years, but have had to revert back to some flavor of Windows for certain programs and especially for trading software. Today I am using Ubuntu 9.10 as my operating system and it looks like I am here to stay this time. I have managed to get my favorite trading programs to work and see no reason to go back to Windows any more!!!!

Ubuntu 9.10 was extremely easy to install and setup for normal computer operation, but setting up some of the trading software was not that easy. I found it difficult to find simple instructions for setting up some of the programs need to run trading applications written for other operating systems. So, I will attempt to provide you with the information in a clear and detailed manor. I am not an expert in Linux but I will show you what I did for my system and trading platform. I hope this will help you with you systems and trading platforms.

Option trading is my preferred method of trading and TD Ameritrade is my trading platform. I knew to make the switch to Linux I would have to be able to use both the Think or Swim and StrategyDesk trading platforms. Getting the Think or Swim platform running was not very difficult at all since it is a Java based application. It only requires the installation of the Java runtime environment and the Think or Swim software. I have found no differences in the functioning of this software between operating systems. StrategyDesk is a favorite of mine for testing different strategies and getting trading alerts. I also like the ability of making my own indicators in StrategyDesk. The setup of StrategyDesk is a bit more complicated since the software is written for Windows it requires the use of Wine and a few Wine Tricks to get it up and running. I now have it up and running and with full functionality. I decided for each of the installs I will provide a written description and a screen capture video of what was done.

I would also like to share trade strategies and techniques with anyone interested. I like back testing different strategies. I find it always interesting to see what other people are trying. So, I would appreciate any comments or strategies you have developed or systems you find that work well.

How to Make a Simple Indicator in ThinkorSwim

This is a simple buy arrow indicator program to help teach a few basic concepts on how to make indicators for the ThinkorSwim platform. Our indicator will place an arrow on the chart when the simple moving average crosses above a weighted moving average. We will be able to adjust the length of the moving averages to test different parameters but we will set it up with 5 and 9 as our default values. Lets get started! The first things you need to do is start-up your ThinkorSwim platform and open the chart tab. Now click the Edit Studies button at the top of the chart.

The Studies window will open. Now click the New... button at the bottom left corner of the window. This will open the space we need to write our program.

At the top is a Studies Name box type in a name for your study I used SMA_X_WMA . There is default code in the window "Plot Data = Close;" you need to delete this code and write our code in its place.
The first line is # SMA_X_WMA this is a comment and is not used by the computer it is only there to help the programmer or people trying to understand the code.
The next two lines provide input to the program. This allows the user to make changes to the length of the moving averages. Type:

input SMA_Length  = 5;
input WMA_Length = 9;
These two line define variables SMA_Length and WMA_Length and assign a default value for each. Note do not forget the ; at the end and I used the _ since spaces are not allowed in variable names.
Next we Define two more variables avg and wavg Type:

Def avg = Average(Close, SMA_length);
Def wavg = wma(close, WMA_length); 
The first line defines the simple moving average of the close for the length provided by the SMA_Length variable. and the second line defines the weighted moving average of the close over the length provided by the WMA_Length variable.
Now we need to plot our arrows on the chart. We do this by Typing:

plot crossing = avg > wavg and avg[1] <= wavg[1];
This code provides the logic used for our indicator it is saying if the simple moving average crosses above the weighted moving average and that it was previously below then it will draw crossing on the chart. The last bit of code will define what gets plotted on the chart. Type:


Now you can Click the OK button the lower right of the window this takes us back to the Studies window.

Now you can select any changes to the parameters that you want to change. Next click Apply and then OK to see your indicator on the chart.

This is Not Trading Advice only information on how to make a simple indicator.

Installing ThinkorSwim on Ubuntu 9.10

-->How to setup Think or Swim in Ubuntu 9.10
First of all the Think or Swim platform is a Java based program so it is important to install some programs prior to installing Think or Swim. Also please note my account is with TD Ameritrade so I will be installing their version of Think or Swim.
Step 1. Finding needed files
The fist step Is to install Java on your system.
The easy graphical user interface way is with the Ubuntu Software Center found. In the Applications Menu all the way at the bottom.
Go ahead and click on it now to bring up its dialog box.

This box will appear.

Step 2. Installing Java

In the search box at the top right type in Java. Then install OpenJDK Java 6 Runtime or Sun Java 6 Runtime either should work I am using OpenJDK.
To install click the arrow to the right and in the new window click on install Ubuntu will install the software.
I would also recommend install the Ubuntu Restricted Extras provides support for many programs like Java and Flash.

Step 3. Downloading ThinkorSwim

Now it is time to download the software. I am downloading from the TD Ameritrade website.
The software is in the Trading Tools menu.

Click Trading Tools then Click on the ThinkorSwim link and then Click on Learn More. Scroll down the page to the All Other Platforms Instructions and Click Install.

The download dialog box will open select Save File and OK.

The file will now be saved to your default download location. In my case the Desktop.
Yours may be in the download file or some other if it is not on the Desktop. Move it to the Desktop.

Step 4 Setting Permissions

This can be performed at the terminal fairly easily but I am trying to use the GUI as much as possible.
Right Click the thinkorswim_other_installer.sh you downloaded or moved to your Desktop.
Click Properties in the drop down menu.

The Properties dialog box will open now Click on the Permissions tab.
Select Read and Write for Group and Other and Check the box to Allow executing file as program

Your Dialog Box should look like this now Click Close.

Step 5 Installing ThinkorSwim

-->Double Click the thinkorswim_other_installer.sh file on the Desktop.
A dialog box will appear Click on Run to start the install.

The ThickorSwim install wizard will start. Now you can install the same as in any other operating system.

Congratulations you should now have a working ThinkorSwim platform on your Ubuntu 9.10 System