Problem with OrderSendFunction must be a string

 

Hi, can someone help with this code as I am a total newbie and need help!!! I have an EA compiled by a mql programmer but I wanted to change the entry signal, so copied some code from another EA which I thought might work, but I get the errors below in strategy tester as no errors come up from compiler in Metaeditor 4 wizard thingy. I also added an extern int of openbuy and opensell as I thought that might complete string, but I have no idea what a string is or compiles of?!?

 

2012.09.02 12:36:06 2012.06.20 20:01  SECRET_EA_SWINGERemacross AUDUSD,M5: OrderSend error 4062

2012.09.02 12:36:06 2012.06.20 20:01  SECRET_EA_SWINGERemacross: the comment parameter for OrderSend function must be a string

2012.09.02 12:36:06 2012.06.20 20:01  SECRET_EA_SWINGERemacross AUDUSD,M5: invalid double number as parameter 6 for OrderSend function

I will add EA as attached file, and some of the code below if it is a simple fix (here's hoping)!!

 

 extern string _________________="___________________";


extern double Lotsize = 0.01;

extern bool MoneyManagement = false;

extern double Percentrisk = 1;

extern int Stoploss = 0;

extern bool Martingale = false;

extern double MartinExponent = 2.0;

extern string _____________________="_______________";

extern int Takeprofit =0;

extern int Trailingstop=0;

extern string    Ma1="First Ma settings";

extern int       Ma1Period=16;

extern int       Ma1Shift=8;

extern int       Ma1Method=0;

extern int       Ma1AppliedPrice=4;

extern string    Ma2="Second Ma settings";

extern int       Ma2Period=1;

extern int       Ma2Shift=0;

extern int       Ma2Method=0;

extern int       Ma2AppliedPrice=4;

extern int       openbuy = true;

extern int       opensell = true;


extern bool ParabolicTrailingstop=true;

extern double Step=0.02;

extern double Maximum=0.2;


extern string ____________________="___________________";

extern bool Buyallow = true;

extern bool Sellallow = true;

extern bool CloseByNewSignal=false;

extern double Magicnumber = 0;

extern bool DisplayStats = false;

string Ordercomment = "SECRET EA EMACROSS";


 //+------------------------------------------------------------------+

//|                      Trenderkennung                              |

//+------------------------------------------------------------------+


   // Ma strategy one

double MA1_bc=iMA(NULL,0,Ma1Period,Ma1Shift,Ma1Method,Ma1AppliedPrice,0);

double MA1_bp=iMA(NULL,0,Ma1Period,Ma1Shift,Ma1Method,Ma1AppliedPrice,1);

double MA1_bl=iMA(NULL,0,Ma1Period,Ma1Shift,Ma1Method,Ma1AppliedPrice,2);




// Ma constant

double MA2_bc=iMA(NULL,0,Ma2Period,Ma2Shift,Ma2Method,Ma2AppliedPrice,0);

double MA2_bp=iMA(NULL,0,Ma2Period,Ma2Shift,Ma2Method,Ma2AppliedPrice,1);

double MA2_bl=iMA(NULL,0,Ma2Period,Ma2Shift,Ma2Method,Ma2AppliedPrice,2);

   



   for(int i=0; i<1000; i++)

  


//+------------------------------------------------------------------+

//| Buysignale && Sellsignale                                        |

//+------------------------------------------------------------------+

// Sell criteria

if ((MA1_bc>MA2_bc)&&(MA1_bp>MA2_bp)&&(MA1_bl<MA2_bl)) //Signal Sell

 {

   int opensell=OrderSend(Symbol(),OP_SELL,Bid,0,0,"SECRET EA EMACROSS",0,Red);

   if(opensell<1){int sellfail=1;}

 }

 

 // Buy criteria

 if ((MA1_bc<MA2_bc)&&(MA1_bp<MA2_bp)&&(MA1_bl>MA2_bl)) //Signal Buy

 {

   int openbuy=OrderSend(Symbol(),OP_BUY,Ask,0,0,"SECRET EA EMACROSS",0,Blue);

  if(openbuy<1){int buyfail=1;}

 }


  

      

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+


   if(ObjectFind("up"+Time[0])>=0)int Trend=1;

   if(ObjectFind("down"+Time[0])>=0)  Trend=2;




//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+


  if(CloseByNewSignal && OrderAngaben[2]>0)

  {

  if(Trend==2 && OrderAngaben[0]>0){CloseThisSymbolAll(OP_BUY);return(0);}

  if(Trend==1 && OrderAngaben[1]>0){CloseThisSymbolAll(OP_SELL);return(0);}

  }



//+------------------------------------------------------------------+

//|  Orders versenden                                                |

//+------------------------------------------------------------------+



   static int bgtime;


   if(Buyallow && Trend==1 && OrderAngaben[2]<=0 && Time[0]!=bgtime)

   {

   if(OpenOrder(OP_BUY, Lotsize(Stoploss), OrderSlippage, strategie, Magicnumber, Blue)>0)

   bgtime=Time[0];

   }

   

   


   if(Sellallow && Trend==2 && OrderAngaben[2]<=0 && Time[0]!=bgtime)

   {

   if(OpenOrder(OP_SELL, Lotsize(Stoploss), OrderSlippage, strategie, Magicnumber, Red)>0)

   bgtime=Time[0];

   }


Documentation on MQL5: Trade Functions / OrderSend
Documentation on MQL5: Trade Functions / OrderSend
  • www.mql5.com
Trade Functions / OrderSend - Documentation on MQL5
 

Hi NZFXMAN,

1. That's MQL4 code should be asked at MQL4.com. MetaEditor 4 has MQL4 link button, use it to open MQL4.com. You will get a lot more help for that than here.  

2. Use SRC button to publish your code, your code will hell a lot of easier to read and other forumer will be happy to read and help with your code w/o the need to download the attachment.

 

3. Click delete button to delete this topic. 

4. On your MetaEditor 4, open Navigator window, click search tab, and type OrderSend. You will get what you want from there coz MQ already write everything there. 

 

 

 
onewithzachy:

Hi NZFXMAN,

1. That's MQL4 code should be asked at MQL4.com. MetaEditor 4 has MQL4 link button, use it to open MQL4.com. You will get a lot more help for that than here.  

2. Use SRC button to publish your code, your code will hell a lot of easier to read and other forumer will be happy to read and help with your code w/o the need to download the attachment.

 

3. Click delete button to delete this topic. 

4. On your MetaEditor 4, open Navigator window, click search tab, and type OrderSend. You will get what you want from there coz MQ already write everything there. 

 

 

sorry don't know how to delete? cant find any button to delete :-))))
 
NZFXMAN:
sorry don't know how to delete? cant find any button to delete :-))))

Hi NZFXMAN,

LOL :D Typos :D.

Click the delete link on first comment if you want to delete this topic. :D

If you don't want to delete this topic, would you please click the edit link and edit your codes using SRC button.

The delete and edit link will appear on lower right of the comment when cursor hovering over the comment, but I think you already know that :)

 

 

Reason: