Integrate A Custom Indicator into an EA

 

Hello all, I am new here.

I was wondering, is it possible to integrate Indicator code into an EA, or if I could put a script in that would allow me to have the Indicators appear automatically when I start the EA?

Thank you,

abonifi1

 

use search form top right all site pages.

search on string: indicator into EA

you will find results catagorised by area on left page column list.

 

EA's can't draw using indicator buffers, so anything you want an EA to draw would have to be done using objects.

The usual method is for the EA to use iCustom() to get values from indicators if needed.

If you want to see the indicators just attach them to the chart along with the EA.

 

EA's, indicators, or scripts all have distinct jobs. It is never recommended to use indicator code directly inside an EA mainly for performance issues and the lack of debugging possibilities. Here's a few points to remember about each.

.

EA's:

1. They can get values directly from indicators

2. They can place trades automatically

3. They can grow more complex and even maintain databases if needed

4. They can call DLL's (dynamically loaded libraries) which takes advantage of the full power of other compiled languages. Meaning your possibilities are limitless.

5. Much much more

.

Indicators:

1. They can represent graphically how its values are calculated so you can see the market with a different view than plain candles

2. They can easily recalculate the current bar only (this is due to indicator specific functions in mql4 programming language)

.

Scripts:

1. Scripts have a specific job. Not something that will run on every tick, just when you want it to. They are meant to be simplistic in nature yet very useful in certain situations.

.

Keep that in mind.. It would be a lot better for you to take advantage of each type as they are meant to be used.

.

Jon

 
phy wrote >>

EA's can't draw using indicator buffers, so anything you want an EA to draw would have to be done using objects.

The usual method is for the EA to use iCustom() to get values from indicators if needed.

If you want to see the indicators just attach them to the chart along with the EA.

Thank you that's what I have been doing, I was just curious about integration.

 
Archael wrote >>

EA's, indicators, or scripts all have distinct jobs. It is never recommended to use indicator code directly inside an EA mainly for performance issues and the lack of debugging possibilities. Here's a few points to remember about each.

.

EA's:

1. They can get values directly from indicators

2. They can place trades automatically

3. They can grow more complex and even maintain databases if needed

4. They can call DLL's (dynamically loaded libraries) which takes advantage of the full power of other compiled languages. Meaning your possibilities are limitless.

5. Much much more

.

Indicators:

1. They can represent graphically how its values are calculated so you can see the market with a different view than plain candles

2. They can easily recalculate the current bar only (this is due to indicator specific functions in mql4 programming language)

.

Scripts:

1. Scripts have a specific job. Not something that will run on every tick, just when you want it to. They are meant to be simplistic in nature yet very useful in certain situations.

.

Keep that in mind.. It would be a lot better for you to take advantage of each type as they are meant to be used.

.

Jon

Thank you also, again, I was just curious, but you have made some good points that should be kept in mind.

It quite nice to have people with experience in this to communicate with.

Just out of curiosity, When I run the MetaTrader software, it appears to be eating up the memory in my computer. Have you or anyone else ever experienced such a thing?

For example, I uninstalled, and reinstalled MetaTrader 4, My free space on my harddrive was 56%, out of curiosity, I looked, after an hour, and my freespace was down to 32%.

Is it possible, that I am overworking the systems capabilities?

Any suggestions on what I should be looking at.

 

Please bear in mind that is very possible to emulate indicator calculations without plots in EA - the calculated data is what's important.

Considerations can be: time taken to integrate into EA or function + testing accuracy against separate indicator + proving that speed is better + having good reason such as wanting all functionality within one executable.

Transferring an Indicator Code into an Expert Advisor Code. General Structural Schemes of an Expert Advisor and Indicator Functions

 
Hi, abonifi, MetaTrader normally occupies a maximum of 30 mb on your drive when freshly installed. Go into your MetaTrader Folder and see which folder is the biggest...you might have downloaded much history data when you backtested...your "History" folder would have grown pretty much then.
 

Memory and hard drive are very different things. If your hard drive is being eaten up, it could be due to history like ErrorProgrammer said or anything else related to actual files. If it's your memory (RAM), look to make sure you don't have too many "max bars in chart" in your MT4 options. This eats up memory pretty bad when too big.

.

Jon

 

Thank you all for the Help, It appears you are correct about the backtested data in the history log.

I must say its nice to have a forum available with people who actually have insight and an willingness to assist.

Thank you all again.

Tony

 
Ray:

EA's can't draw using indicator buffers, so anything you want an EA to draw would have to be done using objects.

The usual method is for the EA to use iCustom() to get values from indicators if needed.

If you want to see the indicators just attach them to the chart along with the EA.

Hi,

I have a query, does the indicator from which EA is trying to draw data has to be activate on the chart (on which you are running the EA) or just have to be their in the indicator folder?

Reason: