SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Mar 19, 2019 9:11 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Nov 07, 2010 10:41 am 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
Hi,
I am backtesting on my multi time frames strategy.
For example, if the price on 60 min, 30 min and 5 min cross above moving avg (60,30,5 min), go long on 5 min bar.
But for some reason, I got filled on my stop loss (limit order) at a price which it doesn't even exist in that particular bar. I enter the trade at 12208 and set my set loss at 25 ticks below which is 12183. And I got filled on stop loss limit order but the stop loss price (12183) never existed in the bar.. my low price on that bar is 12206 which is not even near my stop price..
Could you please help me why it is happening ? Thanks.


Attachments:
stop_loss.jpg
stop_loss.jpg [ 83.14 KiB | Viewed 6826 times ]
Top
 Profile  
 
PostPosted: Sun Nov 07, 2010 12:06 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6811
Hi,

do you also use trades and quotes in your simulations?

Regards,
Anton


Top
 Profile  
 
PostPosted: Sun Nov 07, 2010 12:13 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6811
Also, if you use multiple time frames in your strategy (bars with different sizes), you can set the execution simulator to use just 5 min bars to simulate fills. Go to Providers window, select Simulatior(execution), go to Properties window, enable Bar Filter and add 5 min bars to the collection of bar sizes.

Please tell us if this helps.

Regards,
Anton


Top
 Profile  
 
PostPosted: Sun Nov 07, 2010 1:26 pm 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
Dr. Anton Fokin wrote:
Hi,

do you also use trades and quotes in your simulations?

Regards,
Anton


No. I only use OnBar.


Top
 Profile  
 
PostPosted: Sun Nov 07, 2010 1:32 pm 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
Dr. Anton Fokin wrote:
Also, if you use multiple time frames in your strategy (bars with different sizes), you can set the execution simulator to use just 5 min bars to simulate fills. Go to Providers window, select Simulatior(execution), go to Properties window, enable Bar Filter and add 5 min bars to the collection of bar sizes.

Please tell us if this helps.

Regards,
Anton


Hi, I don't get any performance result after I enabled Bar filter in the properities and ran my code.
Could you tell me how to add 5 min bars to the collection of bar sizes ?


Attachments:
stop_loss2.jpg
stop_loss2.jpg [ 46.53 KiB | Viewed 6823 times ]
Top
 Profile  
 
PostPosted: Sun Nov 07, 2010 3:07 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6811
Click on (Collection) ... and then a dialog window will pop up.

Regards,
Anton


Top
 Profile  
 
PostPosted: Tue Nov 09, 2010 9:04 pm 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
I don't know exactly if your issue is the same as the one I had in the past, but I recognize the symptoms--you get filled on prices that are not possible after you place your stop. In my case(s), I was getting filled on prices that occurred (in time) before I even placed my stop, a situation that would be impossible in real life.

After some very deep digging into the simulator and how it works, I can say that the problem occurs because of how the simulator determines the most recent price range. If I remember correctly, immediately after you place your stop, the simulator starts checking your stop price against the High Low bounds of each new bar that is constructed.

Suppose you set your stop at the end of a 5 minute bar, when you are also running 30 and 60 minute bars in the simulator. Maybe you've just set the stop halfway through the 30 min or 60 min bar, when the high/low price that will trigger your stop has already occurred in the front half of the 30 or 60 minute bars. Even if future prices do not trigger your stop, the simulator will trigger the stop when the 30 or 60 min bars arrive, since they have a High or Low price that will trigger the stop.

Thus you should do what Anton suggested, and tell the simulator to only use 5 min bars for fills if you are setting stops on 5 minute intervals (or 30/30min, etc).

The same problem occurs when you are building bars from trades, since you have both trades and bars (different time intervals) at work. Good luck.


Top
 Profile  
 
PostPosted: Mon Nov 15, 2010 11:43 pm 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
It works now. Thank you Anton and kkkwj !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group