Need help concerning simple coding - page 2

 

You missed Comment

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

RaptorUK,

Yeap, I have the smiling face. No problem with that. ^^


JDeel,

Does comment are compulsory ?


zzuegg,


As you said I have errors in log... see picture below...dont know so much what does that mean...


 
Should be clear, inviald lotsize and comment is not a string
 

I added comments. What should I do for the "invalid lot size" and the "invalid double number as parameter 3" ?

sorry and thank you again

 

You cannot miss first 7 parameters, as they dont have default values. You can skip last 4 if you want to use them with their default values. If you want to use "magic" with different value, last 2 parameters can be skipped, but "comment" must exist before "magic".

You can skip last parameters from a function if they have default values. And position of parameters cannot be changed.

int OrderSend(
   string symbol,
   int cmd,
   double volume,
   double price,
   int slippage,
   double stoploss,
   double takeprofit,
   string comment=NULL,
   int magic=0,
   datetime expiration=0,
   color arrow_color=CLR_NONE
)
 
waldganger:

I added comments. What should I do for the "invalid lot size" and the "invalid double number as parameter 3" ?

sorry and thank you again

They are the same thing . . . read the documentation, parameter 3 is the lotsize.

Comment is not mandatory, but if you are using any parameters that come after it, magic number, expiration and color, you must allow for it . . . even if it is ""

 
waldganger:

I added comments. What should I do for the "invalid lot size" and the "invalid double number as parameter 3" ?

sorry and thank you again


Invalid lot size comes from wrong "volume" parameter. This is double parameter, not string... remove " "
OrderSend(Symbol(), OP_SELLSTOP, "lots", ............
 

thank you very much guys for your explanations,


I changed things as you said and when I attach EA to the graph, i do not have problem :



But...EA is still not trading at all... here is my corrected codes...


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, 5, TheHaut - (stop *
Point), TheHaut + (limite * Point), "123" ,magic, 0, Blue);
OrderSend(Symbol(), OP_SELLSTOP, lots, TheBas, 5, TheBas + (stop *
Point), TheBas - (limite * Point), "456" ,magic, 0, Red);

//----

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

is that correct ?

 
check MarketInfo(Symbol(),MODE_MINLOT)
 

Do you want it open every new tick a new pendingtrade ?

Is your broker 4 or 5 digit Is the SL and TP big enough 4 digit will give TP 7 pips but on 5 digit it will be 0.7 pips propably to small

There needs on plenty brokers some distance between orderopenprice() pendingtrade and the price the moment you place the trade is this big enough ?

Are you allowed to send the trade with SL and TP directly ?