Super NewBie coding problem

 

Hi,all ..


I tried to run a very simple script in MT4, but here is always error 4106.

code:

//+------------------------------------------------------------------+
//| S_Test01.mq4 |
//| Copyright ?2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+

int start()
{
//----
int a = OrderSend(Symbol(),OP_BUY,0.5,Ask,3,Bid-50*Point,Bid+50*Point);

Alert (GetLastError()); //GET 4109

int b = OrderSend("GBPUSD",OP_BUY,0.5,Ask,3,Bid-50*Point,Bid+50*Point);

Alert (GetLastError()); //GET 4109

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

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


Error CODE return both "4109", I thought this is the simplest example,could you guys pls kindly tell me what's wrong with this code ? Thank you advanced

 
hhh6897 wrote >>

Hi,all ..

I tried to run a very simple script in MT4, but here is always error 4106.

code:

//+------------------------------------------------------------------+
//| S_Test01.mq4 |
//| Copyright ?2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+

int start()
{
//----
int a = OrderSend(Symbol(),OP_BUY,0.5,Ask,3,Bid-50*Point,Bid+50*Point);

Alert (GetLastError()); //GET 4109

int b = OrderSend("GBPUSD",OP_BUY,0.5,Ask,3,Bid-50*Point,Bid+50*Point);

Alert (GetLastError()); //GET 4109

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

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

Error CODE return both "4109", I thought this is the simplest example,could you guys pls kindly tell me what's wrong with this code ? Thank you advance

explaination in the metaeditor: 4109=

ERR_TRADE_NOT_ALLOWED 4109 Trade is not allowed. Enable checkbox "Allow live trading" in the expert properties.

 
logan113:

explaination in the metaeditor: 4109=

ERR_TRADE_NOT_ALLOWED 4109 Trade is not allowed. Enable checkbox "Allow live trading" in the expert properties.

Click the Expert Advisors button in MetaTrader to allow your EAs/scripts to trade.

 
hhh6897:

Hi, guys


Thank you for you help. I tried like this, but still not working .


snapshot has been uploaded .. is there any other reason that cause this error ?


Kindly Thanks!


Got it ...the code worked in EA...But didn't work in Script,why following code


//+------------------------------------------------------------------+
//| S_Test01.mq4 |
//| Copyright ?2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| script program startf unction |
//+-----------------------------
{
//-----------------------------------------+
int start()
OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-50*Point,Bid+50*Point);
Alert (GetLastError());
//----
return(0);
}
//+------------------------------------------------------------------+



I am quite confusing.. the code in script is quite the same as in EA..but it doesn't work in script...Error 4109..

Files:
no_script.rar  36 kb
 

Well, for a start the "{" should follow after "int start()".


CB

 
cloudbreaker:

Well, for a start the "{" should follow after "int start()".


CB

shoot...SHAME ON ME....Thank you!

Reason: