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

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

Moderator: admin

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

Postby Stance » Wed Jun 01, 2016 10:55 pm

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
Stance
FXCodeBase: Initiate
 
Posts: 141
Joined: Mon Jun 01, 2015 4:34 pm

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

Postby Julia CJ » Thu Jun 02, 2016 2:16 am

Hi Stance,

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

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

Postby Stance » Thu Jun 02, 2016 2:54 am

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.
Stance
FXCodeBase: Initiate
 
Posts: 141
Joined: Mon Jun 01, 2015 4:34 pm

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

Postby Julia CJ » Thu Jun 02, 2016 6:47 am

Stance,

Do you mean the speed and load on FXCM servers?


Yes, this is true.
Julia CJ
 

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

Postby Stance » Sat Jun 04, 2016 3:43 am

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.
Stance
FXCodeBase: Initiate
 
Posts: 141
Joined: Mon Jun 01, 2015 4:34 pm

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

Postby Julia CJ » Mon Jun 06, 2016 5:03 am

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.
Julia CJ
 


Return to Discussions

Who is online

Users browsing this forum: No registered users and 2 guests