open order failed: Missed or unknown Buysell field

Section for discussions related to indicators, use of indicators, and building of trading stategies using indicators.

Moderator: admin

open order failed: Missed or unknown Buysell field

Postby seblamier » Mon Oct 03, 2016 9:40 am

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
seblamier
 
Posts: 3
Joined: Mon Oct 03, 2016 9:30 am

Re: open order failed: Missed or unknown Buysell field

Postby Apprentice » Tue Oct 04, 2016 2:37 am

replace
function Open(side)
with
function Open(BuySell)
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: open order failed: Missed or unknown Buysell field

Postby seblamier » Tue Oct 04, 2016 1:32 pm

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!!
Attachments
test.lua
(12.2 KiB) Downloaded 883 times
seblamier
 
Posts: 3
Joined: Mon Oct 03, 2016 9:30 am



Return to Discussions

Who is online

Users browsing this forum: No registered users and 11 guests