Page 1 of 1

Marketscope Bug

PostPosted: Mon Sep 18, 2017 11:23 am
by guangho
I have function ExtAsyncOperationFinished(id, success, message) to use...

function ExtAsyncOperationFinished(id, success, message)
if cookie == 200 and not success then
terminal:alertMessage(instance.bid:instrument(),instance.bid[NOW], "Open order failed !" .. message, instance.bid[NOW]);
elseif cookie == 201 and not success then
terminal:alertMessage(instance.bid:instrument(), instance.bid[NOW], "Close order failed !" .. message,instance.bid[NOW]);
end
end

But after the TS2 is updata today, the function do not run...
Have one message is "Open order failed! The command is disabled.2017/09/18 06:00:00"...
How to do repair the Bug?
Thank you!

11.jpg


22.jpg

Re: Marketscope Bug

PostPosted: Tue Sep 19, 2017 3:25 am
by PetroIV
Hello,
What type of order do you want to create?
Can you attach a log file to investigate the problem?

Re: Marketscope Bug

PostPosted: Tue Sep 19, 2017 12:13 pm
by guangho
PetroIV wrote:Hello,
What type of order do you want to create?
Can you attach a log file to investigate the problem?


A very common example, maybe I will not write.
Before the normal, after the upgrade can not operate.

function enter(BuySell,shuliang,zy,zs)
valuemap=core.valuemap();
valuemap.Command="CreateOrder";
valuemap.OrderType="OM";
valuemap.OfferID=offer;
valuemap.AcctID=Account;
valuemap.Quantity=shuliang*basesize;
valuemap.BuySell=BuySell;
valuemap.PegTypeStop="O";
valuemap.PegTypeLimit="O";
if zy~=0 then valuemap.RateLimit=zy end
if zs~=0 then valuemap.RateStop=zs end
executing=true;
success,msg=terminal:execute(200,valuemap);
if not(success) then executing=false;
terminal:alertMessage(instance.bid:instrument(),instance.bid[NOW],"Open order failed !",instance.bid:date(NOW));
else terminal:alertMessage(instance.bid:instrument(),instance.bid[NOW],"Open order true !",instance.bid:date(NOW)) end
end

Re: Marketscope Bug

PostPosted: Fri Sep 29, 2017 12:27 pm
by Konstantin.Toporov
Are you sure the strategy has the permissions to trade?
You can check it this way:
Menu -> Alerts and Trading Automation -> Manage Extensions.
Locate your strategy it the list and press Permissions button:
stg_list.png

The strategy permissions set should look like on the picture
(Make sure Allow trading option is checked)
stg_perm.png
(6.86 KiB) Not downloaded yet


Also it is possible some trading feature (like creating market orders on a specific instrument) disabled on your account.

Re: Marketscope Bug

PostPosted: Sat Sep 30, 2017 3:57 pm
by guangho
Konstantin.Toporov wrote:Are you sure the strategy has the permissions to trade?
You can check it this way:
Menu -> Alerts and Trading Automation -> Manage Extensions.
Locate your strategy it the list and press Permissions button:
stg_list.png

The strategy permissions set should look like on the picture
(Make sure Allow trading option is checked)
stg_perm.png


Also it is possible some trading feature (like creating market orders on a specific instrument) disabled on your account.



Check the permissions no problem. Before the upgrade has been normal use, after the upgrade "ExtAsyncOperationFinished" to stop running the problem, but other features or completely normal use.

Re: Marketscope Bug

PostPosted: Sun Nov 05, 2017 2:18 pm
by guangho
I know the reason for the "Marketscope Bug"...
example:
function ExtAsyncOperationFinished(cookie,success,message)
if cookie == 200 and not success then
terminal:alertMessage(instance.bid:instrument(),instance.bid[NOW], "Open order failed !" .. message, instance.bid[NOW]);
elseif cookie == 200 then
terminal:alertMessage(instance.bid:instrument(), instance.bid[NOW], "Open order true !" .. message,instance.bid[NOW]);
end
end

The "ExtAsyncOperationFinished(cookie,success,message)" return the "message" is an nil.
SO:
function ExtAsyncOperationFinished(cookie,success,message)
if cookie == 200 and not success then
terminal:alertMessage(instance.bid:instrument(),instance.bid[NOW], "Open order failed !" .. message, instance.bid[NOW]);----can run
elseif cookie == 200 then
terminal:alertMessage(instance.bid:instrument(), instance.bid[NOW], "Open order true !" .. message,instance.bid[NOW]);----Will not run
end
end

When:
function ExtAsyncOperationFinished(cookie,success,message)
if cookie == 200 and not success then
terminal:alertMessage(instance.bid:instrument(),instance.bid[NOW], "Open order failed !" .. message, instance.bid[NOW]);----can run
elseif cookie == 200 then
terminal:alertMessage(instance.bid:instrument(), instance.bid[NOW], "Open order true !",instance.bid[NOW]);----can run
end
end

How can i return the requestId?

Re: Marketscope Bug

PostPosted: Tue Nov 14, 2017 5:49 am
by PetroIV
Hello,

I know one way to subscribe to events in the trade table.
If the order is successfully executed, you show TradeID, OrderID, RequestID

Code: Select all
function Prepare()
    core.host:execute("subscribeTradeEvents", 2000, "trades"); 
end

function AsyncOperationFinished(id, success, message, message1, message2)
   if id == 2000 then
           core.host:trace("TradeID: " .. message);
           core.host:trace("OrderID: " .. message1);
           core.host:trace("RequestID: " .. message2);                               
   end
end

Re: Marketscope Bug

PostPosted: Tue Nov 21, 2017 7:11 am
by Apprentice
Sent to development team.