35 Comments
User's avatar
Justin Tor's avatar

Thanks Peter, this is great. Do you have a hot key script for a static risk in terms of R (%) instead of dollars? Currently trying this from Kyle's original hotkey scripts but it doesnt seem to work:

StopPrice=Price-0.01;

DefShare=BP*0.97;

Share=DefShare*0.167*Price*0.01;

Price=Ask-Price+0.01;SShare=Share/Price;Share=DefShare-SShare;

DefShare=DefShare+SShare;

SShare=Share;

Sshare=DefShare-SShare;

Share=0.5*SShare;TogSShare;

ROUTE=SMRTL;

Price= Ask+0.05;

TIF=DAY+;

BUY=Send;

DefShare=200;

TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.03 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

Expand full comment
Peter Benci's avatar

oh i did not put it there because it is just to replace the $risk=20; line in my hotkeys for

$RISK=GetAccountObj($montage.account).Equity/100;

i will update the article accordingly.

done.

Expand full comment
Justin Tor's avatar

Hmm. My orders are getting rejected because of insufficient BP, after I double click to set my stop.

Is there are way to calculate the lower of 1% risk or max amount of shares I can buy as dictated by my BP?

Expand full comment
Peter Benci's avatar

yes just a simple query to compare the shares you want and the shares you can afford. but with interactive brokers you never know the margin requirements on the symbol so it is better to do like x% of bp or multiple retries for lower number of shares

Expand full comment
Justin Tor's avatar

Perfect, thanks! Will give that a go.

Expand full comment
Bill's avatar

I think it crashes the program. Happened 2x with me.

Expand full comment
Peter Benci's avatar

how does the crash look like?

Expand full comment
Bill's avatar

It shuts DAS down and I have to log back in.

Expand full comment
Peter Benci's avatar

have you skipped some of the requirements or you have old version of the program installed?

Expand full comment
Bill's avatar

I am running 5.8.0.9. Also got a crash elsewhere that are was not repeatable and it crashes before an error message is generated. This is not good. At least it closes out my orders before the crash

Expand full comment
Peter Benci's avatar

please provide more details and screenshots if you want me to help you. i cannot guess your situation

Expand full comment
Bill's avatar

I think I found it. I was mixing pre-market alert hot keys with regular market hot keys and DAS didn't like it. Time will tell if this is was the problem.

Expand full comment
Bill's avatar

Hi Peter, i cannot get this to cancel my open orders from an alert script and there is no error message. $MONTAGE.CXL ALLSYMB; Any ideas? Thanks.

Expand full comment
Peter Benci's avatar

probably your alert does not trigger

see the log folder for any related messages

Expand full comment
Bill's avatar

Hi Peter, what does the error mean when it says I have a missing object ?

07:13:54 Error ScriptError:100 Line:1 Error:Missing Object at Line:$MYMontage1.symbol=AAPL;$MYMontage1.exechotkey("SELL_to_CLOSE_LONG"); Error at:(.symbol=AAPL;$MYMontage1.exechotkey("SELL_to_CLOSE_LONG");), Thanks.

Expand full comment
Peter Benci's avatar

probably the object referenced in the script does not exist. in this case an object variable $mymontage1

open the variables window and see if the variable exist and is typ object and if not you need to add a line to read the window object into the variable

Expand full comment
Bill's avatar

Hi Peter, does DAS has any published documentation on this so we can see how the new syntax works (i.e how to create the new scripts )and all the available commands that we can use?

Expand full comment
Peter Benci's avatar

they have something on request via support and there is some documentation in the hotkeys section as a description for each command but often contains mistakes

some of the commands exist but the techniques and use cases are up to the user so sometimes even the intention is not clear therefore i started this substack

Expand full comment
Felix Hövelborn's avatar

Hello Peter, thanks for the update. I like this idea to "upgrading" my existing hotkeys to be more suited for future versions, but what about the following use case:

You mention in prior versions we had to click the montage and then click the hotkey / hot button. But that way I could use the same hotkey on all montages, right? In my case, three montages.

How would you handle this going forward? The hotkey would be the same, but I would have to "activate" the correct montage first?

Expand full comment
Peter Benci's avatar

either as you say or have 3 sets of hotkeys for each montage or you can have the montage as a variable depending on which chart you have clicked. i presume you have at least one chart associated with one montage. or you can have the button doing the functionality around any of those chart windows. there are quite some options depending on your use case

Expand full comment
Felix Hövelborn's avatar

I see. Currently, I have three montages and three charts connected to them. So I would focus the ticker on Montage 2 for example and then hit the same "Long vs LOD" Hotkey. If I switched to a different Montage, I could use the same hotkey, which is nice. So I do not see any advantage for me, but I guess I am missing something?

Expand full comment
Peter Benci's avatar

the advantage would be a button under the chart or that you can call it as a hotkey from another script in an alert or timer event or chart update. there are many functionalities besides the entry and exit actions

Expand full comment
Felix Hövelborn's avatar

"you can call it as a hotkey from another script in an alert or timer event or chart update"

That sounds interesting, as I am using the old timer events to activate the trail with prior bar lows on 2 minute chart for example. So I have the global script and the chart scripts and basically Montage3, Chart3, Montage3StopPrice etc...

A lot of variables...

Expand full comment
Peter Benci's avatar

for multiple montages you have to have many variables to keep it under control. or use alerts which are symbol specific

Expand full comment
Anh Pham's avatar

Hi Benci, huge fan of your work and I have to say it has transformed the way I manage my trades. I wonder if you can help me to write a short hotkey for shorting. It will calculate share take up $10,000 position size with a stop loss order attached to it. Thank you

Expand full comment
Peter Benci's avatar

hi Anh Pham, sure! Send me a PM please as i need some more details about your use case.

Expand full comment
Bill's avatar

So do we have to rewrite our old scripts or will they still work and if so for how long?

Expand full comment
Peter Benci's avatar

good question i need to state that in the beginning. you do not have to change anything if you are ok with it how it works for you today. but i encourage you to do so if you will ever want to do any advanced stuff like adding buttons around your chart windows etc.

Expand full comment