Need help concerning simple coding

 

Hi everyone !

Please forgive my bad english...I am french...nobody is perfect... ^^

Well, I would like to know if you could help me because i'm completely a noob in MQL4.

I am trying to make an easy EA wich will place pending BUYSTOP and SELLSTOP orders on the highest and lowest price of the last 3 candlesticks. If the price reaches these levels, orders will be placed automatically...

This robot should update data to place new order when the highest and the lowest price on the last three candlesticks change...

I do not think it is too difficult but...well...i am kinda....getting crazy....

Here is what I wrote...and I think there are many mistakes because I cannot compile...

I would greatly thank you if you can help me....

Nicolas


//+------------------------------------------------------------------+
//| FM.mq4 |
//| N |
//| |
//+------------------------------------------------------------------+
#property copyright "N"
#property link ""


extern double lots = 0.01;
extern int stop = 21;
extern int limite = 7;
int magic = 52565256;
double TheHaut;
double TheBas;
int heure;
int minute;
int seconde;
int jour;
int mois;
int annee;


//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
heure= Hour();
minute = Minute();
seconde = Seconds();
jour = Day();
mois = Month();
annee = Year();
Comment("Heure: "+heure+":"+minute+":"+seconde+" "+"Date: "+jour+"/"+mois+"/"+annee);
//----

TheHaut=High[iHighest(NULL,0,MODE_HIGH,3,1)]; 
TheBas=Low[iLowest(NULL,0,MODE_LOW,3,1)];

//----

OrderSend(Symbol(), OP_BUYSTOP, lots, TheHaut, 3, TheHaut - (stop *
Point), TheHaut + (limite * Point), magic, 0, Blue);
OrderSend(Symbol(), OP_SELLSTOP, "lots", "TheBas", 3, TheBas + (stop *
Point), TheBas - (limite * Point), magic, 0, Red);

//----

return(0);
}
//----
 


all variables should be written without quotation marks

 
qjol:

i said

all variables should be written without quotation marks

like this

OrderSend(Symbol(), OP_BUYSTOP, lots, TheHaut, 3, TheHaut - (stop *
Point), TheHaut + (limite * Point), magic, 0, Blue);


without this ------> "
 

qjol,

thank your for your help.

I did as you said and I compiled successfully but there is no pending order.appearing when I attached the EA...Did i do another mistake ?

Thanks a lot

 
waldganger:

qjol,

thank your for your help.

I did as you said and I compiled successfully but there is no pending order.appearing when I attached the EA...Did i do another mistake ?

Thanks a lot

Did you allow the EA to trade ?

 
RaptorUK:

Did you allow the EA to trade ?


Yes...I allowed it.


When I attach the Ea to the graph, I can see the date and the hour as I programed it but that's all...

It looks like it doesn't scan the last highest and the lowest price on the last three candlesticks...

 
any error in the log?
 
sorry to be so noob, but what do you mean by log ?
 

check both, Experts and journal tab

 
Do you get a smiling face in the top right hand corner of the chart ?
 
also you need to check the return codes from your OrderSends . . . how else will you know they have gone wrong and why they have gone wrong.