Dukascopy
 
 
Wiki JStore Search Login

How to Make Live Strategy Behave the Same as Historical Test?
 Post subject: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Fri 11 Nov, 2016, 07:10 
User avatar

User rating: 0
Joined: Sun 31 Jan, 2016, 23:48
Posts: 14
Location: Australia,
When testing the same strategy on Historical Test in VJF the results can vary significantly depending on which "Period" (Tick, 10sec, 1min, etc..) is selected, and which "Interpolate By" (Tick on Open, Tick on Close, etc...) setting is chosen. Any of those tests can also be different to the Live performance of the strategy.

My question is: What can be done in the Strategy itself to force Live performance to conform to the Historical Test performance based on its Run Time parameters?

For example,

1. I initialise a strategy "onCandle" and I filter "IF defaultPeriod = Last Bid Candle.Candle Period". I edit "defaultPeriod = 30min". The strategy uses an indicator (say SMA) with defaultinstrument, defaultPeriod, and shift = 1.
2. I run the strategy for one day (say from 1pm 08/11/2016 to 1pm 09/11/2016) on the Live account. I get a result A (an amount of profit/loss).
3. Later, I backtest the strategy for the same period (1pm 08/11/2016 to 1pm 09/11/2016) using Historical Test in VJF with Run Time parameters: "Period = 30min", "Interpolate By = Tick on Open". I get a result B.
4. Later, I backtest the strategy for the same period (1pm 08/11/2016 to 1pm 09/11/2016) using Historical Test in VJF with Run Time parameters: "Period = 10sec", "Interpolate By = Tick on Open". I get a result C.

What can I change in the strategy to make A = B, or A = C (or A = any other Historical Test with its RunTime parameters)?
Is there a filter on the information the strategy will process from the Live account that will make it behave as a Historical Test would?


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Fri 11 Nov, 2016, 13:52 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi there,

Please have a look into the following posts related to interpolation settings use:

https://www.dukascopy.com/swiss/english ... ion#p79567
https://www.dukascopy.com/swiss/english ... ion#p87834

So any change of the interpolation settings will change price data that you're whiling to test on, thus the result is different.

Cheers


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Sat 12 Nov, 2016, 02:46 
User avatar

User rating: 0
Joined: Sun 31 Jan, 2016, 23:48
Posts: 14
Location: Australia,
Amine, thanks for the prompt reply. I could not access the second link for some reason. However, I did read the post from the first link before wrote my post.

My question is slightly different if you can note the nuance. I am okay with the idea that the Historical Test will be different from Live performance, and I can see why from your explanations in the previous post. My question is: Can I modify the strategy to better approximate the Historical Test (rather than try to make the historical test reflect better how a strategy might perform on the live trial)?

For instance in the post from the first link you sent, you mentioned that: "A explained, interpolation is about speeding historical tester. Concretely it eliminate useless data that the strategy wont need. In case you need to replicate perfectly Live market then you should execute your historical tests with 'process all Ticks'; it is as simple as that."

My question in relation to this would be: Can I include some filter in my strategy that would also "eliminate useless data that the strategy wont need" but on the Live market, so that I can replicate the Historical Test performance on the Live market (rather than try to replicate the Live market in the Historical Test)?


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Mon 14 Nov, 2016, 15:26 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

Thanks for the clarification.
The nuance is that when testing backward, we know in advance the open, high, low and close prices of any candle so we can filter the non used data so that the strategy will focus on the prices used and ignore the rest while if we run the strategy forward this is not possible so we have to go through every tick till the end of the candle and then get the needed data. In other words when your strategy is subscribed to trade on 15Mn candles it doesn't look at every single tick price within the candle it self because the candle method is activated every candle open/close. Another example: If you want to check the status of a position (filled or not for instance): you can do this by working with the method "Trade Event" which is automatically subscribed to events that involves positions status. So there is no need to check a position status on every tick price if your main concern is to check its status whether filled or not (like many do) but only using the appropriate method.

So you have to look at your strategy and the way it is implemented and think if is well optimized or not. We also offer a tool in Jforex platform called "Optimization" in the historical tester.

Hope this helps


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Tue 15 Nov, 2016, 10:43 
User avatar

User rating: 0
Joined: Sun 31 Jan, 2016, 23:48
Posts: 14
Location: Australia,
Hope you don't mind, I'd like to clarify to make sure I fully understand.

My original question is: Say I run a Historical test and interpolate “Tick on Close”. I am using "onCandle", "defaultPeriod = 30min" and offsetting all indicators in the strategy to the past completed candle (shift =1). So the forward candle should not make a difference (or is that incorrect?).

How can I add a filter so that my Live strategy only receives the tick with the candle close information and nothing else? In effect, this filter would make it irrelevant whether I Historically test my strategy on tick, 10min, or 30min; or whether I run the strategy on the Live account. It would only sample the information once at the point the candle is closed and nothing else.

In this context, I was not 100% sure I understood the last reply:

1. When you say: "The nuance is that when testing backward, we know in advance the open, high, low and close prices of any candle so we can filter the non used data so that the strategy will focus on the prices used and ignore the rest while if we run the strategy forward this is not possible so we have to go through every tick till the end of the candle and then get the needed data."

Question:
(i) Do you mean any indicator (say SMA) on the Live account is still affected by the forward candle (shift = 0) even though the indicator in the strategy is offset to the past candle (shift = 1)?
(ii) Is there a way to completely disregard the forward candle (shift =0) on the Live account, so that the indicator only responds once every 30min for the tick at which a candle is closed?

2. When you say: "In other words when your strategy is subscribed to trade on 15Mn candles it doesn't look at every single tick price within the candle it self because the candle method is activated every candle open/close."

Question:
(i) You mean this is what happens on the Historical test? [bit confused here in relation to point 1 above]
(ii) Since my strategy is set "onCandle" and I filter "IF defaultPeriod = Last Bid Candle.Candle Period”; on the Live account, is the indicator (shift =1) still affected by every single tick or not?
(iii) How can I filter the information in the strategy so that only the close price tick is used by the strategy?

When you say: "Another example: If you want to check the status of a position (filled or not for instance): you can do this by working with the method "Trade Event" which is automatically subscribed to events that involves positions status. So there is no need to check a position status on every tick price if your main concern is to check its status whether filled or not (like many do) but only using the appropriate method."

Question:
(i) You’re right I have a position status check that is linked through “onCandle”. If I change to “Trade Event” this will make my strategy computationally more efficient, but it should not affect when it executes a trade?
(ii) Whereas, if I filter the information so that that the strategy only receives “Tick on Close” information this does affect when a trade is executed. Is that correct?


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Tue 15 Nov, 2016, 11:25 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,
I was probably not clear enough so let me try to put some light based on your questions:
- Your strategy doesn’t need any specific filter if it works already on candle basis. So how this works? Say the strategy is subscribed to 30mn candles, as said the candle method is triggered/activated on candle open and close prices meaning when the current candle expires and a new on starts. So at this moment exactly the candle’s attributes (OHLC) will be determined therefore your strategy is not really looking at every tick price in-between but only OHLC. Your strategy will use ticks only if you use “On tick” method or any variable calling tick price for instance.
1/ Most probably I wasn’t clear about that: what I meant is basically in real time run (forward) the strategy will wait till a given candle is closed to retrieve the OHLC regardless of candle used (shift 1or 0). Obviously any data (candle / indicator …) with shift 0 is still under construction and it’s clear as you said the strategy needs to wait to use such data. Previous data are available already and can be retrieved at any moment using shift parameter (1,2,3,…) or collecting a set of variable in one action such as using “Get historical Candles” block (data Array ). So in other words it’s all about the way you define your requirements and how you implement this. Feel free to suggest a concrete example and I can help you with that.

2/ Assuming that the strategy is subscribed to a given candle period it will use candle data both in real time run and historical testing mode. So the answer to (i) is yes. The answer to (ii) is No. For (iii): You cannot disregard the open, high and low prices when using On Candle method. These data are retrieved by default by the method BUT if you don’t use them in your conditions the strategy won’t retrieve them. It is like these data are available to get picked up but it’s up to the strategy to use it or not.

3/ (i) If you are checking only the status of the position then is it more much more efficient to use Trade event method.
(ii) In historical tester: Yes your trades will be impacted as you applied a filter on the data range that was tested.

If you still have questions, I suggest to arrange a call if you don’t mind.

Thanks


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Wed 16 Nov, 2016, 07:55 
User avatar

User rating: 0
Joined: Sun 31 Jan, 2016, 23:48
Posts: 14
Location: Australia,
Thanks for the clarification. It helps, but it also rises a problem:

As I understood the explanation, in the strategy I described ("defaultPeriod = 30min", "onCandle", indicator "shift =1", and indicator set to use "Tick Close") the only data is OHLC for the 30min candle (after it closes). From this the indicator selects the Close tick only and it disregards the rest (i.e.: OHL). So there should be no difference when running the Historical Test using RunTime parameters Period = 30min, 10min, 10sec, or on the Live account because the only information the enters the strategy is the 30min close tick? However, when I actually do these tests the results are very different. So I am probably missing something basic.

What would be the best way to arrange a skype call?


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Wed 16 Nov, 2016, 11:10 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

RunTIme parameters are a set of tools used to filter historical data on which the strategy will go through. Normal market conditions is "All ticks". Any change applied on this will change the way historical data are processed.
I'm not 100% sure that the indicator that you're referring to uses only candle close price in its calculation method which would explain such difference.

I suggest to arrange a one-to-one conference using our desktop-sharing tool tomorrow 9 am GMT (7pm your time ?) Is this okay for you ?
I would need your email address in order to send you the details.

Thanks


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Wed 16 Nov, 2016, 12:48 
User avatar

User rating: 0
Joined: Sun 31 Jan, 2016, 23:48
Posts: 14
Location: Australia,
9am GMT tomorrow is fine.

How can I get the email address to you without leaving it on the blog publicly?


 
 Post subject: Re: How to Make Live Strategy Behave the Same as Historical Test? Post rating: 0   New post Posted: Wed 16 Nov, 2016, 14:44 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Please email it to [email protected] and address it to me.

Thanks


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com