ICustom function - page 3

 

Mostly for testing/verification

I develop my strategies with an indicator, and want to verify that the EA is working the way the indicator did. If I get a little more experience with MT4 under my belt, maybe I can make the meat of the indicator logic a subroutine or a DLL and then call it from both my indicator and EA.

When you use the tester, you can open a chart. If I could override that logic I could put objects on that chart as well.

Does anybody know of some EAs that show you graphically what they're doing?

 

I made my first ICustom using Fisher m11 as the custom. It shows the indicator in the tester which is nice chart but is a loser most of the time. Fisher m11 is an indicator and needs to be in that folder. Fisher Auto EA m11 must be in the experts folder. Here is the way I placed it in the EA:

iCustom(NULL,0,"Fisher_m11",Fisher_Period, IndexSmoothing,PriceSmoothing,0);

Here is the format to use it : double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

It may help some who are working on creating their own EAs.

 

I have a similar question.

Does any one know how to use

SHI_SilverTrendSigAlert

and

SilverTrend_Signal With Alert v3

in a EA?

I need a professional help.

 

SilverTrend is nice for trading but the signal will go on and off until the bar closes which can be hard on making an EA. I have included a zip of 12 Silver EAs for you to look at.

Files:
 

Just wanted to get the end values of the iCustom line clarified in my head.

Line and Shift

So if I have an Indicator like VQ that only has one graphical line and I what to find out, on the previous closed candle, if it signaled up Arrow for a Buy condition or if it signaled a Sell condition by going down Arrow I would need to set up two condition like;

double VQ0 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 1,1);

double VQ1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 2,1);

[/code]

So the above is going to check for an up condition (up) or sell (down) condition on the closed bar, correct?

Then my Buy and Sell code should be; correct?

//Buy

if (VQ0>VQ1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

//Sell

if (VQ0<VQ1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

[/code]

Now if I wanted to add a second indicator so that TWO conditions need to be met at the same time to trigger a trade, it has two graphical lines (Don't know if it matters by how many lines it has, the indicator knows what it's Buy and Sell conditions are, correct?) My code would change to;

[code]

double VQ0 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 1,1);

double VQ1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 2,1);

double QQEA0 = iCustom(NULL, 0, "QQEA",5,14,4.236, 1, 1);

double QQEA1 = iCustom(NULL, 0, "QQEA",5,14,4.236, 2, 1);

and Buy and Sell code should be

[code]

//Buy

if (VQ0>VQ1 && QQEA0>QQEA1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

//Sell

if (VQ0<VQ1 && QQEA0<QQEA1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

Edit: Just did a back test and it seems to be trading like every M30 (Chart TF). I only want it to initiate the trade ONLY at first Signal condition then wait until the next opposite signal condition. Seems like when both indicators agree on a Buy then it trades then when that trade is closed it continues another Buy trade on next candle if conditions are still met. That is not what I want I Only want one trade per Buy/Sell Signal. Thanks

Attached are two EA's one called My First EA that someone modified for me because they thought the conditions were wrong and one I did using a template call YourExpertAdvisor. Are they both correct?

Thank you

 

If I understand it right, you want your EA to treat an unbroken series of indicator agreement as "one signal", rather than that each occasion of agreement is a signal.

One way to do so, is to make it a stateful EA and use a design as follows:

static int last_signal = 0;

int signal = 0;

if ( ) signal = 1;

if ( ) signal = -1;

if ( signal != 0 && signal != last_signal ) {

// New signal series...

}

last_signal = signal;

 
ralph.ronnquist:
If I understand it right, you want your EA to treat an unbroken series of indicator agreement as "one signal", rather than that each occasion of agreement is a signal.

One way to do so, is to make it a stateful EA and use a design as follows:

static int last_signal = 0;

int signal = 0;

if ( ) signal = 1;

if ( ) signal = -1;

if ( signal != 0 && signal != last_signal ) {

// New signal series...

}

last_signal = signal;

Hi Ralph, maybe this thread I started will be more clear;

https://www.mql5.com/en/forum/178432

Thanks

 
codersguru:
homicida,

I'm so sorry for the delay.

Please find attached modified version of LSMA and iCustom_Demo.

I've added a new buffer to LSMA to hold the current color (1=red, 2=green and 3=yellow).

Where's (1=downtrend , 2=uptrend and 3=no trend).

To use iCustomfunction to get the value of this buffer, you may write:

double clr = iCustom(NULL,0,"LSMA in Color",14,1500,5,0);

Thanks Codersguru!!

I was able to create a version of my Digital Compass to use with disk indicators.

 

It would be nice if you, TheRumpledOne, also learn how to attach images rather than make them inline; with the junk you paste in, it just wastes a lot of space.

 
ralph.ronnquist:
It would be nice if you, TheRumpledOne, also learn how to attach images rather than make them inline; with the junk you paste in, it just wastes a lot of space.

If it's "junk", then why post it at all?