Login Page - Create Account

Support Board


Date/Time: Tue, 25 Feb 2025 07:22:57 +0000



[Programming Help] - How to create a Window with a Table in Sierra Chart Custom Study

View Count: 3048

[2021-04-04 00:31:27]
User741184 - Posts: 44
Hi,

I have been making a custom study for Sierra Chart using ASCIL. I need to make a window with a table in it which has some rows and columns(including the column and row headers). Also I need to add some buttons in that window which enables/disables certain columns in the table. I have attached a picture as a reference, the x(cross mark) in the picture means clickable action to enable or disable that particular column.

There is not much help/support available in ACSIL. I don't know how to begin with this scenario. I would appreciate if you could help me in beginning with the implementation. Do I need to use Win32/Windows API or it could be implemented using WinForms? Do ACSIL provide support for that? Thanks
Attachment Deleted.
imageSample.PNG / V - Attached On 2021-04-04 00:27:11 UTC - Size: 7.08 KB - 436 views
[2021-04-04 02:04:41]
trader0222 - Posts: 30
Hi there,

Just a thought for you since i have something similar but i did not use ASCIL to accomplish this.

I used a quote spreadsheet
[2021-04-04 07:27:26]
Ticks - Posts: 198
SC support.
Please provide your users a working .cpp example of how to display a fully functional and usable form.

Form should include buttons, input boxes, etc that actually perform an action when used.
[2021-04-04 07:53:33]
Ackin - Posts: 1865
Use of Dialog Windows in Advanced Custom Studies
A custom study creation of windows and dialog windows through the operating system API functions can be done. In the case of dialog boxes on the Windows operating system, refer to Dialog Boxes.

Any programming help in this area is not within the scope of this documentation. It is up to you and your abilities to do that type of development if you require. It is possible but outside the scope of any documentation provided here.

An Advanced Custom Study within Sierra Chart, creating what is known as a "modal" dialog window must never be done and is not supported. These types of windows require the user to press a button to save the settings and close the dialog window before processing continues after the creation of this type of window. This will cause serious malfunctioning in Sierra Chart when that dialog type window is displayed from an Advanced Custom Study.

What will happen is that once that window is displayed, there will be a call back into the study function over and over again until there is a stack overflow. Sierra Chart will then abnormally shutdown at some point.

ACSIL Programming Concepts: Use of Dialog Windows in Advanced Custom Studies


https://docs.microsoft.com/cs-cz/windows/win32/dlgbox/dialog-boxes?redirectedfrom=MSDN
[2021-04-04 19:56:13]
User741184 - Posts: 44
@trader0222 is the support of clickable buttons available in quote spreadsheet?
[2021-04-04 22:39:09]
Ticks - Posts: 198
Use of Dialog Windows in Advanced Custom Studies
A custom study creation of windows and dialog windows through the operating system API functions can be done. In the case of dialog boxes on the Windows operating system, refer to Dialog Boxes.

Any programming help in this area is not within the scope of this documentation. It is up to you and your abilities to do that type of development if you require. It is possible but outside the scope of any documentation provided here.

An Advanced Custom Study within Sierra Chart, creating what is known as a "modal" dialog window must never be done and is not supported. These types of windows require the user to press a button to save the settings and close the dialog window before processing continues after the creation of this type of window. This will cause serious malfunctioning in Sierra Chart when that dialog type window is displayed from an Advanced Custom Study.

What will happen is that once that window is displayed, there will be a call back into the study function over and over again until there is a stack overflow. Sierra Chart will then abnormally shutdown at some point.

ACSIL Programming Concepts: Use of Dialog Windows in Advanced Custom Studies


https://docs.microsoft.com/cs-cz/windows/win32/dlgbox/dialog-boxes?redirectedfrom=MSDN

This genus has been able to get forms to display and interact with strats and indicator in SC.
So it can be done.

https://www.youtube.com/watch?v=-Nca_qF0Fd0&t=9s
Attachment Deleted.
imageForm in SC.PNG / V - Attached On 2021-04-04 22:36:53 UTC - Size: 881.34 KB - 507 views
[2021-04-04 23:34:36]
User741184 - Posts: 44
@Ticks, yes it seems doable with ACSIL but somehow there is no documentation on how to integrate that in custom study. The code is quite tricky to make it work.
[2021-04-04 23:39:22]
User741184 - Posts: 44
// Register the window class.
  const char g_szClassName[] = "myWindowClass";

  WNDCLASS wc = { };

  wc.lpfnWndProc = WndProc;
  wc.hInstance = NULL;
  wc.lpszClassName = g_szClassName;

  RegisterClass(&wc);

  HWND hwnd = CreateWindowEx(
    0, // Optional window styles.
    "Sample Window Class", // Window class
    "Learn to Program Windows", // Window text
    WS_OVERLAPPEDWINDOW, // Window style

    // Size and position
    CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,

    (HWND)sc.ChartWindowHandle, // Parent window
    NULL, // Menu
    NULL, // Instance handle
    NULL // Additional application data
  );
  ShowWindow(hwnd, SW_SHOW);


In my Sierra Chart custom study function, I have added this code to create a simple window and show it but it is returning me the error. GetLastError() function is returning error code 1407 and the message says Cannot find window class.

What am I doing wrong in the code? Also what should be supplied for HINSTANCE value? In the code above I have given NULL because I don't know from where to get this value. I am stuck here. Folks, your help is appreciated. Thanks.
[2021-04-05 00:14:29]
User741184 - Posts: 44
I have been able to make it run by changing the class name, thank you.
[2021-04-05 00:21:27]
Ticks - Posts: 198
I have been able to make it run by changing the class name, thank you.

Could you post a screen shot and if willing post the working .cpp of the code?
[2021-04-05 00:26:51]
User741184 - Posts: 44
I have not been able to achieve fully what I exactly want to implement. I have just been able to display a blank window on the chart with this code.

const char g_szClassName[] = "myWindowClass";

  WNDCLASS wc = { };

  wc.lpfnWndProc = WndProc;
  wc.hInstance = NULL;
  wc.lpszClassName = g_szClassName;

  RegisterClass(&wc);

  HWND hwnd = CreateWindowEx(
    0, // Optional window styles.
    g_szClassName, // Window class
    "Learn to Program Windows", // Window text
    WS_OVERLAPPEDWINDOW, // Window style

    // Size and position
    CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,

    (HWND)sc.ChartWindowHandle, // Parent window
    NULL, // Menu
    NULL, // Instance handle
    NULL // Additional application data
  );
  ShowWindow(hwnd, SW_SHOW);

[2021-04-05 00:28:52]
User741184 - Posts: 44
Not sure if the HINSTANCE value should always be NULL in this case. Sierra Chart support people can better comment on it.
[2021-04-05 00:34:06]
User741184 - Posts: 44
Can someone help me with adding table to a blank window? using windows api?
[2021-04-05 00:34:37]
Ticks - Posts: 198
Thanks User741184.
Its something for SC customers to work with and build upon.
Could you provide the cpp file as it would assist us with knowing where on the cpp file the code block should go.
[2021-04-05 00:43:53]
User741184 - Posts: 44
I am also trying to build on it but currently stuck with it.
[2021-04-05 11:03:27]
User310645 - Posts: 49
I posted some simple examples in this thread previously Using Visual Studio C++ to create Custom Studies
Once you have the basics then its really just a matter of standard Windows API GDI programming.
[2021-04-07 22:09:21]
User741184 - Posts: 44
Can anyone please answer this. What should be set as the style of window? Should it be WS_OVERLAPPED or WS_CHILD? Do we need to make it a child window of Sierra Chart?

Also how should I set the coordinates of the Window that it is always displayed on the bottom left of the opened Chart?
[2021-04-29 13:04:41]
User310645 - Posts: 49
I've just posted this in the other thread on custom study problems but should probably go here too as a working example
attachmentTradeWindow.cpp - Attached On 2021-04-29 13:03:19 UTC - Size: 7.89 KB - 426 views

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account