Trailing stop detection in Orders table

Section for all discussions related to development using Indicore API/SDK.

Moderator: admin

Trailing stop detection in Orders table

Postby tllewell » Tue Jun 04, 2013 2:36 pm

In the Orders table there is a parameter for trailing stops called TrlMinMove. However, the text that documents the parameter says that "The trailing stop mode can be detected using the following condition: TrlRate ~= 0."

What does this mean? Is this another parameter that can be enumerated and grabbed with row.TrlRate? Why isn't there a separate listing for it if this is the case? Why not just enumerate row.TrlMinMove?

I want to be able to detect whether there is a dynamic trailing stop on trades, but this isn't very clear. Could someone explain how this is to be tested for, please?

Here is a fragment of the code I am working with. My strategy creates the trailing stop, but it doesn't remove the dynamic trailing when I want it to. The edit order command runs repeatedly, but it doesn't change the trailing mode.

(I know this is kind of messy, but I've been throwing stuff at it trying to see how it works.)

Code: Select all
local enum, row, orderid, rate;
      local trailing = false;
      enum = core.host:findTable("Orders"):enumerator();
      while not netStop do
         row = enum:next();
         if row == nil then
            break;
         end
         if row.OfferID == offer then
            if row.NetQuantity == true then
               netStop = true;
               if row.QTXT == customID then
                  if row.TrlRate ~= 0 then
                     orderid = row.OrderID;
                     rate = row.Rate;
                     trailing = true;
                  end
               end
            end
         end
      end
      --Remove trailing attribute from stop if at breakeven
      if netStop and
      trailing then
         if (rate > avgOpen + 3 * pip and
         direction == "B") or
         (rate < avgOpen - 3 * pip and
         direction == "S") then
            valuemap = core.valuemap();
            valuemap.Command = "EditOrder";
            valuemap.OfferID = offer;
            valuemap.AcctID = account;
            valuemap.OrderID = orderid;
            valuemap.TrailUpdatePips = 0;
            success, msg = terminal:execute(105, valuemap);
            if not success then
               terminal:alertMessage(instance.bid:instrument(), instance.bid[NOW], "change order failed: " .. msg, instance.bid:date(NOW));
            end
         end
      end
tllewell
 
Posts: 76
Joined: Thu Mar 01, 2012 4:06 pm

Re: Trailing stop detection in Orders table

Postby tllewell » Wed Jun 05, 2013 7:33 am

I have continued to mess with it. The TrlRate information in the docs should be deleted. I can detect the dynamic trailing setting with row.TrlMinMove, but I still cannot change it. I've tried row.TrailUpdatePips as in the original order, and I've tried row.TrlMinMove, but the parameter does not change. I can change it manually in Marketscope, but the strategy can't. This is an SE order, and this is supposed to be editable.
tllewell
 
Posts: 76
Joined: Thu Mar 01, 2012 4:06 pm

Re: Trailing stop detection in Orders table

Postby sunshine » Thu Jun 06, 2013 4:19 am

The developers have confirmed that this is an issue in FX Trading Station. Thank you for reporting. We will include the fix in the next release.
Sorry for the inconvenience.
sunshine
 

Re: Trailing stop detection in Orders table

Postby tllewell » Thu Jun 06, 2013 7:08 am

Oh, good, it's not me. Thanks. :D
tllewell
 
Posts: 76
Joined: Thu Mar 01, 2012 4:06 pm


Return to Discussions

Who is online

Users browsing this forum: No registered users and 7 guests