Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I've been with NinjaTrader for years, have developed much for the platform. I just decided to switch back to Sierra, as there is something I hold dear about the platform. However, the DOM is really lacking, and I would like to create my own. I'm pretty comfortable with C#, however, not so much with C++. Is there anyone here that could point me in a direction as to how to open a new window from Sierra, for starters?
Can you help answer these questions from other members on NexusFi?
You can use the normal windows-api (CreateWindow) to create your own window (Both the chart window handle and sierra processhandle is available directly in the study).
You would have to setup compilation to be able to compile with include and libs for the windows api. An easy way is to setup visual studio express and compile from there.
When creating your own windows as part of the sierra thread you have to be careful not to interfere with sierras own processing.
If your UI extensions are more extensive and you are planning to use some kind of framework to aid in designing the ui, like QT or WinForms, I will recommend you to create your own thread and messageloop and run your processing in your own thread (can still be part of the sierra process). I use QT myself for my extensions to sierra that requires a complex UI.
Ok, I have Visual Studio 2010. I can create my DOM in design mode. I can include the proper sierra files, I can save it as a .dll for import into sierra chart, are these steps correct? You speak of the "chart window handle" and "sierra process handle", is the chart handle "sc" in the example studies? If so, then where is the process handle? If I'm off the mark, please explain..
And BTW, thank you for replying to my original message
the chartwindow handle and the process id are available through the "sc" variable - passed to the study function, they are exposed as variables:
sc.ChartWindowHandle - the window handle of the chartwindow
sc.ProcId - the processid of the sierra chart process.
If you are designing the window in a GUI designer, it will probably be using a framework - in this case you need to be careful how exactly you choose to interact with sierra.
There are 3 basic options (these are generalizations, it is possible with extra work to get any combination working, so these are rules of thumb):
1) You do everything in sierra's process and the chart window thread - in this case you need to be very careful not to conflict with anything sierra does it self - also the code will be part of the messaging loop sierra uses itself - so in this case it is difficult to use a different framework than what sierra uses. In essence, a rule of thumb would to restrict yourself to use only the core windows api.
2) You do everything in a framework, but create your own thread. So when your dll is loaded you start your own thread and uses this thread as the messageloop for your window. Many frameworks has the notion of an application , be careful that it doesn't "take over" the entire process as it will still be running in sierra's process. You will be in the same memory space, so to avoid difficulty you should not do it with managed code (like CLR).
3) You do everything in your own process and communicate with the study through an IPC mechanism (sockets, memfile) - in this case there are fewer restrictions to what you do in your own process, but you are not in the same processpace as sierra so you need to comminicate with study with IPC. Because the study is called by sierra's chart thread, you need to be careful that the study pull's information when sierra calls it (so you can not set the study to listen and wait for a semaphore as this will "hang" sierra)
So depending on exactly which framework you have designing your DOM in you are in option 2 or 3 (if its managed code you are in option 3).
If you are planning to do it with unmanaged code I would choose to be in the same process-space as accessing sierra data is easier. If you plan to do it with managed code (.NET for instance) I would choose option 3 and take the processing hit on data exchange (which would need to be IPC).
I'm trying to launch a window and I'm clueless. What's wrong here?
I'm getting this error message in the Sierra compiler:
***** Starting Build of Custom Studies Source File: myProc.cpp ***** 18:05:55
C:\SierraChart\ACS_Source\myProc.cpp(29): Error! E241: col(35) class or namespace 'hDLL' has not been declared
C:\SierraChart\ACS_Source\myProc.cpp(29): Error! E006: col(35) syntax error; probable cause: missing ';'
C:\SierraChart\ACS_Source\myProc.cpp(30): Error! E029: col(14) symbol 'DOM_1' has not been declared
There were compilation errors.
I think you will need to include windows.h (and by including that you need to setup includepaths and link-paths for libs for the windows api's - or use visual studio to compile)