Well it happened again. I had four analysis techniques open in my TradeStation Development Environment and my TS crashed and when I went back to work after restarting they were all garbage. The easiest way to back up your code is to have NotePad open and while working on your EasyLanguage copy and past your code into a NotePad file. Do this in stages and if you like you can keep different revisions. If you don’t want to keep revisions just select all and replace with the code you are copying from the TDE. Make sure you copy your final changes so that you can archive this in a separate folder and store it on your computer, flash drive or the cloud. Remember TradeStation stores your analysis techniques in one big library glob. If that glob gets corrupted and you don’t back up your TradeStation periodically, then you run a chance of losing all of your hard work. So definitely back up TradeStation automatically using their software and also back up your coding in a NotePad file.
For all of you who want to open multiple text files from within VBA here is the code that will do just that. Here I open a Open File Dialog and enable multiple file selection. I then parse the return string to gather the path and individual file names. The data is then processed – I am looking for a file with a date and a value separated by a comma. You can basically do anything you want with VBA and you also have the EXCEL functions right at your fingertips. Plus output to a worksheet is ultra simple.
Set fd = Application.FileDialog(msoFileDialogOpen)
With fd
Set ffs = .Filters
With ffs
.Clear
.Add "CSV Data", "*.csv; *.txt"
End With
.AllowMultiSelect = True
If .Show = False Then Exit Sub
fcnt = 0
maxDate = DateValue("01/01/1900")
minDate = DateValue("12/31/2200")
prevSymbol = "**"
dateNewestToOldest = False
For Each it In fd.SelectedItems
fcnt = fcnt + 1
filePath(fcnt) = it
fileName(fcnt) = Right(filePath(fcnt), Len(filePath(fcnt)) - InStrRev(filePath(fcnt), "\"))
symbol(fcnt) = Left(fileName(fcnt), 2)
Set DataHolder = New DataClass
If symbol(fcnt) <> prevSymbol Then symbolHolder.Add symbol(fcnt)
prevSymbol = symbol(fcnt)
dataCnt = 0
Open filePath(fcnt) For Input As #1
rowNumber = 1
Do Until EOF(1)
Line Input #1, lineFromFile
dataCnt = dataCnt + 1
If dataCnt > skipLines Then
lineFromFile = Replace(lineFromFile, " ", "")
lineItems = Split(lineFromFile, ",")
numItems = UBound(lineItems) - LBound(lineItems) + 1
isDash1 = InStr(lineItems(0), "-")
isSlash1 = InStr(lineItems(0), "/")
If isDash1 > 0 Or isSlash1 > 0 Then
inputDate = CDate(lineItems(0))
Else
myYear = Left(lineItems(0), 4)
myMonth = Mid(lineItems(0), 5, 2)
myDay = Right(lineItems(0), 2)
inputDate = DateSerial(Left(lineItems(0), 4), Mid(lineItems(0), 5, 2), Right(lineItems(0), 2))
End If
If dataCnt > 1 Then
If inputDate < tempDate Then dateNewestToOldest = True
End If
If inputDate > maxDate Then maxDate = inputDate
If inputDate < minDate Then minDate = inputDate
Set DataHolder = New DataClass
DataHolder.SymbolName = symbol(fcnt)
DataHolder.SymbolNum = fcnt
DataHolder.EquDate = inputDate
DataHolder.EquVal = lineItems(1)
myEquityCollection.Add DataHolder
tempDate = inputDate
End If
Loop
Close #1
Next it
End With
Advanced Topics Edition just added to Easing Into EasyLanguage Series
Foundation Edition Cover
Hello to All! The Easing Into EasyLanguage Series is now complete with the publication of the Advanced Topics Edition. This series includes three educational editions. Start out with the Foundation Edition. It is designed for the new user of EasyLanguage or for those you would like to have a refresher course. There are 13 tutorials ranging from creating Strategies to PaintBars. Learn how to create your own functions or apply stops and profit objectives. Ever wanted to know how to find an inside day that is also a Narrow Range 7 (NR7?) Now you can, and the best part is you get over 4 HOURS OF VIDEO INSTRUCTION – one for each tutorial. All source code is available too, and if you have TradeStation, so are the workspaces. Plus you can always email George for any questions. george.p.pruitt@gmail.com.
Hi-Res Edition Cover
This book is for those that have read the Foundation Edition or have some experience working with EasyLanguage and the various functions that help make a trading decision. This book’s audience will be those programmers that want to take an idea, that requires an observation of intraday market movements to make a trading decision, and program it accurately. If you have programmed daily bar systems, and you want to drill down and add some components that require additional market information (like what came first – the high or the low), then you have come to the right place. If you want to buy and sell short in the same day and use trade management principles such as profit targets and stop losses then The Hi-Res Edition is the book you need. There are two paradigms that EasyLanguage covers: daily and intraday bar programming. It’s the same language, but the move from daily to intraday programming can be quite difficult. Learn all the essentials and shortcuts with this edition. 5 HOURS OF VIDEO INSTRUCTION in this Hi-Res edition – one for each tutorial. All source code is available too, and if you have TradeStation, so are the workspaces. Plus you can always email George for any questions. george.p.pruitt@gmail.com.
Advanced Topics Cover
Advanced Topics (AT) could cover a vast amount of ideas and concepts and be the length of “War and Peace” on steroids. Since this book is part of the series, I wanted to cover a handful of concepts that included the follow programming constructs. Arrays and their manipulation. Buffers (fixed length arrays) and the tools to maintain buffer elements with formulas for extraction and sorting. Finite State Machines using the switch-case construct and range based case values. Using original text graphic objects and retrieving and analyzing their properties to determine X and Y coordinate values of text location. Seasonality: The Ruggiero/Barna Universal Seasonal and the Sheldon Knight Seasonal methods. In AT, you will also find an introduction to EasyLanguage’s Project Concept and the steps to create one by adding/deleting component files. Learn also how to import and export projects. TradeStation now provides access to fundamental data such as Commitment of Traders – learn how to convert the Net Change indicator into a strategy utilizing the FundValue functionality. If you wanted to find out how to merge multiple time frames into a single indicator, you are in luck! Create a MTF indicator for yourself.
Pick up your copies today – e-Book or paperback format – at Amazon.com