ICustom function - page 17

 

Ok! Thanks

 

So this is how far Ive come after reading the icustom page.

int ergodictrend;

double ergodic1,ergodic2,ErgodicBuffer,Signal_Buffer;

ergodic1 = iCustom(NULL, 0, "Ergodic Osc",ErgodicBuffer,0,0);

ergodic2 = iCustom(NULL, 0, "Ergodic Osc",Signal_Buffer,0,1);

if(ergodic1>ergodic2) ergodictrend = 1;

if(ergodic1<ergodic2) ergodictrend = -1;

But now it only opens sell orders.

What am I doing wrong?

 
OneandOnly666:
So this is how far Ive come after reading the icustom page.

int ergodictrend;

double ergodic1,ergodic2,ErgodicBuffer,Signal_Buffer;

ergodic1 = iCustom(NULL, 0, "Ergodic Osc",ErgodicBuffer,0,0);

ergodic2 = iCustom(NULL, 0, "Ergodic Osc",Signal_Buffer,0,1);

if(ergodic1>ergodic2) ergodictrend = 1;

if(ergodic1<ergodic2) ergodictrend = -1;

But now it only opens sell orders.

What am I doing wrong?

It depends on the rest of the code

The code you posted seems OK

 
mladen:
It depends on the rest of the code The code you posted seems OK

Im using a simple (ergodictrend0) for buyorders.

Without them the EA is doing buy and sell orders as it should. I just added this to make it follow the trend of the ergodic, buy orders when ergodic-line is over the signal-line and sell orders when the ergodic-line is under the signal-line.

If i follow the indicator on the chart, it doesnt do the sell and buy orders it should do, instead it only opens the sell orders.

 
OneandOnly666:
Im using a simple (ergodictrend0) for buyorders.

Without them the EA is doing buy and sell orders as it should. I just added this to make it follow the trend of the ergodic, buy orders when ergodic-line is over the signal-line and sell orders when the ergodic-line is under the signal-line.

If i follow the indicator on the chart, it doesnt do the sell and buy orders it should do, instead it only opens the sell orders.

Why don't you use (ergodictrend==-1) for sellorder and (ergodictrend==1) for buyorder?

 
mladen:
Why don't you use (ergodictrend==-1) for sellorder and (ergodictrend==1) for buyorder?

If I do that the backtest takes longer time and it doesnt do any buy or sell.

Strange, isnt that the same as my way of writing it?

 
OneandOnly666:
If I do that the backtest takes longer time and it doesnt do any buy or sell. Strange, isnt that the same as my way of writing it?

Check the rest of the code

Those conditions should not slow down the EA and are OK

 
mladen:
Check the rest of the code Those conditions should not slow down the EA and are OK

If I dont use the ergodictrend at all, it doesnt slow down. Only when i write (ergodictrend==1) and (ergodictrend==-1)

I could be wrong though. Eather way it doesnt make any buy orders when it should when I use (ergodictrend0) and it doesnt make any buy or sell orders at all when I do it your way.

Is it something in the Ergodic Indicator that doesnt work with my EA.

Dont know how to upload the indicator here for you to see it, but maybe you have it allready?

 
OneandOnly666:
If I dont use the ergodictrend at all, it doesnt slow down. Only when i write (ergodictrend==1) and (ergodictrend==-1)

That part of the code can not slow down the EA

Please, as I told you, check the rest of your code and what is done in it

All the best

 
mladen:
That part of the code can not slow down the EA

Please, as I told you, check the rest of your code and what is done in it

All the best

Ok!

Thanks for the help, will look in to it and see if I can find the problem.