Instruments list

Moderator: Moderator

Instruments list

Postby fer065 » Fri Mar 20, 2015 4:39 am

Hi,

I'd like to know if there is any specific method to list the available instruments from the broker. Any help would be appreciated.

Regards.
fer065
 
Posts: 1
Joined: Fri Mar 20, 2015 4:36 am

Re: Instruments list

Postby Georgiy » Tue Mar 24, 2015 6:58 am

Hello fer065,

You will find all instruments available for trader in the table Offers.
You can subscribe on part of them (usually no more than 20). Status of instrument (subscribe or not) is available from the column SubscriptionStatus (the table Offers).

For subscribing/unsubscribing to the instrument you have to use the command SetSubscriptionStatus.

Thank you.
Georgiy
FXCodeBase: Initiate
 
Posts: 150
Joined: Tue Jul 29, 2014 4:49 am

Re: Instruments list

Postby Apprentice » Thu Apr 23, 2015 3:24 am

Code: Select all
function Init()
indicator.parameters:addString("Instrument" .. id, "Instrument", "", Instrument);
indicator.parameters:setFlag("Instrument" .. id, core.FLAG_INSTRUMENTS);
end

Will get you drop down menu of all available pairs.

Code: Select all
function getInstrumentList()
    local list={};
   local point={};
   
    local count = 0;   
    local row, enum;   
   
    enum = core.host:findTable("offers"):enumerator();
    row = enum:next();
    while row ~= nil do
        count = count + 1;
        list[count] = row.Instrument;
      point[count] = row.PointSize;
        row = enum:next();
    end
   
   
    return list, count,point;
end

  Pair, Count,Point = getInstrumentList();


getInstrumentList function will populate Pair variable with a array of available pairs.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 6 guests