Login Page - Create Account

UDP Interface

General Information

Sierra Chart uses a UDP socket interface to receive short text messages to perform some simple actions which are documented below.

All of this can be done from an external program using this interface.

To enable the UDP interface and to change the port number, select Global Settings >> Sierra Chart Server Settings. Set the UDP Port to a nonzero number to enable the UDP interface.

To use the UDP interface, create a UDP socket in a separate program and send a text message to port set in the prior step at the IP address where Sierra Chart is running. Usually this will just be the localhost which is 127.0.0.1. Refer to the UDP Program Code Example.

Using UDP protocol is quite simple and supported by most any programming language.

Opening Chart

If you want to open a chart for a symbol or activate an existing chart for a particular symbol, then send a text string to the UDP port using the following format:

Symbol.dly (for Historical Daily charts)
Symbol.scid (for Intraday charts)

Examples

ESH24-CME.scid

SP500.dly

Release Study DLL

To release a custom study DLL and prevent it from being loaded again, use the following UDP request string:

RELEASE_DLL--[DLLPathAndFileName]

Allow Load Study DLL

To allow future loading of a custom study DLL, use the following UDP request string:

ALLOW_LOAD_DLL--[DLLPathAndFileName]

Release All Study DLLs

To release all custom study DLLs and prevent them from being loaded again until ALLOW_LOAD_ALL_DLLS is sent, use the following UDP request string:

RELEASE_ALL_DLLS

Allow Load All Study DLLs

To allow future loading of all custom study DLLs, use the following UDP request string:

ALLOW_LOAD_ALL_DLLS

UDP Program Code Example

The following is an example to send a UDP command to Sierra Chart. You need to replace the SendBuf text string with the particular command you want to use.

Example

#include <stdio.h>
#include "winsock2.h"

void main() 
{
    WSADATA WSAData;
    SOCKET SendSocket;
    sockaddr_in RecvAddr;
    int Port = 22903;// Set this to the port number you have set in Sierra Chart for UDP

    int BufLen = 128;
    char SendBuf[BufLen] = "ESH24-CME.scid";

    //---------------------------------------------
    // Initialize Winsock
    WSAStartup(MAKEWORD(2,2), &WSAData);

    //---------------------------------------------
    // Create a socket for sending data

    SendSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

    //---------------------------------------------
    // Set up the RecvAddr structure with the IP address of
    // the receiver (in this example case "127.0.0.1")
    // and the specified port number.
    RecvAddr.sin_family = AF_INET;
    RecvAddr.sin_port = htons(Port);

    RecvAddr.sin_addr.s_addr = inet_addr("127.0.0.1");

    //---------------------------------------------
    // Send a datagram to the receiver

    printf("Sending a datagram to the receiver...\n");
    sendto(SendSocket, 
            SendBuf, 
            BufLen, 
            0, 
            (SOCKADDR *) &RecvAddr, 
            sizeof(RecvAddr));

    //---------------------------------------------
    // When the application is finished sending, close the socket.
    printf("Finished sending. Closing socket.\n");
    closesocket(SendSocket);

    //---------------------------------------------
    // Clean up and quit.

    printf("Exiting.\n");
    WSACleanup();
    return;
}
            

*Last modified Tuesday, 05th March, 2024.