ionluchian ionluchian - 1 year ago 112
C++ Question

MT4 trading platform API Manager - get securities per group

I am using API manager for the trading platform MetaTrader 4

I need to get ALL SECURITIES per GROUP

for example

i have some tips how to do it below:

    1. After request Securities config using CfgRequestSymbolGroup(ConSymbolGroup configurations) you got all securities.*

    1. So you got ConSymbolGroup for each security and now that configurations[0] is forex, configurations[1] is cfd and configurations[2] is metals for example.*

    1. Then request group config using CfgRequestGroup(int total) you will get ConGroup structure for each group.

    1. ConGroup has ConGroupSec secgroups[MAX_SEC_GROUPS] parameter - security group settings.*

    1. The indexes will be the same so secgroups[0] is forex settings for this group, secgroups[1] is cfd and so on.*

my code is below but can not get the desired result, in the code below i get the list with SECURITIES AND THE LIST WITH GROUPS but can not get indexes based on description above to get the result in this format


// 1 step
// request all securities
// list with securities
ConSymbolGroup securities[MAX_SEC_GROUP];

int result = ExtManager->CfgRequestSymbolGroup(securities);

// 2 step
// request all groups
// list with groups

ConGroup *groups = ExtManager->CfgRequestGroup(&total);
ConGroupSec secgroups[MAX_SEC_GROUPS];

int index_secgroup = 0;
int index_security = 0;

for (int i = 0; i < MAX_SEC_GROUP; i++)
for (int i =0; i < total; i++)


Answer Source

Here is code snippet which will give you required data, so you can output it as you need:

ConSymbolGroup sgconfigurations[MAX_SEC_GROUP];

int total = 0;
ConGroup* result = _manager->Manager->CfgRequestGroup(&total);

for (int i = 0; i < total; i++)
    for (int j = 0; j < MAX_SEC_GROUP; j++) {
        if (result[i].secgroups[j].show == 1) {
            char* groupName = result[i].group;
            char* securityName = sgconfigurations[j].name;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download