Jump to content

We have moved to Discord. Please click here to join us in the Trading Terminal Discord server.



These forums are read-only.

RussWilliamL

Big Screwup when I hit my hotkey today

Recommended Posts

RussWilliamL

I have a HotKey that goes like this:

CXL ALLSYMB;
FocusWindow MONTAGE1;
Route=SMRTM;
Share=BP*0.025;
TIF=DAY;
Sell=SEND;

The idea is to enter a position that is 2.5% of my BuyingPower.

The HotKey normally works fine, but this morning it mis-calculated and entered a trade for 25% of my BuyingPower.

I freaked out when I realized I had ten times the shares I wanted, and got out of the trade immediately... (with a profit.  A BIG profit.)

I went in and looked at the DAS Trader Pro Event Log and my OBS recording to see if maybe there was a "stuck" key that entered the order ten times, but no, it entered the order only once for ten times the amount it should have.  (I trigger my HotKeys with a StreamDeck.)

Since I only trade one stock, I think I'm going to switch to a fixed share that I calculate myself every morning before trading.

 

Russell Landwehr

Share this post


Link to post
Share on other sites
RussWilliamL
38 minutes ago, peterB said:

Shares = BP*0.025 means effectively that you want trade so many shares. Not risk so much money so if your BP is 100 000 then you wanted to buy 2500 shares which you probably did not want. BP and Number of shares are not related while risk and number of shares are. so i believe your hotkey is miserably wrong and you have not tested it in demo account properly. 2.5% of your buying power means you want shares for $2500 not that you want 2500 shares.

btw the BP calculations never worked properly in DAS. but the fix is easy -use static risk instead of calculated risk. if your BP is 100 000 then just use your calculated number instead of the BP variable and you will have it always right

This HotKey has been working flawlessly in SIM and with my Live account for well over 100 trades.  It is not "risk-based" only "entry-size based".  

With a Buying Power of $100,000 and a Stock Price of $100, it does the calculation like this:  BP($100,000) * 0.025 = $2,500 / price $100 = 25 shares.

This morning it returned ten times the number of shares it should have.... for instance - in this calculation we are doing - 250 shares.

I was unaware that BP calculations in DAS were unreliable.  From now on, I will be setting fixed shares in my HotKeys prior to trading every morning.

 

Edited by RussWilliamL

Share this post


Link to post
Share on other sites
RussWilliamL

Yes, "entry-size based" as in "dollar-sized".  Perhaps I should have said that Share=BP*0.025; populates the "shares" portion of the montage with the correct number of shares to equal 2.5% of my BuyingPower.

Except for this one time when it populated the shares with ten times the number it should have.  I cannot have DAS making a mis-calculation like that, so I will be calculating the number of shares myself before beginning my trading session.

My trading style is not based on "R".

Share this post


Link to post
Share on other sites
RussWilliamL

My intent for my hotkey is to buy the correct number of shares so that my Position's Market Value is 2.5% of my Buying Power.  2.5% IS NOT my "Risk", it is my Position Size.  When you said, "if you know that your BP is 100 000 and want to risk 2.5% just use 2500 number in the formula instead of the BP and if you add the 2500/Price to the forumla you are effectively at static risk which is 1R whether or not you like it that trading is based on "R"", you are saying that my whole position is the "Risk".  That would only be the case if I were LONG and willing to lose ALL of my position when the Price went to $0. 

Your suggested script, " Share=2500/Price; " has merit and returns the same number of shares as " Share=BP*0.025; " , and would be beneficial if I were to trade different stocks.  I might use that in the script until I get to position sizes of 97% BP.

My hotkey ( CXL ALLSYMB; Route=SMRTM; Share=BP*0.025; TIF=DAY; Sell=SEND; ) DOES open a position that is 2.5% of my Buying Power.  I am including a screenshot to show you this.  In the screenshot you will see that Buying Power is $100,000, the stock is about $100, and the position is 24 shares for a $2400 market value.  ( DAS calculated 24 shares because it will not allow this position to exceed BP*0.025 )

4759299_2022-01-07(2).thumb.png.e78a328f4ee7f05c30a6c1691bbaa545.png

Something malfunctioned the other day and DAS shorted  TEN TIMES as many shares as it was supposed to.  This is the ONLY time in over 100 uses of this hotkey script that DAS did this.  In order to determine that DAS screwed up, I first double checked my SHORT hotkey and compared it to the LONG hotkey (since that day I'd done all LONG entries up to that point).  I found both the LONG and SHORT hotkeys to be correct.  I then pulled up my DAS Event Log and found that there was only ONE event that was TEN TIMES as large as it should have been.  This told me that there was no malfunction in my computer hardware or my fingers, that the problem was in the DAS software.  Then I switched to SIM and tested my SHORT hotkey and observed it working correctly without making any changes to my hotkeys.

Because this error was exactly off by 10x, I am now wondering if somehow having a zero in front of the decimal in my script caused DAS to hiccup.  Although in that case, I would think it would have errored in the opposite direction and been off by 0.10x, giving me a position 1/10th the size.

My conclusion from this DAS error is that I cannot rely on DAS to properly calculate my position based on BP.   I won't use my script until I reach the point where I'm trading at 97% of my BP ( CXL ALLSYMB; Route=SMRTM; Share=BP*0.97; TIF=DAY; Sell=SEND; ).  Then it will be impossible for DAS to enter too large of a position, and I can then use the same hotkey to do add-ons after taking partials.

 

 

Share this post


Link to post
Share on other sites
RussWilliamL

Ah, it makes sense that DAS defaults to adding the implied /Price.  If (for instance) my hotkey said Share=BP*0.97, I certainly wouldn't want to buy 97,000 shares of ANY stock. 

It still doesn't explain why it populated ten times the number of shares the one time.

Share this post


Link to post
Share on other sites
RussWilliamL
22 hours ago, Paul aka Aurbano said:

Check this If it helps

Thanks.  That was an interesting read.  It looks like a good screening and target tool.  The script you wrote does some of the things I do by hand/excel.  I am "profit focused" in that I know how much of a move I need in order to take my targeted profits (I base my entry on how likely it seems that I can get a $0.50-$1.00 per share profit quickly).  Much like your script, I take into consideration ATR (1), (5), (10), and (20) and where the price is in relation to that.   I like how the script pulls info from Yahoo to make calculations and outputs a yes/no if the required position size fits BP.  I think it will be a good tool to complement my current screening strategies.

Edited by RussWilliamL
  • Thanks 1

Share this post


Link to post
Share on other sites
Paul aka Aurbano

Hello @RussWilliamL ... I am glad to hear that you find this little tool useful. Hope you can install and set it up and running in your system and of coursa, that it helps your morning routine.

Share this post


Link to post
Share on other sites

[[Template core/front/global/mobileNavigation is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.