Please fix this indicator or EA - page 94

 

REG. why not working GOMO_BUY_SELL EAs

dear traders and ea code masters

why not working GOMO_BUY_SELL EAs

help you

thank you advance

 
Gfuchs:
Hi, can anyone of the elders please be so kind and help me with this one?

I made an attempt to integrate this indicator in the attached EA...but there are still some errors in the code...

I think I am getting closer. When I made changes to the code as seen below...

it gave me different error messages, something like "wrong dimension"...and I believe in that.

int start(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double kr[],no[],trend[];

if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){

kr[] =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,0,i);

no[] =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,1,i+1);

trend[]=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,i+1);

if(no[]!= 1&&kr[]==1 ){if(Reverse)SV=1;else BV=1;break;}

if(no[]!=-1&&kr[]==-1){if(Reverse)BV=1;else SV=1;break;}}

then I tried the following changes and I get no more error messages int start(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double kr[],no[],trend[];

if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){

kr =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,0,i);

no =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,1,i+1);

trend=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,i+1);

if(no!= 1&&kr==1 ){if(Reverse)SV=1;else BV=1;break;}

if(no!=-1&&kr==-1){if(Reverse)BV=1;else SV=1;break;}}

But I guess there is still something wrong with the code.

If one of the experts can have a look at it would be greatly appreciated.

 
Gfuchs:
I think I am getting closer. When I made changes to the code as seen below...

it gave me different error messages, something like "wrong dimension"...and I believe in that.

int start(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double kr[],no[],trend[];

if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){

kr[] =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,0,i);

no[] =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,1,i+1);

trend[]=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,i+1);

if(no[]!= 1&&kr[]==1 ){if(Reverse)SV=1;else BV=1;break;}

if(no[]!=-1&&kr[]==-1){if(Reverse)BV=1;else SV=1;break;}}

then I tried the following changes and I get no more error messages int start(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double kr[],no[],trend[];

if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){

kr =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,0,i);

no =iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,1,i+1);

trend=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,i+1);

if(no!= 1&&kr==1 ){if(Reverse)SV=1;else BV=1;break;}

if(no!=-1&&kr==-1){if(Reverse)BV=1;else SV=1;break;}}

But I guess there is still something wrong with the code.

If one of the experts can have a look at it would be greatly appreciated.

Gfuchs

Can you explain what is exactly your intention with the indicator values?

 
mladen:
Gfuchs Can you explain what is exactly your intention with the indicator values?

Hi Mladen, well I don´t know too much about coding but if I am right then there should be two important values. Value for Sell and Value for Buy? "kr" and "no" ? I don´t know how to handle "trend"

Basically I just want the XO indicator to work with the EA as it should...I don´t know how to explain otherwise.

 
Gfuchs:
Hi Mladen, well I don´t know too much about coding but if I am right then there should be two important values. Value for Sell and Value for Buy? "kr" and "no" ? I don´t know how to handle "trend" Basically I just want the XO indicator to work with the EA as it should...I don´t know how to explain otherwise.

Gfuchs

Value from "trend" buffer is the simplest to use. When there is 1 in trend buffer, then the trend is up, and when the value of the trend buffer is -1, then the trend is down

 
mladen:
Gfuchs Value from "trend" buffer is the simplest to use. When there is 1 in trend buffer, then the trend is up, and when the value of the trend buffer is -1, then the trend is down

Dear Mladen, thanks a lot for your help and the training lesson.

I hope I understood what you mean. Am I right that "kr[] and no[]" can be discarded in this case ?

So my result would look like this. Although I am not sure about the bit after "BoxPeriod". Meaning: ",4,i+1);"

// expert start function

int start(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double trend[];

if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){

trend=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,i+1);

if(trend!= 1&&kr==1 ){if(Reverse)SV=1;else BV=1;break;}

if(trend!=-1&&kr==-1){if(Reverse)BV=1;else SV=1;break;}}

 
Gfuchs:
Dear Mladen, thanks a lot for your help and the training lesson.

I hope I understood what you mean. Am I right that "kr[] and no[]" can be discarded in this case ?

So my result would look like this. Although I am not sure about the bit after "BoxPeriod". Meaning: ",4,i+1);"

// expert start function

int start(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double trend[];

if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){

trend=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,i+1);

if(trend!= 1&&kr==1 ){if(Reverse)SV=1;else BV=1;break;}

if(trend!=-1&&kr==-1){if(Reverse)BV=1;else SV=1;break;}}

Gfuchs

Try something like this :

currentTrend=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,0);

previousTrend=iCustom(NULL,0,"XO clean_mtf + alerts + lines",TimeFrame,BoxPeriod,4,1);

if (currentTrend!=previousTrend) // change of trend -> signal

if (currentTrend==1)

... code for buy

else ... code for sell
 
mladen:
Gfuchs

Try something like this :

if (currentTrend!=previousTrend) // change of trend -> signal

if (currentTrend==1)

... code for buy

else ... code for sell

Mladen,

thanks again. I tried several hours now but I can´t make it running. Sorry I am not too familiar with coding. So far I have this. Is that correct ?

if(currentTrend!=previousTrend)

if(currentTrend==1) {if(Reverse)SV=1;else BV=1;break;}

else{if(Reverse)BV=1;else SV=1;break;}}

But this doesn´t seem to work because it opens and closes trades as soon as there is a trend change signal and although "AlertOnCurrent" is set to false.

Please, do you have any further advice?

 
Gfuchs:
Mladen,

thanks again. I tried several hours now but I can´t make it running. Sorry I am not too familiar with coding. So far I have this. Is that correct ?

if(currentTrend!=previousTrend)

if(currentTrend==1) {if(Reverse)SV=1;else BV=1;break;}

else{if(Reverse)BV=1;else SV=1;break;}}

But this doesn´t seem to work because it opens and closes trades as soon as there is a trend change signal and although "AlertOnCurrent" is set to false.

Please, do you have any further advice?

Gfuchs

Change the indexes in iCustom() calls for currentTrend and previousTrend from 0 and 1 to 1 and 2 and then you will have orders opened on a closed bar signal

 
Phylo:
New Bar Alert fires on Change of TimeFrame

Hi Mladen and others

Function: The below code fires an Alert on every New Bar/Candle.

Problem: The Alert also fires every time the Timeframe is changed.This is undesirable.

Solution: How to stop the alert firing on Timeframe change yet retail New Bar Alert function.

static datetime tmp;

if(tmp < Time [o])

{

tmp = Time [o];

if(NewBar_Alert == true)

{

Alert("New Bar - ", Symbol());

}

}
Thanks in advance.

Phylo

No solution for that (except if you wish to use a global variable for that but then it would over complicate the whole thing)