NexusFi: Find Your Edge


Home Menu

 





Sierra Chart toolbar modifications


Discussion in Sierra Chart

Updated
    1. trending_up 3,232 views
    2. thumb_up 7 thanks given
    3. group 3 followers
    1. forum 9 posts
    2. attach_file 1 attachments




 
Search this Thread

Sierra Chart toolbar modifications

  #1 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,661

@ktrade, I was wondering - do you think it is possible to modify the toolbar (menu bar) of Sierra, like what is popularly done with Ninja these last few years?

Initial idea is mainly to add buttons - like toggle switches for hide on/off indicators.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #2 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


Big Mike View Post
@ktrade, I was wondering - do you think it is possible to modify the toolbar (menu bar) of Sierra, like what is popularly done with Ninja these last few years?

Initial idea is mainly to add buttons - like toggle switches for hide on/off indicators.

Mike

Yes, I believe something along those lines is possible. Although we would need to thread carefully as there are frequent updates to sierra so when modifying things outside the published api might break in future releases.

Also, a study can define 4 toolbar buttons through the api, but they will belong to the study, meaning more general functionality would not be possible.

--ktrader

Reply With Quote
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,661



ktrader View Post
Yes, I believe something along those lines is possible. Although we would need to thread carefully as there are frequent updates to sierra so when modifying things outside the published api might break in future releases.

Also, a study can define 4 toolbar buttons through the api, but they will belong to the study, meaning more general functionality would not be possible.

--ktrader

And I want to clarify because my terminology may be wrong...

I use undocked charts only. So I am NOT talking about the main Sierra "toolbar" (as they call it). I am instead talking about each undocked chart window, the menubar of that window (Edit, Tools) having some buttons added to the right to control some stuff, like switching on/off studies or a nice one would be sharing a chart (ftp) etc.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #4 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


Big Mike View Post
And I want to clarify because my terminology may be wrong...

I use undocked charts only. So I am NOT talking about the main Sierra "toolbar" (as they call it). I am instead talking about each undocked chart window, the menubar of that window (Edit, Tools) having some buttons added to the right to control some stuff, like switching on/off studies or a nice one would be sharing a chart (ftp) etc.

Mike

Something like the attached screenshot?


Reply With Quote
  #5 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,661


ktrader View Post
Something like the attached screenshot?


Yup. Was thinking right-justified, but yes.

Doesn't even have to be icons, can just be buttons if easier.



Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #6 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


Big Mike View Post
Yup. Was thinking right-justified, but yes.

Doesn't even have to be icons, can just be buttons if easier.



Mike

They can be right justified too . Icons are the same difficulty - the screenshot is an actual screenshot of my sierra so they are already there (the background blitting, is off by a pixel so it looks odd - but its possible to fix (thats why the icons background are a bit off - the whole mess is because the bitmaps can not be transparent here, so i copy the backbackgroup draw the icon and put the bitmap back, but is off by a pixel) - also as you might notice the menubar is higher than normal, to fit the 32x32 icons - but any size is ofcourse possible if it is prefered to keep the menubar the original size.

What kind of functionality did you have in mind to attach to these buttons , the one I made and took the screen shot off, switches the chart symbol between 4 currency futures.

--ktrader

Reply With Quote
  #7 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,661


ktrader View Post
They can be right justified too . Icons are the same difficulty - the screenshot is an actual screenshot of my sierra so they are already there (the background blitting, is off by a pixel so it looks odd - but its possible to fix (thats why the icons background are a bit off - the whole mess is because the bitmaps can not be transparent here, so i copy the backbackgroup draw the icon and put the bitmap back, but is off by a pixel) - also as you might notice the menubar is higher than normal, to fit the 32x32 icons - but any size is ofcourse possible if it is prefered to keep the menubar the original size.

What kind of functionality did you have in mind to attach to these buttons , the one I made and took the screen shot off, switches the chart symbol between 4 currency futures.

--ktrader

A shortcut to the Edit - Screen Images - Upload with Overlays would be nice.

I'd also like buttons to turn on/off indicators (hide them), if it is possible to tie a button to a specific indicator # that would be nice.

Shortcut buttons to change chart templates (Analysis -> template) to a predefined template.

I am sure others can come up with great ideas.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #8 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844

Can you provide example code of how you made the buttons? I would like to be able to make my own chart trader.

Reply With Quote
  #9 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


Big Mike View Post
A shortcut to the Edit - Screen Images - Upload with Overlays would be nice.

I'd also like buttons to turn on/off indicators (hide them), if it is possible to tie a button to a specific indicator # that would be nice.

Shortcut buttons to change chart templates (Analysis -> template) to a predefined template.

I am sure others can come up with great ideas.

Mike

It sounds like it would be best to define a generic way to add buttons and hook it into calling functions in sierra, either through the api or by making lower levels hooks into sierra - so we get a more customizable solution.

I will try to make an initiel version that displays the different handles we can attach to in sierra and then we can hopefully get some ideas and input to how it is best utilized.

--ktrader

Reply With Quote
  #10 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275



vegasfoster View Post
Can you provide example code of how you made the buttons? I would like to be able to make my own chart trader.

Sure...

they are not actually buttons in this case, but I had to make them as menu-items as they went to the menu-bar:

To get the menu i get the window handle of the chart-window inside the study (this is for detached charts)

 
Code
HWND hwnd = sc.ChartWindowHandle;
then i get the main menu:

 
Code
HMENU menu = GetMenu(hwnd);
then i add the 4 menu-items as bitmap items:

 
Code
		MENUINFO menuinfo;
		GetMenuInfo(menu,&menuinfo);
		menuinfo.cyMax=36;
		menuinfo.fMask |= MIM_MAXHEIGHT;
		SetMenuInfo(menu,&menuinfo);

		h= LoadImage(NULL, L"c:\\img\\usd.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_LOADTRANSPARENT);
		AppendMenu(menu,MF_BITMAP,103992,(LPCWSTR) h);
		h= LoadImage(NULL, L"c:\\img\\eur.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
		AppendMenu(menu,MF_BITMAP,103993,(LPCWSTR) h);
		h= LoadImage(NULL, L"c:\\img\\gbp.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
		AppendMenu(menu,MF_BITMAP,103994,(LPCWSTR) h);
		h= LoadImage(NULL, L"c:\\img\\yen.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_LOADTRANSPARENT);
		AppendMenu(menu,MF_BITMAP,103995,(LPCWSTR) h);
I just load the icons from my disk as it makes it easier to change for me , you can also have them as resources directly in your dll.



notice you would need to check if you already added something for, a very simple check would be the menu item count:
 
Code
int x=GetMenuItemCount(menu);


Notice I gave my menu items id's 103992-103995, i just chose them arbitrarily as numbers not conflicting with sierra.

To be able to listen if anyone pressed your menu items you would need to hook into the message loop by:
 
Code
	if (hook==NULL && hwnd!=NULL) {
		unsigned long processID = 0;
		GetWindowThreadProcessId(hwnd, &processID);
		hook =SetWindowsHookEx(WH_CALLWNDPROC ,&CallWndProc,inst,GetCurrentThreadId());
		if (hook==NULL) {
			sc.AddMessageToLog("hook not installed",0);
		} else {
			sc.AddMessageToLog("hook installed",0);
		}
}
When a menu item is selected you would get WM_COMMAND so your CallWndProc would need to listen to this:

 
Code
LRESULT CALLBACK CallWndProc(int code,WPARAM wParam,LPARAM lParam) {
	if (code<0) {
		return CallNextHookEx(0,code,wParam,lParam);
	}

	CWPSTRUCT* msg = (CWPSTRUCT*) lParam;
	switch (msg->message) {
		case WM_COMMAND:
			// check if it one of your buttons here. Also you might want to check if its the right hwnd
		break;

	}
	return CallNextHookEx(hook,code,wParam,lParam);
}
As this requires you to keep some data outside of sierra I would have my own datastructures in the dll, to keep track of which windows i have buttons in (and thus not use the study's capabailities of storing data).

you also need to unhook your wndproc hook when you are done.

 
Code
UnhookWindowsHookEx(hook);

Also, a sierra study is a normal dll, so you can do some initialization and other things as normal in DLLMain:

 
Code
static HINSTANCE inst;

BOOL WINAPI DllMain( HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) {
	switch (fdwReason) {
	case DLL_PROCESS_ATTACH:
		inst = hinstDLL;
		break;
	}
	return TRUE;

}
I just choose to save dll instance in a static instance, as it will only be loaded once. You could choose to clean up, if you had saved all the structures "yourself" (as oppose to save them with the study) when you are detached.


Another, much simpler way, would be to use the built-in capabilities to add 4 buttons pr study to a study toolbar, but they dont give you the same degree of flexibility, but you can have buttons and get notified when they are pressed directly in the study.

--ktrader

Reply With Quote




Last Updated on June 13, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts