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

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

VTTrader: How to program custom indicators at CMS?? 4 replies

Who else does custom indicators? 17 replies

Custom Indicators 3 replies

How to program custom indicators at MetaTrader???? 1 reply

Custom indicators 4 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: Custom Indicators vs. Technical Indicators
Exit Attachments
Tags: Custom Indicators vs. Technical Indicators
Cancel

Custom Indicators vs. Technical Indicators

  • Post #1
  • Quote
  • First Post: Jun 29, 2008 6:43pm Jun 29, 2008 6:43pm
  •  shaltrade
  • | Joined Mar 2008 | Status: Member | 15 Posts
Hello folks -

Just wanted to know if there's a way to make a custom metatrader indicator into a "native" MT4 technical indicator. Instead of iCustom, i would like to make calls to iMyInidcator instead.


The reason is -making iCustom calls in an EA makes backtesting verrrrry slow.

Is there any other way to speed up backtesting when using non-standard indicators?

Best - Susmit
  • Post #2
  • Quote
  • Jun 29, 2008 7:05pm Jun 29, 2008 7:05pm
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
no way to make them native.

The best way to speed up backtesting when using them is to make sure the code for the indicator is written for efficient execution. Otherwise you are stuck twiddling your thumbs while you wait.
 
 
  • Post #3
  • Quote
  • Jun 29, 2008 7:14pm Jun 29, 2008 7:14pm
  •  DaveL
  • | Joined Aug 2006 | Status: Member | 142 Posts
No, there is no way to make a custom indicator "native." ( ... unless you license the source-code from MetaQuotes & alter the guts of MT4.)

I use lots of custom indicators in my EAs, and they backtest very quickly. The trick is to make sure your custom indicator is coded as efficiently as possible.

For example, if the calculations are based on only end-of-bar information, then code in a time-check to perform the calculations only upon the start of a new bar (thus saving you from calculating every single tick).

Also, if there's no need to re-calculate previous bar data, be sure to utilize the IndicatorCounted() function.

Fore example,

Inserted Code
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- main loop
for(int i=0; i<limit; i++)
{
  ... etc ...
}

This will help prevent needless recalculation of old bar indicator values which will never change their values anyway.

There are other tricks & tips, for example, rearranging your logic & coding as efficiently as possible, as well as other tricks when you paint objects. But I think if you take the above into consideration, you'll find your backtests will go zipidy-split.
Dave
 
 
  • Post #4
  • Quote
  • Jun 29, 2008 7:38pm Jun 29, 2008 7:38pm
  •  phy
  • | Joined Nov 2007 | Status: Member | 113 Posts
I made a test... An EA that calls iMA(), or is recompiled and calls the equivalent Custom Indicator.
There is almost no discernable difference in execution times using "every tick".
Optimize the indicators that you are using if they are causing you trouble.
---
test, calling iMA()
2008.06.29 19:33:50 2008.06.30 01:33 DummyEA EURUSD,M5:
Time = 2157ms Ticks = 674718
---
Test, calling Custom Indicator
2008.06.29 19:34:11 2008.06.30 01:34 DummyEA EURUSD,M5:
Time = 2328ms Ticks = 674729
 
 
  • Post #5
  • Quote
  • Edited 1:35pm Jun 30, 2008 11:37am | Edited 1:35pm
  •  shaltrade
  • | Joined Mar 2008 | Status: Member | 15 Posts
Thanks Dave and phy.

I went and included the IndicatorCounted() code into my indicator. Still quite slow when this is called by the EA. There are 4 iCustom calls - one for each of the indicator buffers.

I have attached the indicator code. It's a small piece of code - less than a 100 lines including comments. It will be great if you guys have any pointers on how it could be made more efficient. Or if the DLL route will make any difference.

Best - susmit
Attached File(s)
File Type: mq4 Support Resistance PL and PS.mq4   2 KB | 1,358 downloads
 
 
  • Post #6
  • Quote
  • Last Post: Jun 30, 2008 4:43pm Jun 30, 2008 4:43pm
  •  shaltrade
  • | Joined Mar 2008 | Status: Member | 15 Posts
Well - never mind the above post. I made the changes and IndicatorCounted() actually did the trick... I do need to recalculate some of the previous bars - but if I keep their numbers limited, the backtesting is indeed zippidy-doo.

Thanks everyone!
 
 
  • Platform Tech
  • /
  • Custom Indicators vs. Technical Indicators
  • 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 / ©2023