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 :-)
Thank you very much for your suggestion,WHRoeder. :-)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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);
}
//+------------------------------------------------------------------+