Page 1 of 1

open order failed: Missed or unknown Buysell field

PostPosted: Mon Oct 03, 2016 9:40 am
by seblamier
Hi
I'm french so my english is a little poor...
Can anyone help me?
When an order is made, i get the message "open order failed: Missed or unknown Buysell field"
My procedure seems good:



function Open(side)

local valuemap, success, msg;
valuemap = core.valuemap();

valuemap.Command = "CreateOrder";
valuemap.OrderType = "OM";
valuemap.OfferID = Offer;
valuemap.AcctID = Account;
valuemap.Quantity = Amount * BaseSize;
valuemap.BuySell = BuySell;
valuemap.CustomID = CustomID;

-- add stop/limit
valuemap.PegTypeStop = "O";
if SetStop then
if BuySell == "B" then
valuemap.PegPriceOffsetPipsStop = -Stop;
else
valuemap.PegPriceOffsetPipsStop = Stop;
end
end
if TrailingStop then
valuemap.TrailStepStop = 1;
end

valuemap.PegTypeLimit = "O";
if SetLimit then
if BuySell == "B" then
valuemap.PegPriceOffsetPipsLimit = Limit;
else
valuemap.PegPriceOffsetPipsLimit = -Limit;
end
end

if (not CanClose) then
valuemap.EntryLimitStop = 'Y'
end

success, msg = terminal:execute(200, valuemap);

if not(success) then
terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "Open order failed" .. msg, instance.bid:date(instance.bid:size() - 1));
return false;
end

return true;
end




has someone an idee,please??

Thanks

Re: open order failed: Missed or unknown Buysell field

PostPosted: Tue Oct 04, 2016 2:37 am
by Apprentice
replace
function Open(side)
with
function Open(BuySell)

Re: open order failed: Missed or unknown Buysell field

PostPosted: Tue Oct 04, 2016 1:32 pm
by seblamier
Thanks a lot for your answer
i did a pistake when i posted it...
i have modified the code and ran my strategy
=> Now the trading station crashes when an order is done
My strategy is very sample. i have posted it
Could someone test it and see if it crashes as well?
Thanks a lot!!

Re: open order failed: Missed or unknown Buysell field

PostPosted: Wed Oct 12, 2016 3:25 am
by Apprentice
EURUSD m5 (10-12-2016 0937).png

Works in Backtester.
How did you tested it?