ICustom function - page 20

 
Jeeves:
Could some kind soul put me out of my misery & recdo the stuff below to allow the use of the 'Advanced_ADX' indicator. I know it requires the use of the 'icustom' function, but I have know idea how to do it.

//h1 data

double h1adm = iadm(NULL,PERIOD_H1,2,MODE_CLOSE);

//h4 data

double h4adx = iadx(NULL,PERIOD_H4,2,MODE_CLOSE);

//d1 data

double d1adx = iadx(NULL,PERIOD_D1,2,MODE_CLOSE);

//define color

color color_h1, color_h4, color_d1;

//define string

string arrow_h1, arrow_h4, arrow_d1;

//h1 up trend

if (h1adx < Bid ) { color_h1 = ColorUpGood; }

//h1 down trend

if (h1adx > Bid ) { color_h1 = ColorDownGood; }

//h4 up trend

if (h4adx < Bid ) { color_h4 = ColorUpGood; }

//h4 down trend

if (h4adx > Bid ) { color_h4 = ColorDownGood; }

//d1 up trend

if (d1adx < Bid ) { color_d1 = ColorUpGood; }

//d1 down trend

if (d1adx > Bid ) { color_d1 = ColorDownGood; }

use something like this :

double h1adp=iADX(NULL,PERIOD_H1,ADXPeriod,PRICE_CLOSE,MODE_PLUSDI, 0);

double h1adm=iADX(NULL,PERIOD_H1,ADXPeriod,PRICE_CLOSE,MODE_MINUSDI,0);

if (h1adp > h1adm ) { color_h1 = ColorUpGood; }

if (h1adp < h1adm ) { color_h1 = ColorDownGood; }

and do that for all the time frames you want to test (you might want to replace the 0 at the end with some other number - 0 => current bar, 1 => first closed bar and so on)

 

Programming Problems 2 Questions pls Help (log files) (Custom Indicator/ Standard Ind

Hi i hope i can find someone who can help me to solve this problem, i would be very thankful

  • Initial Situation:
  • We developed a multichannel filterindicator based on different standard indicators calculationes from Metatrader.

    This indicator was conceived to be used in our expert advisor. The challenge is,

    that on each tick all calculations based on these standard indicators cause innumerable log entries.

    Because of this our trades are delayed.

    Is it possible to avoid the log entries?

  • Our attempt to solve the problem:

We got custom indicators programmed like the the standard indicators. We tried to change the standrad course calculation used by the different indicators. But these doesn't bring the expacted outcome.

By using the standard course calculation the standard indicator brings the same result as the custom indicator do. But changing the course calculation

induce to differences in respect of the custom indicator an the corresponding standard indicator?

Is it possible to get custom indicators which behave exactly like the stnadard indicators(no matter which course calculation ins choosen)?

 
spongebozz:
Hi i hope i can find someone who can help me to solve this problem, i would be very thankful
  • Initial Situation:
  • We developed a multichannel filterindicator based on different standard indicators calculationes from Metatrader.

    This indicator was conceived to be used in our expert advisor. The challenge is,

    that on each tick all calculations based on these standard indicators cause innumerable log entries.

    Because of this our trades are delayed.

    Is it possible to avoid the log entries?

  • Our attempt to solve the problem:

We got custom indicators programmed like the the standard indicators. We tried to change the standrad course calculation used by the different indicators. But these doesn't bring the expacted outcome.

By using the standard course calculation the standard indicator brings the same result as the custom indicator do. But changing the course calculation

induce to differences in respect of the custom indicator an the corresponding standard indicator?

Is it possible to get custom indicators which behave exactly like the standard indicators(no matter which course calculation ins choosen)?

Hi Spongebozz,

This is for the first part of your questions...regarding logs too big and slowing your system down...

The logs are most likely created from PRINT statements...too many of them...either in your EA's and/or your indicators...

You can remove or blank out the PRINT statements by placing 2 right (//) slashes in front of every PRINT statement you want to stop printing to the log.

Example:

// Print("This is an example"); The // will blank out the code line and not Print to the log...

If you want...ALL...PRINT statements blanked out...you can do a find/replace...

Find: Print

Replace: // Print

The type of indicator standard or custom...should not matter...

It only matters if it has lots of PRINT statements you need to remove or blank out...

And later you can always go back and un-blank the PRINT statements you want...and leave the others blanked out or delete them completely.

Hope this helps you,

Robert

 

Hi guys!

I am making an EA for Binary Options and want to get "signals" from an indicator to be received in my EA. As you probably know, Binary Options only make a PUT or a CALL so I want iCustom to just listen to my indicator and making the puts and calls in my EA. Makes sense?

So, what do I need to do?

In the indi I just need to put something like this:

// PUT

if (AlignsForAput == true){

PutBuffer[] = 1;

}

// CALL

if (AlignsForAcall == true){

CallBuffer[] = 1;

}

PutBuffer[] = 0;

CallBuffer[] = 0;

Please help me writing a good example on how to make this work. What do I need to write and WHERE do I write it?

Thanks!

 

I would really appreciate if someone could write a simple example of how the indi code and the EA code should look like! Please see above about my question.

 
SantaClaus:
I would really appreciate if someone could write a simple example of how the indi code and the EA code should look like! Please see above about my question.

For indicators check this : https://www.mql5.com/en/forum/173032 and this https://www.mql5.com/en/forum/173054

For EAs check this : https://www.mql5.com/en/forum/173136 and this : https://www.mql5.com/en/forum/173171

 

So you are telling me there are good examples there how to use iCustom for above purpose?

 
SantaClaus:
So you are telling me there are good examples there how to use iCustom for above purpose?

Yes, that is exactly what I am telling (you asked for "a simple example of how the indi code and the EA code should look like" - those threads can help you)

 
mladen:
Yes, that is exactly what I am telling (you asked for "a simple example of how the indi code and the EA code should look like" - those threads can help you)

Nope, none of the links explained how I use iCustom as I would like in my first question.

 
SantaClaus:
Nope, none of the links explained how I use iCustom as I would like in my first question.

You are posting in a thread that explains in detail how to use iCostom() (all you have to do is to go to the first page of this thread) and you can not find how to do that?

Here is a short version :

_________________________

iCustom

Calculates the specified custom indicator and returns its value.

[TABLE] double iCustom(

string symbol, // symbol

int timeframe, // timeframe

string name, // path/name of the custom indicator compiled program

... // custom indicator input parameters (if necessary)

int mode, // line index

int shift// shift

);[/TD]

[/TR]

[/TABLE]

Parameters

symbol

Symbol name on the data of which the indicator will be calculated. NULL means the current symbol.

timeframe

Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.

name

Custom indicator compiled program name, relative to the root indicators directory (MQL4/Indicators/). If the indicator is located in subdirectory, for example, in MQL4/Indicators/Examples, its name must be specified as "Examples\\indicator_name" (double backslash "\\"must be specified as separator instead of a single one).

...

Custom indicator input-parameters, separated by commas.

The passed parameters and their order must correspond with the declaration order and the type of extern variables of the custom indicator. If the values of input parameters is not specified, the default values will be used.

mode

Line index. Can be from 0 to 7 and must correspond with the index, specified in call of the SetIndexBuffer() function.

shift

Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

Returned value

Numerical value of the specified custom indicator. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\MQL4\Indicators\ directory.

Example:

[TABLE]

[TR]

[TD] double val=iCustom(NULL,0,"SampleInd",13,1,0); [/TABLE]

_________________________

PS: the "Line index. Can be from 0 to 7" is the error that metatrader still has in its documentation (it should be "Line index. Can be from 0 to 511"), but as long as they do not change officially their documentation, I will stick to their definition of the iCustom() function

Happy coding