Login Page - Create Account

Support Board


Date/Time: Fri, 07 Feb 2025 23:16:11 +0000



[Programming Help] - Remove UpArrow & DownArrow Mappings

View Count: 721

[2020-06-17 13:12:21]
User462086 - Posts: 196
I'd like to use these two keys in a custom study (long entry & short entry) without the bar spacing being affected.

How can this be done? Many thanks!!
[2020-06-17 13:51:20]
User462086 - Posts: 196
One way to do this is to assign the same key combination to both 1) a custom trading keyboard shortcut and 2) the key combination used for the custom study. Then disable 'Trading Keyboard Shortcuts' for the chart the study is applied to.

Unfortunately SC interprets most of the keypresses as user error & blocks the custom study from detecting the keyboard events. SC then prints instructions on how to enable these shortcuts to the message log. This makes no sense to me. My code has intentionally disabled these shortcuts so the study can use them instead.

There must be a way to do this so that the same key combinations will always be used to enter a long trade regardless of whether the keyboard events go to a custom study or go directly to SC.
[2020-06-17 14:07:58]
User462086 - Posts: 196
Just tried using "sc.DoNotRedrawChartAfterStudyReturns = 1" both inside and after the defaults block without success. The chart bar spacing still changes.
[2020-06-18 04:19:29]
Sierra Chart Engineering - Posts: 104368
There is no support for this. Definitively not.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-06-18 10:25:52]
User462086 - Posts: 196
Good to know. I appreciate the response. Will look into remapping the keyboard then.
[2020-06-18 12:29:05]
User462086 - Posts: 196
remapping worked, but finding 2 keys that aren't used for anything & that had unique key codes proved to be impossible for the particular keyboard i'm using.

instead, i found a way to detect the Fn version of my arrow keys, which are media keys. these constants are:

VK_MEDIA_STOP (Fn + Up Arrow)
VK_MEDIA_PLAY_PAUSE (Fn + Down Arrow)
VK_MEDIA_NEXT_TRACK (Fn + Right Arrow)
VK_MEDIA_PREV_TRACK (Fn + Left Arrow)

full list here:

https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes


//to detect the keypress use this function:

bool keydown(int key){
return (GetKeyState(key) & 0x100) != 0;
}

//and call it with something like:

bool mediaStop = keydown(VK_MEDIA_STOP);

this is actually a much better solution because shortcuts to native trading functionality can be used alongside algo assisted shortcuts.
Date Time Of Last Edit: 2020-06-18 12:41:20

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

Login

Login Page - Create Account