TradeStation Back-testing/Intra-bar Order Generation/Slippage - futures io
futures io futures trading



TradeStation Back-testing/Intra-bar Order Generation/Slippage


Discussion in TradeStation

Updated by kevinkdog
    1. trending_up 728 views
    2. thumb_up 11 thanks given
    3. group 3 followers
    1. forum 13 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

TradeStation Back-testing/Intra-bar Order Generation/Slippage

(login for full post details)
  #1 (permalink)
ridgewood, NJ
 
 
Posts: 13 since Aug 2019
Thanks: 8 given, 6 received

Some of my questions here is a continuation of my previous post here: https://futures.io/tradestation/48245-backtesting-ts-intrabarordergeneration.html

I am trying to automate a strategy on TS using its EasyLanguage. Previously, I used intrabarordergeneration (IOG) and with a 5-minute backtesting, the results looked great but as mtzimmer1 suggested in the post above, I switched the resolution to 1 tick over a month, and the results were pretty disappointing. (This is because I am using 5-minute intervals and my positions last anywhere from 5 min to 2 hours with an average of 50 minutes). I don't know if I am going to use IOG in the near future, and I understand that if I turn on IOG, the orders for entry/exit are placed at the next tick if the entry/exit conditions are satisfied. Something that I don't really understand from the description of IOG on the EasyLanguage page is the following:
If I have a moving average of the past 5 periods (5-minute intervals) and IOG is turned on, then how is it calculating the moving average? It is definitely not of the past 5 ticks, so is it taking each tick and then going back 5, 10, 15, 25 minutes and taking the average? If I am saying Close[1] is that the previous tick or the Close of the previous 5-minute bar?

Now, for my next question. So, I've turned IOG off except for my Stop Losses and Profit Targets. Every entry and exit that I have defined is executed
This Bar at Close
If IOG is turned off for entry/exit and I am running 5-minute intervals on my strategy, I would expect that back-testing at the 5-minute interval would not be much different than back-testing tick by tick except for slippage in my stop losses. Now, why is this completely wrong? I compare the back-testing and they are completely different. The 5-minute makes decent profit after commission over a few days while the tick by tick does not. Is this all slippage? It doesn't make sense for it to be this different since the backtesting should factor in High/Low for Stop Losses, right?

Reply With Quote

Can you help answer these questions
from other members on futures io?
Options Backtesting Software with Market Replay tool/feature?
Options
Volume Chart Trend Lines
TradeStation
Any Jim Dalton's June 2020 Intensive Graduates?
Emini and Emicro Index
Anyone scalp the Mini-DAX (FDXM)?
Emini and Emicro Index
GGP straightforward North?
Stocks and ETFs
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Are sharks watching on the other side?
52 thanks
Sierra Chart ACSIL for Beginners.
37 thanks
Earn2Trade (Helios) - "The Gauntlet"
26 thanks
VWAP for stock index futures trading?
16 thanks
FIO Journal Challenge - June 2020 w/SharkIndicators
15 thanks
 
(login for full post details)
  #2 (permalink)
Legendary Market Wizard
Bluffton, SC
 
Experience: Intermediate
Platform: TOS
Trading: Equities, Treasuries, Gold
 
mtzimmer1's Avatar
 
Posts: 604 since Dec 2018
Thanks: 1,587 given, 1,294 received

I'm not sure exactly why the difference in results is occurring but it usually has to do with how the strategy is coded. (What logic is used)

As far as the other question goes... IOG calculates the current price as the "close" until the bar itself actually closes. Say a five minute bar opens at 100.00. One minute in it has traded up to 100.24 and has satisfied the moving average condition; the order will be filled the moment the condition is met. We do not know what the close will be four minutes from now, and for that reason the tentative "close" is calculated as the last transacted tick.

I hope this answers at least half of your question.

-Zimmer

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



mtzimmer1 View Post
I'm not sure exactly why the difference in results is occurring but it usually has to do with how the strategy is coded. (What logic is used)

As far as the other question goes... IOG calculates the current price as the "close" until the bar itself actually closes. Say a five minute bar opens at 100.00. One minute in it has traded up to 100.24 and has satisfied the moving average condition; the order will be filled the moment the condition is met. We do not know what the close will be four minutes from now, and for that reason the tentative "close" is calculated as the last transacted tick.

I hope this answers at least half of your question.

-Zimmer

Hi again Mr. Zimmer! Ah, so what you are saying is that with IOG on with your example (which my question is completely related to but I phrased terribly), when the moving average condition is satisfied, say at exactly 10:26:00 and for simplicity a simple moving average, the simple moving average calculation is (Price(10:26) + Price(10:21) + Price(10:16) + Price(10:11) + Price(10:06))/5, right?

I will check my strategy code again to see what the difference is, but you don't think slippage is the problem? I checked the first page of the trades list and I think the trades (time and position) were all the same in the 5-minute back-testing and the tick by tick except for the losses/profits.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Legendary Market Wizard
Bluffton, SC
 
Experience: Intermediate
Platform: TOS
Trading: Equities, Treasuries, Gold
 
mtzimmer1's Avatar
 
Posts: 604 since Dec 2018
Thanks: 1,587 given, 1,294 received


highlyimprobable View Post
when the moving average condition is satisfied, say at exactly 10:26:00 and for simplicity a simple moving average, the simple moving average calculation is (Price(10:26) + Price(10:21) + Price(10:16) + Price(10:11) + Price(10:06))/5, right?

Almost.

It is actually (Price(10:25) + Price(10:20) + Price(10:15) + Price(10:10) + Price(10:06))/5

It maintains the previous closes that have already been completed but uses last tick for the "close" of the currently un-closed bar.

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


mtzimmer1 View Post
Almost.

It is actually (Price(10:25) + Price(10:20) + Price(10:15) + Price(10:10) + Price(10:06))/5

It maintains the previous closes that have already been completed but uses last tick for the "close" of the currently un-closed bar.

Do you mean

(Price(10:25) + Price(10:20) + Price(10:15) + Price(10:10) + Price(10:26))/5

instead because 10:25 to 10:30 is the un-closed 5-minute bar?

So, it actually gives more emphasis to more recent prices.

Reply With Quote
The following user says Thank You to highlyimprobable for this post:
 
(login for full post details)
  #6 (permalink)
Legendary Market Wizard
Bluffton, SC
 
Experience: Intermediate
Platform: TOS
Trading: Equities, Treasuries, Gold
 
mtzimmer1's Avatar
 
Posts: 604 since Dec 2018
Thanks: 1,587 given, 1,294 received


highlyimprobable View Post
Do you mean



(Price(10:25) + Price(10:20) + Price(10:15) + Price(10:10) + Price(10:26))/5



instead because 10:25 to 10:30 is the un-closed 5-minute bar?



So, it actually gives more emphasis to more recent prices.



Sorry for the error! Yes that is correct 10:26!

Emphasis should be equal to all five data points. Sum all five, and divide by five. Equal weighting!

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


mtzimmer1 View Post
Sorry for the error! Yes that is correct 10:26!

Emphasis should be equal to all five data points. Sum all five, and divide by five. Equal weighting!

Yes, I understand the weighting is equal, but I meant more along the lines of the following reasoning. With IOG on, the SMA is taking an average of values that are closer to the current time than with IOG off, where we have an average is spaced evenly by 5 minutes.

Thanks for all your help!

Reply With Quote
 
(login for full post details)
  #8 (permalink)
Market Wizard
Cleveland Ohio/United States
 
Experience: Advanced
Platform: Tradestation
Broker: Tradestation, DeCarley, others
Trading: futures
 
Posts: 2,773 since Jul 2012
Thanks: 1,424 given, 5,336 received

You can easily see what is going on with IBOG by using a print statement:

var:bl(" ");
print(date,bl,time,bl,close,bl,close[1],bl,close[2],bl,close[3],bl,close[4],bl,close[5]);

My experience with IBOG is limited, as years ago I found it did not backtest the way I though it should, and results were so puzzling at times I thought I'd lose my mind.

My hair stopped falling out (OK, more slowly fell out) once I gave up on IBOG...

Follow me on Twitter Reply With Quote
The following 2 users say Thank You to kevinkdog for this post:
 
(login for full post details)
  #9 (permalink)
ridgewood, NJ
 
 
Posts: 13 since Aug 2019
Thanks: 8 given, 6 received


kevinkdog View Post
You can easily see what is going on with IBOG by using a print statement:

var:bl(" ");
print(date,bl,time,bl,close,bl,close[1],bl,close[2],bl,close[3],bl,close[4],bl,close[5]);

My experience with IBOG is limited, as years ago I found it did not backtest the way I though it should, and results were so puzzling at times I thought I'd lose my mind.

My hair stopped falling out (OK, more slowly fell out) once I gave up on IBOG...

Ahahaha, I think I am about to close the chapter that is IBOG. It seems like there is a huge potential with IBOG, but understanding the intricacies of it might not be worth it. Do you have any ideas as to why the back-testing for 5-minute is significantly different from the tick by tick when IBOG is only turned on for stop losses and profit targets?

Yes, you are completely right about the Print function (I am so used to having the Print results next to my code when I execute it that I completely ignore it when I'm on TS).

Reply With Quote
 
(login for full post details)
  #10 (permalink)
Market Wizard
Cleveland Ohio/United States
 
Experience: Advanced
Platform: Tradestation
Broker: Tradestation, DeCarley, others
Trading: futures
 
Posts: 2,773 since Jul 2012
Thanks: 1,424 given, 5,336 received



highlyimprobable View Post
Ahahaha, I think I am about to close the chapter that is IBOG. It seems like there is a huge potential with IBOG, but understanding the intricacies of it might not be worth it. Do you have any ideas as to why the back-testing for 5-minute is significantly different from the tick by tick when IBOG is only turned on for stop losses and profit targets?

Yes, you are completely right about the Print function (I am so used to having the Print results next to my code when I execute it that I completely ignore it when I'm on TS).

I could guess at what might be going on, but to really know I'd have to see the code in cases like this. (I'm not asking to see it, to be clear.)

The huge potential you see with IBOG is likely just tricks being played on the backtest engine. IN other words, not real.

Follow me on Twitter Reply With Quote
The following 2 users say Thank You to kevinkdog for this post:


futures io Trading Community Platforms and Indicators TradeStation > TradeStation Back-testing/Intra-bar Order Generation/Slippage


September 3, 2019


Upcoming Webinars and Events
 

Free BloodHound Licenses for everyone!

June
 

Every journal equals ten meals for the hungry

June
     



Copyright © 2020 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