Page 1 of 1

How long does a trade stay in the "trades" table?

PostPosted: Wed Jun 01, 2016 10:55 pm
by Stance
Hi,

I would like to know, once a trade closes, does it dissappear out of the trades table straight away?

It seems like once a trade closes and if there is a match again, then a new trade won't open, but if I close trading station and re-open it, the trade will execute straight away. It's like closing and re-opening the app clears something?

Code: Select all
function ExtUpdate(id, source, period)
   if not(haveTrades("B")) then   
      ...
      BUY()
   end

   if not(haveTrades("S")) then
      ...
      SELL()
   end
end

function haveTrades(BuySell)
    local enum, row;
    local found = false;
    enum = core.host:findTable("trades"):enumerator();
    row = enum:next();
    while (row ~= nil) do
        if row.AccountID == Account and row.OfferID == Offer and (row.BS == BuySell or BuySell == nil) then
            found = true;
            break;
        end

        row = enum:next();
    end
    return found;
end

Re: How long does a trade stay in the "trades" table?

PostPosted: Thu Jun 02, 2016 2:16 am
by Julia CJ
Hi Stance,

This happens due to some delay. Probably, it depends on the connection speed with server and load of server.

Re: How long does a trade stay in the "trades" table?

PostPosted: Thu Jun 02, 2016 2:54 am
by Stance
Julia CJ wrote:Hi Stance,

This happens due to some delay. Probably, it depends on the connection speed with server and load of server.


Hi Julia,

Do you mean the speed and load on FXCM servers?

I have a vps service in the same datacentre as FXCM and usage is less 5% and 40% memory.

Re: How long does a trade stay in the "trades" table?

PostPosted: Thu Jun 02, 2016 6:47 am
by Julia CJ
Stance,

Do you mean the speed and load on FXCM servers?


Yes, this is true.

Re: How long does a trade stay in the "trades" table?

PostPosted: Sat Jun 04, 2016 3:43 am
by Stance
Hi Julia,

Is there a fix or workaround for this? I had trade close and the strategy didn't open any trades for 12 hours and only worked after restarting the app.

Re: How long does a trade stay in the "trades" table?

PostPosted: Mon Jun 06, 2016 5:03 am
by Julia CJ
Hi Stance,

According to your description it should not be like this. Please send the code of strategy, we will try to understand the reason of such behavior.