• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 1:09am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:09am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Custom indicator to display values from other indicators 2 replies

Reading scaled custom indicator values! 7 replies

EA with Custom Indicator: no values 3 replies

How to get custom indicator values? 12 replies

Backtest custom period? (period converter script) 3 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

Cross-period custom indicator returning incorrect values during backtest

  • Post #1
  • Quote
  • First Post: Oct 17, 2011 2:52pm Oct 17, 2011 2:52pm
  •  atr
  • | Joined May 2010 | Status: Member | 44 Posts
I have a custom indicator that works fine on a chart and in an EA when accessing the same timeframe it is being used on.

However when I try to access a PERIOD_W1 or PERIOD_MN1 value for this indicator it returns EMPTY_VALUE from the start of the backtest despite there being W1 data for that symbol that extends beyond the start of the backtest period.

The code is verbatim the MQL4 code here (http://codebase.mql4.com/source/1184) but with the array average on line 67 changed to be MODE_EMA.

I am assuming that the ATR code is correct as it's MetaQuotes's own code. I am calling it using the iCustom() method.

Is there any explanation for why this is returning EMPTY_VALUE when there is enough data for an average?

Regards
  • Post #2
  • Quote
  • Oct 18, 2011 7:23am Oct 18, 2011 7:23am
  •  Xaphod
  • Joined Mar 2010 | Status: Member | 1,380 Posts
The backtester does not support multiple timeframes. It only works correctly on the selected time-frame.

You can work around that by creating offline charts in your EA. However if you are using standard timeframes for the offline charts, you have to run the backtester offline and the history stored fot the affected timeframes will be deleted.
  • Post #3
  • Quote
  • Oct 18, 2011 8:37am Oct 18, 2011 8:37am
  •  atr
  • | Joined May 2010 | Status: Member | 44 Posts
It does support multiple timeframes to some extent; all of the built-in indicators like iATR will work correctly.
  • Post #4
  • Quote
  • Oct 18, 2011 8:51am Oct 18, 2011 8:51am
  •  Xaphod
  • Joined Mar 2010 | Status: Member | 1,380 Posts
Do they really work correctly? Does the strategy tester generate current data for them or do they use whatever is available in the history file? If they use the data in the history file, then they are actually seeing the close of the higher time-frame bars before they close, and that will give misleading results.
  • Post #5
  • Quote
  • Oct 18, 2011 8:55am Oct 18, 2011 8:55am
  •  atr
  • | Joined May 2010 | Status: Member | 44 Posts
In my system I only look at the value of the bar prior to the current one but I will mock up some code and check that for you.
  • Post #6
  • Quote
  • Oct 18, 2011 9:04am Oct 18, 2011 9:04am
  •  Xaphod
  • Joined Mar 2010 | Status: Member | 1,380 Posts
No need to check anything for me. I can do that myself if I need to.
  • Post #7
  • Quote
  • Last Post: Oct 18, 2011 9:06am Oct 18, 2011 9:06am
  •  atr
  • | Joined May 2010 | Status: Member | 44 Posts
No problem.

I'll post my results up here anyway so the thread can serve as a reference for others.
  • Platform Tech
  • /
  • Cross-period custom indicator returning incorrect values during backtest
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021