Skip to content

CUSTOM_INDICATOR Command

Get data from a custom indicator using the Metatrader iCustom function

Help
{
    "MSG":"HELP",
    "COMMAND":"CUSTOM_INDICATOR",
    "DESCRIPTION":"Get data from a custom indicator using the iCustom function",
    "MANDATORY_TAGS":[
        "SYMBOL (String)",
        "TIMEFRAME (String)",
        "INDICATOR_NAME (String)"
    ],
    "OPTIONAL_TAGS":[
        "PARAM1",
        "PARAM2",
        "PARAM3",
        "PARAM4",
        "NUM (Integer)",
        "INDEX (Integer)"
    ],
    "ERROR_ID":0,
    "ERROR_DESCRIPTION":"The operation completed successfully",
    "DEMO":"MTsocketAPI running in DEMO mode (www.mtsocketapi.com)"
}

Example

Single Line command (necessary for MTsocketAPI):

{"MSG":"CUSTOM_INDICATOR","SYMBOL":"EURUSD","TIMEFRAME":"PERIOD_M5","INDICATOR_NAME":"Examples\\OsMA","PARAM1":12,"PARAM2":26,"PARAM3":9,"PARAM4":"PRICE_CLOSE"}

Same command in Beauty Format:

{
    "MSG":"CUSTOM_INDICATOR",
    "SYMBOL":"EURUSD",
    "TIMEFRAME":"PERIOD_M5",
    "INDICATOR_NAME":"Examples\\OsMA",
    "PARAM1":12,
    "PARAM2":26,
    "PARAM3":9,
    "PARAM4":"PRICE_CLOSE"
}

MTsocketAPI reply:

{
    "MSG":"CUSTOM_INDICATOR",
    "DATA_VALUES":[
        -0.0000061
    ],
    "ERROR_ID":0,
    "ERROR_DESCRIPTION":"The operation completed successfully"
}
Note

We can retrieve the last X values using the NUM tag.