Marketscope Bug

Moderator: admin

Marketscope Bug

Postby guangho » Mon Sep 18, 2017 11:23 am

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
guangho
 
Posts: 72
Joined: Sat Sep 29, 2012 12:16 pm

Re: Marketscope Bug

Postby PetroIV » Tue Sep 19, 2017 3:25 am

Hello,
What type of order do you want to create?
Can you attach a log file to investigate the problem?
PetroIV
 
Posts: 12
Joined: Tue Aug 15, 2017 9:45 am

Re: Marketscope Bug

Postby guangho » Tue Sep 19, 2017 12:13 pm

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
guangho
 
Posts: 72
Joined: Sat Sep 29, 2012 12:16 pm

Re: Marketscope Bug

Postby Konstantin.Toporov » Fri Sep 29, 2017 12:27 pm

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.
Konstantin.Toporov
 
Posts: 64
Joined: Mon Aug 31, 2015 10:16 am

Re: Marketscope Bug

Postby guangho » Sat Sep 30, 2017 3:57 pm

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.
guangho
 
Posts: 72
Joined: Sat Sep 29, 2012 12:16 pm

Re: Marketscope Bug

Postby guangho » Sun Nov 05, 2017 2:18 pm

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?
guangho
 
Posts: 72
Joined: Sat Sep 29, 2012 12:16 pm

Re: Marketscope Bug

Postby PetroIV » Tue Nov 14, 2017 5:49 am

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
PetroIV
 
Posts: 12
Joined: Tue Aug 15, 2017 9:45 am

Re: Marketscope Bug

Postby Apprentice » Tue Nov 21, 2017 7:11 am

Sent to development team.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17510
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 7 guests