Launching a window from Sierra Chart... - Sierra Chart Programming | futures io social day trading
futures io futures trading


Launching a window from Sierra Chart...
Updated: Views / Replies:1,441 / 9
Created: by funk101 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Launching a window from Sierra Chart...

  #1 (permalink)
Elite Member
Margate, Fl.
 
Futures Experience: Advanced
Platform: NinjaTrader/R
Favorite Futures: Futures
 
Posts: 24 since Jun 2009
Thanks: 5 given, 5 received

Launching a window from Sierra Chart...

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?

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
glostrup, denmark
 
Futures Experience: Advanced
Platform: Custom platform
Broker/Data: CQG
Favorite Futures: Futures, Options, Stocks
 
ktrader's Avatar
 
Posts: 249 since Aug 2011
Thanks: 151 given, 274 received



funk101 View Post
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?

Hi,

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.

--ktrader


Last edited by ktrader; June 13th, 2012 at 02:49 PM. Reason: fixed some typos
Reply With Quote
The following 2 users say Thank You to ktrader for this post:
 
  #4 (permalink)
Elite Member
Margate, Fl.
 
Futures Experience: Advanced
Platform: NinjaTrader/R
Favorite Futures: Futures
 
Posts: 24 since Jun 2009
Thanks: 5 given, 5 received

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

Reply With Quote
 
  #5 (permalink)
Elite Member
glostrup, denmark
 
Futures Experience: Advanced
Platform: Custom platform
Broker/Data: CQG
Favorite Futures: Futures, Options, Stocks
 
ktrader's Avatar
 
Posts: 249 since Aug 2011
Thanks: 151 given, 274 received


funk101 View Post
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).

--ktrader

Reply With Quote
The following 4 users say Thank You to ktrader for this post:
 
  #6 (permalink)
Elite Member
Margate, Fl.
 
Futures Experience: Advanced
Platform: NinjaTrader/R
Favorite Futures: Futures
 
Posts: 24 since Jun 2009
Thanks: 5 given, 5 received

Ok, well given what I want to do: Create a DOM in a separate window. Which needs marketdata, etc. What would you suggest? Seems like option 3?

Reply With Quote
 
  #7 (permalink)
Elite Member
glostrup, denmark
 
Futures Experience: Advanced
Platform: Custom platform
Broker/Data: CQG
Favorite Futures: Futures, Options, Stocks
 
ktrader's Avatar
 
Posts: 249 since Aug 2011
Thanks: 151 given, 274 received


funk101 View Post
Ok, well given what I want to do: Create a DOM in a separate window. Which needs marketdata, etc. What would you suggest? Seems like 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).

--ktrader

Reply With Quote
 
  #8 (permalink)
Elite Member
Margate, Fl.
 
Futures Experience: Advanced
Platform: NinjaTrader/R
Favorite Futures: Futures
 
Posts: 24 since Jun 2009
Thanks: 5 given, 5 received

What's wrong here?

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.

***** Build Failed! ***** 18:05:57


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

HINSTANCE hDLL = LoadLibrary("C:\\SierraChart\\Data\\DOM_1.exe");
SCDLLName("MyProc")
SCSFExport scsf_MyProc(SCStudyInterfaceRef sc)
{

if (sc.SetDefaults)
{
// Set the configuration and defaults

sc.GraphName = "MyProc";

sc.StudyDescription = "MyProc";


sc.FreeDLL = 1;

sc.AutoLoop = 1; // true
sc.DrawZeros = 0;
sc.GraphRegion = 1;
sc.ValueFormat = 2;



return;
}
Form^ DOM_1 = gcnew hDLL::Form1();
DOM_1->Show();


}

Reply With Quote
 
  #9 (permalink)
Elite Member
glostrup, denmark
 
Futures Experience: Advanced
Platform: Custom platform
Broker/Data: CQG
Favorite Futures: Futures, Options, Stocks
 
ktrader's Avatar
 
Posts: 249 since Aug 2011
Thanks: 151 given, 274 received


funk101 View Post
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.

***** Build Failed! ***** 18:05:57


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

HINSTANCE hDLL = LoadLibrary("C:\\SierraChart\\Data\\DOM_1.exe");
SCDLLName("MyProc")
SCSFExport scsf_MyProc(SCStudyInterfaceRef sc)
{

if (sc.SetDefaults)
{
// Set the configuration and defaults

sc.GraphName = "MyProc";

sc.StudyDescription = "MyProc";


sc.FreeDLL = 1;

sc.AutoLoop = 1; // true
sc.DrawZeros = 0;
sc.GraphRegion = 1;
sc.ValueFormat = 2;



return;
}
Form^ DOM_1 = gcnew hDLL::Form1();
DOM_1->Show();


}

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)

--ktrader

Reply With Quote
 
  #10 (permalink)
Elite Member
Margate, Fl.
 
Futures Experience: Advanced
Platform: NinjaTrader/R
Favorite Futures: Futures
 
Posts: 24 since Jun 2009
Thanks: 5 given, 5 received

hmm, ok...


I'm using Visual Studio 2010 to compile this is the error I get now:


1 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\sierrachart\myprojects\processhandler\processhandler.cpp 7 30 ProcessHandler
2 IntelliSense: identifier "Form" is undefined c:\sierrachart\myprojects\processhandler\processhandler.cpp 32 2 ProcessHandler
3 IntelliSense: identifier "DOM_1" is undefined c:\sierrachart\myprojects\processhandler\processhandler.cpp 32 8 ProcessHandler
4 IntelliSense: identifier "gcnew" is undefined c:\sierrachart\myprojects\processhandler\processhandler.cpp 32 16 ProcessHandler
5 IntelliSense: expected a ';' c:\sierrachart\myprojects\processhandler\processhandler.cpp 32 22 ProcessHandler


Here's the code:

// ProcessHandler.cpp : Defines the exported functions for the DLL application.
//
#include <Windows.h>
#include "stdafx.h"
#include "C:\SierraChart\ACS_Source\sierrachart.h"

HINSTANCE hDLL = LoadLibrary("C:\\SierraChart\\Data\\DOM_1.exe");

SCDLLName("Process Handler")
SCSFExport scsf_MyProc(SCStudyInterfaceRef sc)
{

if (sc.SetDefaults)
{
// Set the configuration and defaults

sc.GraphName = "Process Handler";

sc.StudyDescription = "Process Handler";

sc.FreeDLL = 1;

sc.AutoLoop = 1; // true
sc.DrawZeros = 0;
sc.GraphRegion = 1;
sc.ValueFormat = 2;



return;
}
Form^ DOM_1 = gcnew hDLL::Form1();
DOM_1->Show();


}

Reply With Quote

Reply



futures io > > > > > Launching a window from Sierra Chart...

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sierra Chart TPO chart + composite volume profile Big Mike Sierra Chart 10 August 2nd, 2016 09:15 AM
How to disable top most status line of chart in Sierra Chart Big Mike Sierra Chart 9 April 16th, 2013 07:07 PM
help with excel writing in sierra chart ALFASSY Sierra Chart 5 May 3rd, 2011 07:35 AM
How to mantain the NT7 graphics without to run up? chart runs out of the window Barrosco NinjaTrader 13 March 30th, 2011 03:08 PM
Get Autohotkey to work with Sierra Chart? vegasfoster Sierra Chart 2 March 21st, 2011 04:54 AM


All times are GMT -4. The time now is 09:03 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-17 in 0.17 seconds with 19 queries on phoenix via your IP 54.226.34.209