
12-22-2005, 09:38 PM
|
 |
Senior Member
|
|
Join Date: Oct 2005
Posts: 987
|
|
Quote:
|
Originally Posted by trevman2005
this bit of code doesnt seem to buy, any ideas why?
Code:
if(Close[2]<ma && Close[1]>ma)
{
OrderSend(Symbol(),OP_BUY,lots,Ask,3,stop,Ask+profit,"",2005,0,Green);
}
it should buy when a new candle closes above the moving average and the previous closed below it.
|
I think it should be:
PHP Code:
if(Close[1]<ma && Close[0]>ma) { ticket=OrderSend(Symbol(),OP_BUY,lots,Ask,3,stop*Point,Ask+profit*Point,"",2005,0,Green); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice()); } else Print("Error opening BUY order : ",GetLastError()); return(0); }
|