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
VBA code to open multiple text files
Backtesting with [Trade Station,Python,AmiBroker, Excel]. Intended for informational and educational purposes only!
Get All Five Books in the Easing Into EasyLanguage Series - The Trend Following Edition is now Available!
Announcement – A Trend Following edition has been added to my Easing into EasyLanguage Series! This edition will be the fifth and final installment and will utilize concepts discussed in the Foundation editions. I will pay respect to the legends of Trend Following by replicating the essence of their algorithms. Learn about the most prominent form of algorithmic trading. But get geared up for it by reading the first four editions in the series now. Get your favorite QUANT the books they need!
This series includes five editions that covers the full spectrum of the EasyLanguage programming language. Fully compliant with TradeStation and mostly compliant with MultiCharts. 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.
This book is ideal for those who have completed the Foundation Edition or have some experience with EasyLanguage, especially if you’re ready to take your programming skills to the next level. The Hi-Res Edition is designed for programmers who want to build intraday trading systems, incorporating trade management techniques like profit targets and stop losses. This edition bridges the gap between daily and intraday bar programming, making it easier to handle challenges like tracking the sequence of high and low prices within the trading day. Plus, enjoy 5 hours of video instruction to guide you through each tutorial.
The Advanced Topics Edition delves into essential programming concepts within EasyLanguage, offering a focused approach to complex topics. This book covers arrays and fixed-length buffers, including methods for element management, extraction, and sorting. Explore finite state machines using the switch-case construct, text graphic manipulation to retrieve precise X and Y coordinates, and gain insights into seasonality with the Ruggiero/Barna Universal Seasonal and Sheldon Knight Seasonal methods. Additionally, learn to build EasyLanguage projects, integrate fundamental data like Commitment of Traders, and create multi-timeframe indicators for comprehensive analysis.
The Day Trading Edition complements the other books in the series, diving into the popular approach of day trading, where overnight risk is avoided (though daytime risk still applies!). Programming on high-resolution data, such as five- or one-minute bars, can be challenging, and this book provides guidance without claiming to be a “Holy Grail.” It’s not for ultra-high-frequency trading but rather for those interested in techniques like volatility-based breakouts, pyramiding, scaling out, and zone-based trading. Ideal for readers of the Foundation and Hi-Res editions or those with EasyLanguage experience, this book offers insights into algorithms that shaped the day trading industry.
For thirty-one years as the Director of Research at Futures Truth Magazine, I had the privilege of collaborating with renowned experts in technical analysis, including Fitschen, Stuckey, Ruggiero, Fox, and Waite. I gained invaluable insights as I watched their trend-following methods reach impressive peaks, face sharp declines, and ultimately rebound. From late 2014 to early 2020, I witnessed a dramatic downturn across the trend-following industry. Iconic systems like Aberration, CatScan, Andromeda, and Super Turtle—once thriving on robust trends of the 1990s through early 2010s—began to falter long before the pandemic. Since 2020 we have seen the familiar trends return. Get six hours of video instruction with this edition.
Pick up your copies today – e-Book or paperback format – at Amazon.com