the problem fixed,i change the code
dealPrice = Ask - 15*Point;
to
dealPrice = Ask - 16*Point;
i think the reason is the open price must lower more than 16 point to current ask price in OP_BUYLIMIT pending order, but errid 130 (invalid stops) be throwed...
dealPrice = Ask - 15*Point;
to
dealPrice = Ask - 16*Point;
i think the reason is the open price must lower more than 16 point to current ask price in OP_BUYLIMIT pending order, but errid 130 (invalid stops) be throwed...
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
... dealPrice = Ask - 15*Point; stopPrice = iSAR(NULL,0,sarStep,0.4,0) - 15*Point; profitPrice = dealPrice+120*Point; dealTypeColor = UPCOLOR; ticket=OrderSend(Symbol(),OP_BUYLIMIT,1,dealPrice,0,stopPrice,profitPrice,"crossReverse",16384,CurTime()+ 7200,dealTypeColor); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) { ObjectCreate("Line"+ticket, OBJ_ARROW, 0, Time[0],dealPrice-20*Point); ObjectSet("Line"+ticket, OBJPROP_COLOR, dealTypeColor ); ObjectSet("Line"+ticket, OBJPROP_ARROWCODE,SYMBOL_ARROWUP); ObjectSetText("Line"+ticket, "Buy at "+dealPrice, 10, "Times New Roman", dealTypeColor); // attach a lable to the arrow lastTradeBars = Bars; } } else { errId=GetLastError(); Print("Error opening BUY order : ",errId," ",ErrorDescription(errId)); Print("**** dealPrice: ",dealPrice," stopPrice: ",stopPrice," profitPrice: ",profitPrice," Ask:",Ask); } ...when i test it,i got 130 invalid stops error,but the stopPrice is lower than dealPrice 40-60 points, who can tell me what the error mean. Thanks in advance!
log like this: