OrderSend error 3

 

Hi there,



I have this code:



int U()
{
double telo= MathAbs(Open[1]-Close[1]);
double knothorni=High[1]-MathMax(Open[1],Close[1]);
double knotdolni=-Low[1]+MathMin(Open[1],Close[1]);

int res;
double otevritza;
int expiration=CurTime()+PERIOD_M15*2;


if(StopLoss<(MarketInfo(Symbol(),MODE_STOPLEVEL)/MathPow(10,Digits))) //pokud je stopplos mensi nez je povoleno nastavi min. co je povoleno
{
StopLoss=MarketInfo(Symbol(),MODE_STOPLEVEL)/MathPow(10,Digits);
}

res=OrderSend(Symbol(), OP_BUYLIMIT, NormalizeDouble(Lot,1), NormalizeDouble(otevritza,4), NormalizeDouble(Slippage,4),
NormalizeDouble(otevritza-StopLoss,4), 0, 0, 1001001,expiration, Green);

return(res);
}

return(0);
}


int start()
{
//----
logIt("Start falling star");
// if(AccountServer()!="" || AccountNumber()!=0){logIt("Account server or Account number failure."); return(0);}
if(OrdersTotal()==0)
{
logIt("Orders total=0");
PP=0;
Lot=NormalizeDouble(MathFloor(LotSpliter*AccountBalance()*AccountLeverage()/Ask/MarketInfo(Symbol(),MODE_LOTSIZE)*10)/10,1);
if(MaxLot>0 && Lot>MaxLot){Lot=MaxLot;}
if(Lot>MarketInfo(Symbol(),25)){Lot=MarketInfo(Symbol(),25);}
if(StopLoss<(MarketInfo(Symbol(),MODE_STOPLEVEL)/MathPow(10,Digits))) //pokud je stopplos mensi nez je povoleno nastavi min. co je povoleno
{
StopLoss=MarketInfo(Symbol(),MODE_STOPLEVEL)/MathPow(10,Digits);
}
U();
return(0);
}
//----
return(0);
}



But there is a problem if I run the backtest on it :( It says OrderSend error 3.

I am realy hopeless, because dont know where is the mistake :( Please help:) thx

Files:
 
OrderSend() is expecting Slippage to be passed as an integer.
 
sxTed:
OrderSend() is expecting Slippage to be passed as an integer.

It is not the case:( I changed the source to:


res=OrderSend(Symbol(), OP_BUYLIMIT, NormalizeDouble(Lot,1), NormalizeDouble(otevritza,4), Slippage,
NormalizeDouble(otevritza-StopLoss,4), 0, 0, 1001001,expiration, Green);


while


extern int Slippage=1; //maximalni slippage



Any oher suggestions?? Pls:)

 

OrderSend() did not reproduce error 3.

 
dextr:

It is not the case:( I changed the source to:


res=OrderSend(Symbol(), OP_BUYLIMIT, NormalizeDouble(Lot,1), NormalizeDouble(otevritza,4), Slippage,
NormalizeDouble(otevritza-StopLoss,4), 0, 0, 1001001,expiration, Green);


while


extern int Slippage=1; //maximalni slippage



Any oher suggestions?? Pls:)


expiration time is too small, we must not do less than 1 hour