How can I address a certain table for looping its rows?

Moderator: admin

How can I address a certain table for looping its rows?

Postby loseend » Wed Aug 04, 2021 5:29 am

Hi there,

actually it's a question to Apprentice.

In order to checking pending trades you loop the table "trades":
enum = core.host:findTable("trades"):enumerator()

In the debugger this table is named "Trades" - not "trades".

Now, I would like to check the table "ClosedTrades".
But ' enum = core.host:findTable("ClosedTrades"):enumerator()' won't find the table. Can you tell me under which name this table is assigned?

Thank you very much.
loseend
 
Posts: 56
Joined: Tue Jul 31, 2018 12:37 pm

Re: How can I address a certain table for looping its rows?

Postby Apprentice » Thu Aug 05, 2021 5:56 am

It is "Closed Trades"

Code: Select all
    local enum, row;
    local count = 0;
    enum = core.host:findTable("Closed Trades"):enumerator();
    row = enum:next();
    while row ~= nil do
         Text= Text.. tostring(row.AccountID)

        row = enum:next();
    end


This is another implementation you can use.
Make sure you close some trades.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: How can I address a certain table for looping its rows?

Postby loseend » Thu Aug 05, 2021 9:22 am

Great! You helped me out, Apprentice.
Thank you very much!!
loseend
 
Posts: 56
Joined: Tue Jul 31, 2018 12:37 pm


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 9 guests