What is Better: 30, 60, or 120 Minute Break-Out on ES.D
Here is a simple tutorial you can use as a foundation to build a potentially profitable day trading system. Here we wait N minutes after the open and then buy the high of the day or short the low of the day and apply a protective stop and profit objective. The time increment can be optimized to see what time frame is best to use. You can also optimize the stop loss and profit objective – this system gets out at the end of the day. This system can be applied to any .D data stream in TradeStation or Multicharts.
Logic Description
get open time
get close time
get N time increment
15 – first 15 minute of day
30 – first 30 minute of day
60 – first hour of day
get High and Low of day
place stop orders at high and low of day – no entries late in day
calculate buy and short entries – only allow one each*
apply stop loss
apply profit objective
get out at end of day if not exits have occurred
Optimization Results [From 15 to 120 by 5 minutes] on @ES.D 5 Minute Chart – Over Last Two Years
Simple Orbo EasyLanguage
I threw this together rather quickly in a response to a reader’s question. Let me know if you see a bug or two. Remember once you gather your stops you must allow the order to be issued on every subsequent bar of the trading day. The trading day is defined to be the time between timeIncrement and endTradeMinB4Close. Notice how I used the EL function calcTime to calculate time using either a +positive or -negative input. I want to sample the high/low of the day at timeIncrement and want to trade up until endTradeMinB4Close time. I use the HighD and LowD functions to extract the high and low of the day up to that point. Since I am using a tight stop relative to today’s volatility you will see more than 1 buy or 1 short occurring. This happens when entry/exit occurs on the same bar and MP is not updated accordingly. Somewhere hidden in this tome of a blog you will see a solution for this. If you don’t want to search I will repost it tomorrow.
//Optimizing Time to determine a simple break out //Only works on .D data streams Inputs: timeIncrement(15),endTradeMinB4Close(-15),stopLoss$(500),profTarg$(1000);
If time = calcStopTime then begin buyStop = HighD(0); shortStop = LowD(0); buysToday = 0; shortsToday = 0; End;
if time >= calcStopTime and time < quitTradeTime then begin if buysToday = 0 then Buy next bar at buyStop stop; if shortsToday = 0 then Sell short next bar at shortStop stop; end;
mp = marketPosition;
If mp = 1 then buysToday = 1; If mp = -1 then shortsToday = 1;
Good question. In TradeStation a .D extension to the symbol name such as @ES.D represents the pit session time – in Eastern Time it would be 9:30 to 4:15. TradeStation has several symbols you can add the .D to. However, you can also create your own custom session which will replicate the same time period covering the .D. This code can be applied to any session as I am using sessStartTime and sessEndTime but it really is designed to day trading purposes.
Thanks for the question — George
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
what is a .D datastream?
Hi Matt,
Good question. In TradeStation a .D extension to the symbol name such as @ES.D represents the pit session time – in Eastern Time it would be 9:30 to 4:15. TradeStation has several symbols you can add the .D to. However, you can also create your own custom session which will replicate the same time period covering the .D. This code can be applied to any session as I am using sessStartTime and sessEndTime but it really is designed to day trading purposes.
Thanks for the question — George