Ask! - page 75

 

need help for simple script for ea

hai..

new coder here..

just start to learn..

any idea how to write an ea for this situation :

1) if current price now at 1.300

2) we set 1st post pending order buy stop at 1.310 and TP at 1.320 and 2nd post pending order buy stop at 1.325 and TP at 1.330

3) if price go up and hit 1st buy stop and hit TP and close that order we want set again 1 post pending order buy (buylimit at 1.310 again and TP at 1.320).

4) if price go down and hits 1.310 (buy limit) and after that go up again and hit TP (1.320). and again once it hit TP at 1.320 and close that order we want set again 1 post pending order buy (buylimit at 1.310 again and TP at 1.320).

5) if after that price go up and hit the 2nd pending order buy stop at 1.325 and hit the TP at 1.330.once once it hit TP and close that order we want set again 1 post of 2nd pending order buy (buylimit at 1.325 again and TP at 1.330).

my english is bad

i hope you guys can imagine what situation i mean

TQ

 

> = Question

Low[0]> iLow(NULL, 0, Lowest(NULL,0,MODE_LOW,20,1))

Why won't this allow Low[0] >= iLow(NULL ..............

What's the answer??? How do you get around this??

Dave

This language is something else??

 

Maybe use iLowest() ???

Low[0]> iLow(NULL, 0, iLowest(NULL,0,MODE_LOW,20,1))

I don't understand the question, so I don't know if this is the right answer...

 

Part of this equation is using iLowest() I believe. Anyhow, this is what someone in the past told how to code this. But when I use it I can compare it as a > to, but I cannot compare it to an = to - Strange??

Dave

 
1Dave7:
Part of this equation is using iLowest() I believe. Anyhow, this is what someone in the past told how to code this. But when I use it I can compare it as a > to, but I cannot compare it to an = to - Strange?? Dave

If you want to check the equality, use "==", not "="

 

You are sooo right!

Tired brain!

Dave

 

How do you capture the currency symbol for comparison??

Figured it out.

 

comparison

1Dave7:
Figured it out.

I'm using this:

string NZD_USD[]={"NZDUSD"};

....

if ((NZD_USD[last_time]==TimeCurrent()) && JumpPips > 2) return(0);

...

but I have an error message:

..different type of comparison.

Thanks for help

B.

 

I have a small question:

I'm trying to use a LWMA as a exit point for an EA when it turns direction. So I have the following code:

Moving Averages defined as:

MA_EXIT_0=iMA(NULL,PERIOD_H1,MA_Exit,0,MODE_LWMA,PRICE_WEIGHTED,0);

MA_EXIT_1=iMA(NULL,PERIOD_H1,MA_Exit,0,MODE_LWMA,PRICE_WEIGHTED,-1);[/PHP]

Exit point:

[PHP]if(OrderType()==OP_BUY)

{

if(MA_EXIT_0<MA_EXIT_1) OrderClose(OrderTicket(),OrderLots(),Bid,3,White);

break;

}

if(OrderType()==OP_SELL)

{

if(MA_EXIT_0>MA_EXIT_1) OrderClose(OrderTicket(),OrderLots(),Ask,3,White);

break;

}

It's not the complete code, but somehow it's not working so I need a little help, please.

 

This is wrong: previous bars are positive counted

MA_EXIT_1=iMA(NULL,PERIOD_H1,MA_Exit,0,MODE_LWMA,PRICE_WEIGHTED,-1);[/PHP] Use this instead:[PHP]MA_EXIT_1=iMA(NULL,PERIOD_H1,MA_Exit,0,MODE_LWMA,PRICE_WEIGHTED,1);
Reason: