Coding help - page 427

 
AtApi:
Thank you mladen although is not exactly what im looking for...the doublezigzag doesnt repaint(both zigzag aligned) because its based on fractals ..those point are the one where i`d like to build the triangle from..

itried to modify the code a bit in order to get the most 2 recent upper signal and the 2 most recent lower signal but im kind of stuck..let me show you what im trying to do:

this part is the one that paint the signal when both zigzag are aligned:

// Do both zigzag agree on the signal?

if(SlowSignal == FastSignal && SlowSignal != EMPTY_VALUE)

{

if(SlowSignal == OP_BUY)

{

ExtMapBuffer3 = fr_support - nShift*Point;

} else {

ExtMapBuffer3 = fr_resistance + nShift*Point;

}

[/CODE]

after this i want to get the most recent upper and the previously upper and most recent lower and the previously lower like this

[CODE]

HighOldest = ExtMapBuffer3[ArrayMaximum(ExtMapBuffer3,BarsBack,i+2)];

LowOldest = ExtMapBuffer3[ArrayMinimum(ExtMapBuffer3,BarsBack,i+2)];

so i theory i should have the recent from ExtMapBuffer3 and the oldest from HighOldest

then i will have the 2 point to construct the trendlines..

but for some reason there must be an EMPTY_VALUE somewhere in the buffer because when i do ArrayMaximum it will return the EMPY_VALUE as Maximun value in the array

i hope is clear...

Nevermind i have solved it !

 
mladen:
TFI You have one extra parameter that should not be there : the "" after the indicator name (after "Efficiency_v1.1"). Delete the "" part (empty string) after the indicator name name

Hi Mladen,

thank you very much for your suggestion. I wonder if I may have catch the signal of the filter kind of wrong, because the EA is not open a trade anymore even though the constraint for opening a long / short trade is fulfilled (zero line is crossed). Could you probably review my code with your expertise?

Thank you very much (again) :-)

if(openedOrders<=0)

{

double trend_up = iCustom(Symbol(),0,"Hull moving average 2 strict nmc","", HMA_Period, HMA_Price, HMA_Speed,0,3,1);

double trend_down = iCustom(Symbol(),0,"Hull moving average 2 strict nmc","", HMA_Period, HMA_Price, HMA_Speed,0,3,2);

double trendf_up = iCustom(Symbol(),0,"Efficiency_v1.1",Price,Length,Smooth,Signal,MA_Mode,NoiseMode,0,1,1); // Signal Buffer 1

double trendf_down = iCustom(Symbol(),0,"Efficiency_v1.1",Price,Length,Smooth,Signal,MA_Mode,NoiseMode,0,1,2);

int clongs = 0;

int cshorts = 0;

for(i=OrdersTotal()-1;i>=0; i--)

{

if(OrderType()==OP_BUY) clongs++; // Check # of long trades.

if(OrderType()==OP_SELL) cshorts++; // Check # of short trades

}

if(trend_up!=trend_down)

{

if((clongs 0 && trendf_down<0)) OpenBuy(); // Indicator and filter = long

if((cshorts < maxshorttrades && trend_down==-1) && (trendf_up0)) OpenSell(); // Indicator and filter = short

}

}

With kind regards,

TFI

Files:
betrade.jpg  76 kb
 

Hello everybody, I am using (manually) indicator AbsoluteStrength.

Can someone please add Alarm, when blue line is crossed with dashed blue line or red line is crossed with dashed red line (as shown on attached screenshot).

allabsolutestrength_v2.3_600.mq4

Thank you very much

Petr Jahoda

 

Hello Pro-Coders,

I wonder whether the calculation of my ADX trend strength filter may be correct:

bool ADX_filter()

{

bool result=false;

double ADXfactor= 1;

double ADXminus = iADX(Symbol(),0,14,PRICE_OPEN,MODE_MINUSDI,0);

double ADXplus = iADX(Symbol(),0,14,PRICE_OPEN,MODE_PLUSDI,0);

double ADXmain = iADX(Symbol(),0,14,PRICE_OPEN,MODE_MAIN,0);

if(ADXplus>ADXfactor*ADXminus && ADXmain>=20 && ADXmain<=40) result=true; // buy

if(ADXminus=20 && ADXmain<=40) result=false; // sell

return(result);

}

[/CODE]

It may be called like this:

[CODE]

if(clongs<maxlongtrades && trend_up==1 && (ADX_filter()==true)) OpenBuy();

Thank you.

 
tfi_markets:
Hello Pro-Coders,

I wonder whether the calculation of my ADX trend strength filter may be correct:

bool ADX_filter()

{

bool result=false;

double ADXfactor= 1;

double ADXminus = iADX(Symbol(),0,14,PRICE_OPEN,MODE_MINUSDI,0);

double ADXplus = iADX(Symbol(),0,14,PRICE_OPEN,MODE_PLUSDI,0);

double ADXmain = iADX(Symbol(),0,14,PRICE_OPEN,MODE_MAIN,0);

if(ADXplus>ADXfactor*ADXminus && ADXmain>=20 && ADXmain<=40) result=true; // buy

if(ADXminus=20 && ADXmain<=40) result=false; // sell

return(result);

}

[/CODE]

It may be called like this:

[CODE]

if(clongs<maxlongtrades && trend_up==1 && (ADX_filter()==true)) OpenBuy();

Thank you.

tfi_markets

As far as the function is concerned, yes, it can be called like that

 
mladen:
tfi_markets As far as the function is concerned, yes, it can be called like that

Hi Mladen,

thank you for your comment. I would like to keep my code primarily simple and bug free, especially since debugging with MQL4 / MT4 can be a challenge.

Lets assume I would like to trade primary stronger trends where the ADX is over 20, I may also code this a bit simpler like:

bool ADX_filter()

{

bool result=false;

if(iADX(NULL,0,14,PRICE_HIGH,MODE_MAIN,0)>20) result = true; // buy

if (iADX(NULL,0,14,PRICE_HIGH,MODE_MAIN,0)<20) result = false; // sell

return (result);

}

if(clongs1 && ADX_filter()==true)) OpenBuy();

if(cshorts<maxshorttrades && trendc==-1 &&(CCIFilter<-1 && ADX_filter()==false)) OpenSell()

Right?

Thank you in advance, and have a nice weekend.

 

Hi.

Lately I have been using hull moving average and tought that i should also try HMA slope in an indicator window, i found it but it wont function properly in my mt4 platform.

hull_moving_average_2.01_amp_sr_lines_separate.mq4

Thanks

 
NWFstudent:
Hi.

Lately I have been using hull moving average and tought that i should also try HMA slope in an indicator window, i found it but it wont function properly in my mt4 platform.

hull_moving_average_2.01_amp_sr_lines_separate.mq4

Thanks

looks like you have half of the problem solved already!

 
NWFstudent:
Hi.

Lately I have been using hull moving average and tought that i should also try HMA slope in an indicator window, i found it but it wont function properly in my mt4 platform.

hull_moving_average_2.01_amp_sr_lines_separate.mq4

Thanks

NWFstudent

Change the 2nd color from black to some other color (and set the 3rd color to same color as 2nd color) Right now you don't see it simply because background and 2nd color are the same - black

 
mladen:
NWFstudent Change the 2nd color from black to some other color (and set the 3rd color to same color as 2nd color) Right now you don't see it simply because background and 2nd color are the same - black

wow, now im feeling like a total dumbass

I was looking in input an colour up was blue and down was red, but ofcourse you were right like always.

Im sorry for being a retard