My Expert Advisor could not make live trading order.

 

Dear Friends,

I have coded a simple Expert Advisor code ( Please see below ). It could not make any live trading order although I have checked the allow live trading option on the Meta Trader's option menu. Please let me know what's wrong with my codes.

Thank you very much for your help.

Sincerely,

Roby Widjaja.


//+------------------------------------------------------------------+
//| Strategy_1_1.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net//"

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int ticket;
//----
if(AccountFreeMargin()>=75)
{
ticket=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,0,Bid-0.0015);
Print("Account SELL free margin is: ", AccountFreeMargin());

ticket=OrderSend(Symbol(),OP_BUY,0.01,Ask,3,0,Ask+0.0015);
Print("Account BUY free margin is: ", AccountFreeMargin());
}
else
{
Print("Free Margin is not enough.");
}
//----
return(0);
}
//+------------------------------------------------------------------+

 

 
Some brokers forbid you to send TP and/or SL on the same line of code. This happened to me and it's something that has been discussed ad nauseum in this forum. You have to send the order first with 0 TP and SL and in the next line OrderModify the ticket you just got and put in your SL and TP. Some brokers just like to be annoying I guess.
 

You have answered my question very well. You are right. I use www.ibfx.com.au .

Thank you very much :-)

 

You're welcome. Like I said, the same thing happened to me using CMS FX. I was banging my head against the wall, especially since the EA placed trades in the backtester, until someone helped me out here.

 
 

Thank you very much for your suggestion,WHRoeder. :-)

Reason: