Backtesting with TS intrabarordergeneration - TradeStation | futures io social day trading
futures io futures trading


Backtesting with TS intrabarordergeneration
Updated: Views / Replies:229 / 12
Created: by highlyimprobable Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Backtesting with TS intrabarordergeneration

  #1 (permalink)
ridgewood, NJ
 
 
Posts: 13 since Aug 2019
Thanks: 8 given, 6 received

Backtesting with TS intrabarordergeneration

So I've finished writing an algo for futures on TS using its Easylanguage. I've backtested all the way up till Aug 31, 2016 (I think that's as far as it goes) and I want to go live as soon as possible. Here's the thing: I turned on intrabarordergeneration and I have seen somewhere on this forum that it makes backtesting with TS inaccurate. Is there any way I can backtest more accurately then without having to create a backtesting platform? I am going to run the algo on Sim for a few days (it's a very simple algo) but what else should I do? Thanks!

Reply With Quote
The following user says Thank You to highlyimprobable for this post:
 
  #2 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 254 since Dec 2018
Thanks: 367 given, 564 received


highlyimprobable View Post
So I've finished writing an algo for futures on TS using its Easylanguage. I've backtested all the way up till Aug 31, 2016 (I think that's as far as it goes) and I want to go live as soon as possible. Here's the thing: I turned on intrabarordergeneration and I have seen somewhere on this forum that it makes backtesting with TS inaccurate. Is there any way I can backtest more accurately then without having to create a backtesting platform? I am going to run the algo on Sim for a few days (it's a very simple algo) but what else should I do? Thanks!

It depends on what data resolution you need. Unless the system is an ultra short-term algorithm then 1 minute candles should be adequate for nearly everything. If you want the highest resolution possible you can use intrabarordergeneration and then specify to look inside the bar down to the tick. This will be the most accurate, but also the most time-consuming to download and test the dataset.


Last edited by mtzimmer1; August 31st, 2019 at 06:44 PM. Reason: clarity
Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to mtzimmer1 for this post:
 
  #3 (permalink)
ridgewood, NJ
 
 
Posts: 13 since Aug 2019
Thanks: 8 given, 6 received



mtzimmer1 View Post
It depends on what data resolution you need. Unless the system is an ultra short-term algorithm then 1 minute candles should be adequate for nearly everything. If you want the highest resolution possible you can use intrabarordergeneration and then specify to look inside the bar down to the tick. This will be the most accurate, but also the most time-consuming to download and test the dataset.

I'm using 5 minute candles to see general trends and not enter and exit so quickly but I'm only holding positions for 40-60 minutes. There is too much noise with the 1 minute candle so I saw that the 5 minute is much better for my analysis. I set the intrabarordergeneration because sometimes I catch less of the momentum by the time I enter. I also set stop losses with the intrabarordergenerstion to True for that too because within 5 minutes I may lose 6000 when the stop loss is at 600. So, if I am understanding you correctly, the backtest shouldn't be that different from live?

Quick question about optimization/Walk-Forward optimization: I am walk-forward optimizing over a one year period (should this be longer?) with 35% of the data tested as out of sample test set. I don't think there's much overfitting (it's also a pretty simple algo) because I tested the algo against 1 year periods that don't include the training set or the test set and it performs as I want it to. Could you shed some light on how you perform optimizations on TS? I think I'm going to tweak the model parameters every few months using the TS optimization.

Reply With Quote
The following user says Thank You to highlyimprobable for this post:
 
  #4 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 254 since Dec 2018
Thanks: 367 given, 564 received

@highlyimprobable

You still need to specify the resolution with which to look inside the bar. I believe this is under strategy settings - I am away from my computer and not exactly sure.

All the strategies I trade are long term. (Daily candles) I backtest and optimize them first usually on SPY across the entire dataset I have. I then go in and ensure the strategy is performing acceptably well on correlated markets, such as QQQ, DIA and IWM. From there I test individual stocks. If the strategy performs well across all tests then I know I did not over-optimize it. This process also gives me quite a bit of faith in trading the strategy live.

If your strategy is written for equities I would recommend testing it on other correlated instruments. If it performs well then you are probably on to something.

-Zimmer

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to mtzimmer1 for this post:
 
  #5 (permalink)
ridgewood, NJ
 
 
Posts: 13 since Aug 2019
Thanks: 8 given, 6 received


mtzimmer1 View Post
@highlyimprobable

You still need to specify the resolution with which to look inside the bar. I believe this is under strategy settings - I am away from my computer and not exactly sure.

All the strategies I trade are long term. (Daily candles) I backtest and optimize them first usually on SPY across the entire dataset I have. I then go in and ensure the strategy is performing acceptably well on correlated markets, such as QQQ, DIA and IWM. From there I test individual stocks. If the strategy performs well across all tests then I know I did not over-optimize it. This process also gives me quite a bit of faith in trading the strategy live.

If your strategy is written for equities I would recommend testing it on other correlated instruments. If it performs well then you are probably on to something.

-Zimmer

So, I use the Format > Symbol > 5 minute intervals, but I think you are referring to the Format > Strategies > Properties for All > General > Back-Testing resolution > Use Look-Inside Bar Back-Testing (right?). If I set this to 1 tick, I guess this will be computationally heavy, but it would give the accurate back-testing results? Update: I don't think TS lets me set this to 1 tick as it says setting it to 1 tick will only allow me to back-test until 8/27/2019.

Thanks so much for your comments on back-testing in general, too!


Last edited by highlyimprobable; August 31st, 2019 at 07:28 PM. Reason: Update
Reply With Quote
The following user says Thank You to highlyimprobable for this post:
 
  #6 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 254 since Dec 2018
Thanks: 367 given, 564 received

Answer
This post has been selected as an answer to the original posters question Answer

You've got it. TS won't let you use that data until you download it from their servers. That does take a long time!
Try 1 minute instead of 1 tick. Should be much computationally heavy but also provide greater resolution than the 5 minute candles.

Without knowing the details of your code I'm not sure if there will be any benefit to looking inside the 5 minute bar. Is it possible for your strategy to trigger both an entry and an exit in the same bar? Is it possible for something to happen during the formation of the five minute bar that turns your entry condition false? If no to both, then you probably don't need to use a resolution greater than 5 minutes.

-Zimmer

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to mtzimmer1 for this post:
 
  #7 (permalink)
ridgewood, NJ
 
 
Posts: 13 since Aug 2019
Thanks: 8 given, 6 received

So, now, the profits are much smaller than before (around 4 times less) using the 1 minute bars, but at least now I will be going in with adjusted and reasonable expectations.


Quoting 
Without knowing the details of your code I'm not sure if there will be any benefit to looking inside the 5 minute bar. Is it possible for your strategy to trigger both an entry and an exit in the same bar? Is it possible for something to happen during the formation of the five minute bar that turns your entry condition false? If no to both, then you probably don't need to use a resolution greater than 5 minutes.

So, my entry and exits for Long/Short all depend on some sort of moving averages calculated using the close of the bar. When I turn on intrabarordergeneration, I understand that
 
Code
Buy numcontracts contracts next bar at market
means to buy that many contracts the next tick(?), but intrabarordergeneration should not affect the conditions for my entry/exit, right? So, to address one of your points, it is possible for something to happen during the five minute bar so that my entry condition is no longer true, but if my input is
 
Code
Price( Close )
and my moving averages are built on that, then shouldn't the Close refer to the Close of the last 5-minute bar?

I actually think there's a problem since after I turned it on, the algo is trading 8 times more than it used to.


Last edited by highlyimprobable; August 31st, 2019 at 07:50 PM. Reason: Update
Reply With Quote
The following user says Thank You to highlyimprobable for this post:
 
  #8 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 254 since Dec 2018
Thanks: 367 given, 564 received

Okay, here is a simple question. If you are calculating based on closing values why not just buy/sell on the close of the bar? That way there will be no separation between expectations and reality.

Visit my futures io Trade Journal Reply With Quote
 
  #9 (permalink)
ridgewood, NJ
 
 
Posts: 13 since Aug 2019
Thanks: 8 given, 6 received


mtzimmer1 View Post
Okay, here is a simple question. If you are calculating based on closing values why not just buy/sell on the close of the bar? That way there will be no separation between expectations and reality.

Because my targets are set so close, buying at the close of the bar is very different when I backtest compared to buying at next bar at the market with intrabarordergeneration. I tried what you suggested and it seems to be a difference of no profit and profit.

Reply With Quote
 
  #10 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 254 since Dec 2018
Thanks: 367 given, 564 received



highlyimprobable View Post
Because my targets are set so close, buying at the close of the bar is very different when I backtest compared to buying at next bar at the market with intrabarordergeneration. I tried what you suggested and it seems to be a difference of no profit and profit.

Interesting. Make sure you are not fooling yourself with the backtest. Watch it live on SIM and see if you can figure out the glitch.

I completely understand the desire to keep proprietary code private, BUT I am happy to take a look at the logic of your strategy if that would be any benefit to you. Feel free to PM me.

-Zimmer

Visit my futures io Trade Journal Reply With Quote

Reply



futures io > > > > Backtesting with TS intrabarordergeneration




Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Show us your trading desks and win over $5,000 in prizes w/Jigsaw Trading

September
 

Webinar: The Best Entries and Exits in trading & in life w/Agustin Lebron

Elite only
 

Webinar: NinjaTrader 8 Newest Features Release Sneak Peek

Sep 26
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
IntrabarOrderGeneration and current OHLC? Form9 EasyLanguage Programming 9 November 19th, 2018 08:34 PM
IntrabarOrderGeneration AhmedF EasyLanguage Programming 6 February 16th, 2017 11:20 AM
.NET Backtesting API/library - externalize backtesting from your trading platform andby Elite EasyLanguage Automated Trading 1 July 26th, 2016 09:25 PM
why Backtesting stocks difficult vs backtesting Futures emini_Holy_Grail Traders Hideout 8 July 4th, 2015 02:14 PM
Difference between IntraBarOrderGeneration and Bar Magnifier arjfca EasyLanguage Programming 13 March 23rd, 2011 01:28 PM


All times are GMT -4. The time now is 02:57 AM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts