Use a script to place a trade? -- 4109 error

 

How can a script place a trade? The error 4109 shows up. There's no opportunity to enable the checkbox to "Allow live trading" in the expert properties. The script just runs and exits a second later. Here is the bare bones script I'm working with.

int start()
{
   int ticket;
      ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order",16384,0,Green);
      if(ticket<0)
      {
         Print("OrderSend failed with error #",GetLastError());
         return(0);
      }
   return(0);
}
 
There are some sample scripts that were placed in your scripts folder when you installed MT4. Did you have a look at them?
 
ERR_TRADE_NOT_ALLOWED 4109 Trade is not allowed. Enable checkbox "Allow live trading" in the expert

Documented Error Codes.

#property show_confirm.

 

Did you tick this box ?

 
Yes, that is the answer. Check the Allow live trading box. This allows the scrip to actually open and order. The #property show_confirm shows a pop up box to confirm running the script, but does not allow control of live trading.
Reason: