Hi,
Playing with MQL4. I made this simple program but no order is executed. I try to let the limit order automatically expire in 2 minutes, but when I backtest it no trader order is sent.
I suspect that there is something wrong with the OrderSend function, but can’t pinpoint where the mistake is.
I appreciate any kind of input.
int start()
{
//----
double Stochastics_Main[5];
double Stochastics_Signal[5];
for (int i=0; i<=5; i++)
{
Stochastics_Main[i]=iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, PRICE_CLOSE, MODE_MAIN, 0); //Stochastics Main Line
Stochastics_Signal[i]=iStochastic(NULL, 0, 5,3,3, MODE_SMA, PRICE_CLOSE, MODE_SIGNAL,0 ); //Stochastics Signal Line
}
//-------------------------------------------------------------------------------------------------------------
//Set lot rule
if(AccountBalance()<1000)//If the account Balance is smaller than 1000 bucks, trading size is .1 standard lot
LOTS=0.1;
else
LOTS=0.1*NormalizeDouble(AccountBalance()/1000,0);//Otherwise the size of the trading lots depends on the account balance
//----------------------------------------------------------------------
if (Stochastics_Main[0]>Stochastics_Signal[0] && Stochastics_Main[1]<Stochastics_Signal[1])
{
OrderSend(Symbol(), OP_BUYLIMIT, LOTS, (Bid+Ask)/2, 3, Low[2], (Bid+Ask)/2+100*Point, NULL, 0, Time[0]+120, Green);
//Note that I want the order to expire in 2 mins
}