FXCM Forex Trading

why lua strategies delete order different from TSII delete?

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

Moderator: admin

why lua strategies delete order different from TSII delete?

Postby 215607364@qq.com » Fri Sep 09, 2011 1:10 am

why lua strategies delete order different from "TSII delete order with manual control"?
I use a lua strategies to delete a Entry order ?
The action send to server successful 。look below:
Action:
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:10
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:09
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:08
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:07
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:06
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:05
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:04
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:03
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:02
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:01
I send the action 10 times ervery one minute。all successful Completed。but the Entry order don't delete。

I use TSII soft to delete the Entry order with manual control"?
Action:
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:11
the action Completed and the Entry order delete successful ?
215607364@qq.com
 
Posts: 16
Joined: Mon Oct 11, 2010 9:56 pm

Re: why lua strategies delete order different from TSII delete?

Postby sunshine » Fri Sep 09, 2011 7:42 am

Please see this article on how to delete an order Delete Order.
If it won't help, please provide code snippet how you delete an order.
sunshine
 

Re: why lua strategies delete order different from TSII delete?

Postby 215607364@qq.com » Wed Sep 14, 2011 6:22 am

Code: Select all
function Init()
     strategy:name("DeleteOrder");
     strategy:description("DeleteOrder");
end
function Prepare()
     ExtSubscribe(1, nil, "Y", true , "open");
     core.host:execute ("setTimer", 100,1);
end
function ExtUpdate(id, source, period)
end
function ExtAsyncOperationFinished(id, success, message)
   if not(checkReady("trades")) or not(checkReady("orders")) then
       return ;
   end
   if(id==100)then
      delorder();
   end
end
function delorder()
    if not(checkReady("trades")) or not(checkReady("orders")) then
       return;
    end
        local enumorder = core.host:findTable("Orders"):enumerator();
        while true do
            local roworder = enumorder:next();
            if roworder == nil then
                break;
            end
            if( (roworder:cell("Type")=="SE") or (roworder:cell("Type")=="LE")) then
                del(roworder:cell("OrderID"));
            end
        end
end
function del(orderid)
  local valuemap=core.valuemap();
  valuemap.Command = "DeleteOrder";
  valuemap.OrderID = orderid;
  success, msg = terminal:execute(200, valuemap);
  --assert(success, msg);
end
function checkReady(table)
    local rc;
    if fxcmact == "TESTACC_ID" then
        -- run under debugger/simulator
        rc = true;
    else
        rc = core.host:execute("isTableFilled", table);
    end
    return rc;
end
dofile(core.app_path() .. "\\strategies\\standard\\include\\helper.lua");

This lua strategie is used to delete all Entry orders ervery one minute.
But run this strategie, sometimes I find The action send to server successful ,but the Entry order don't delete。
Action:
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:10
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:09
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:08
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:07
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:06
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:05
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:04
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:03
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:02
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:01
Code: Select all
All Removed Order  successful Completed。but the Entry order don't delete。


However,I use TSII soft to delete the Entry order with manual control,the Entry order delete successful ?
Action:
Completed Removed Order (LE, .87206, USD/CHF, BUY, 100K, 00927550) 2011/9/9 02:11
Code: Select all
the action Completed and the Entry order delete successful ?


why lua strategie delete order different from control TSII soft to delete the Entry order ?

So strange thant The Entry order will be deleted use the lua strategie if I reload the the lua strategie。
DeleteOrder.lua
(1.47 KiB) Downloaded 723 times
215607364@qq.com
 
Posts: 16
Joined: Mon Oct 11, 2010 9:56 pm

Re: why lua strategies delete order different from TSII delete?

Postby sunshine » Thu Sep 15, 2011 7:35 am

I'm afraid I couldn't reproduce the issue. Could you please tell how you create entry orders (manually or using some trading strategy). Please also tell the type of your account (US, UK).
sunshine
 

Re: why lua strategies delete order different from TSII delete?

Postby 215607364@qq.com » Thu Sep 15, 2011 10:11 pm

manually.
UK demo
215607364@qq.com
 
Posts: 16
Joined: Mon Oct 11, 2010 9:56 pm

Re: why lua strategies delete order different from TSII delete?

Postby Nikolay.Gekht » Fri Sep 16, 2011 1:45 pm

Was not able to reproduce it on USD demo in current prod version as well. Could you please provide a bit more information:

1) What kind of the account do you use? Real, or Demo, US or UK, any detail would be important.
2) Do you have just one trading account?
3) Was the order close to the market (just a guess, probably order fell in "executing state")

p.s. the strategy example removes order every second, not every minute. To make it working every minute the setTimer must be (100, 60) not (100, 1).
Nikolay.Gekht
FXCodeBase: Base Builder
 
Posts: 1222
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC


Return to Discussions

Who is online

Users browsing this forum: No registered users and 1 guest