Please help! my EA refuses to trade

 

Ok, so after developing what i think might be a somewhat useful EA and getting acceptable backtest results, I'm ready for forward testing with a demo account. There is only one problem, the EA is not trading at all, even when conditions are met where it should trade.

I'm using vista home premium x64 at home, and i thought Vista was maybe blocking the trading functionality somehow, so now that I'm at work I decided to try the EA on my XP machine. I wanted to first check the ordersend functionality, so i wrote a very simple EA (called "Test") that just places one trade, but even that isn't working, even on XP! I think I'm missing something very basic here, but i don't know what it is. The EA button is pressed in MT4 and "allow live trading" is ticked. The EA loads and the title and a smiley face appear to the top right of the chart.

I'm using CMS as my broker, which is a 5 digit broker, hence the "100*Point" SL and TP in this example.

bool proceed;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   proceed = true;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
int ticket;
   if (proceed)
   {
   ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Bid-100*Point,Ask+100*Point,"My order #2",16384,0,Green);
   proceed = false;
   }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

 
Are you sure that it is allowed to open positions with TP and SL? Maybe you need to open a position and then modify it in order to add SL and TP?
 
hasayama:
Are you sure that it is allowed to open positions with TP and SL? Maybe you need to open a position and then modify it in order to add SL and TP?


Well, I'll be damned! It worked. Now i have to figure out how to modify the order after being placed to add the SL and TP, luckily i seem to recall reading a thread on this. Why do brokers do this? They can be such a pain in the @$$!

Thanks a lot. You just saved me a lot of head-to-wall banging

Reason: