KyleK29 258 Posted September 20, 2018 (edited) Slight tweak to the prior command (I edited it into the post above this), moved TogSShare to before the ROUTE/SEND commands. Reading up on this box, I guess it's for sending a different share quantity than what your actual order quantity is (only certain exchanges support it). Figured it's best to clear it before we send to the exchange. Some people up above mentioned they'd like it to drop a line to where your "stop" is. I believe I can whip this up with a side program to execute the macro, I'll post if I do so. Edited September 20, 2018 by KyleK29 --------------------------------------------------------- ○ Profile / Project Pages (Dynamic Hotkeys, StreamDeck Files, and other contributions are located here) Share this post Link to post Share on other sites
Jason W 17 Posted October 8, 2018 On 9/18/2018 at 1:13 PM, KyleK29 said: Re: Over Buying Power Not fully tested so USE ONLY IN SIM for the time being, but this might work. Note that we have to do some tomfoolery since DAS doesn't allow actual math on a lot of things, so the roundabout way of doing this is to get around the limitations. I'll explain what's going on down below. This should load in the shares based on an equation of 1% of your account value. In DAS Simulator, Buying Power is 4 * account balance, so by default that's 25,000 * 4 = $100,000. If you wanted to risk 1% of account value as Andrew says (as the maximum, you may chose .5%), that'd be $250 dollars risked. Buy: SShare = BP * 0.25 * 0.01 * Price; Price = Ask-Price + 0.01; Share = SShare / Price; TogSShare; ROUTE=SMRTL;Price=Ask+0.10;TIF=DAY+; BUY=Send; SShare = BP * [reversing the leverage given, so 4:1 is a decimal of 0.25 = 25% of buying power] * [decimal of your risk percentage, 0.01 = 1%] * Price; Price = Ask-Price + [this is an offset in the initial equation]; Share = SShare / Price; TogSShare; ROUTE=SMRTL;Price=Ask+ [this is the fill-zone you use to make sure you get filled, Andrew uses 0.05 I believe] ;TIF=DAY+; BUY=Send; Sell: SShare = BP * 0.25 * 0.01 * Price; Price = Price-Bid + 0.01; Share = SShare / Price; TogSShare; ROUTE=SMRTL;Price=Bid-0.10;TIF=DAY+; SELL=Send; So what's happening (I'll use the Buy example, but applicable to both): 1) SShare = BP * 0.25 * 0.01 * Price; ---> This is setting a "Share Display" box to equal the BP * 0.25 * 0.01 * Price. It's worth noting that using the BP function (buying power) in DAS is actually divided by symbol price (so BP * 0.25 = $100,000 * 0.25 = $25,000 / PRICE). The 0.01 in this equation is the decimal for 1%. If you wanted to risk 2% of your account value, it'd be 0.02. BP = 100,000 / PRICE --> If Stock Price = $10, this would be 10,000 --> 10,000 * 0.25 = 2,500 --> 2,500 * 0.01 [1% risk] = 25 --> 25 * PRICE [$10 for example] = $250 --> $250 is the amount we're willing to risk on this trade. Side Notes: A) If you're wanting to do 1% of BUYING POWER, I'd recommend setting the "decimal of account equity" (0.25 up above) to 0.90, as this gives you a math cushion to not get rejected for lack of buying power. B) If you want to do a fixed dollar amount, you may need to play around with the ratios a tad. Setting SShare to a fixed price will result in the same issue of not having enough buying power in certain scenarios. 2) Price = Ask-Price + 0.01; --> Untouched from the original. It's essentially the Level 1 ASK Price minus the chart-clicked PRICE + 0.01 (offset value). For this example, let's assume we wanted the stock price on ASK was $10.00 and we clicked the chart at $9.95 --> Stop Distance = $0.05 3) Share = SShare / Price; --> Instead of the assigning the default 125 / Price (for $125 / Price), we use our stored value of $250 so it becomes $250 / Price. For the $10 example, this would be 250 / stop distance of $0.05 = 5000 shares 4) TogSShare; --> This toggles the "Share Display" box that we used to store our temporary value to off, releasing the variable. 5) ROUTE=SMRTL;Price=Ask+0.10;TIF=DAY+; BUY=Send; --> Unchanged from the original. Some Gotchas: We have to pass from float to int values in memory a few times [DAS wants INT for the display box], this will "lop off" anything after the decimal. e.g. 5.85 becomes 5. So it might not be mathematically exact, but close enough for our purposes. Thank you so much. Share this post Link to post Share on other sites
MadsFromDenmark 10 Posted March 4, 2019 Does this still work? Share this post Link to post Share on other sites
Mohammedsahmed 5 Posted March 21, 2019 On 9/20/2018 at 9:27 AM, KyleK29 said: Slight tweak to the prior command (I edited it into the post above this), moved TogSShare to before the ROUTE/SEND commands. Reading up on this box, I guess it's for sending a different share quantity than what your actual order quantity is (only certain exchanges support it). Figured it's best to clear it before we send to the exchange. Some people up above mentioned they'd like it to drop a line to where your "stop" is. I believe I can whip this up with a side program to execute the macro, I'll post if I do so. Would love to add a stop on that double click. Did you have any luck with this? Please say yes 🙂 1 Share this post Link to post Share on other sites
Jramosent 1 Posted May 25, 2019 On 6/14/2018 at 7:21 AM, fjmocke said: Hi everyone, I've seen most people calculating shares to trade as a quick estimate. I like to trade a fix risk percentage for risk management and my brain unfortunately struggles to do the calculation in one second! Below is script for buy and sell that you can configure a hot key with to automate the calculations for you. What is important is that you enable 'Double click to trade' in your chart settings (Configure). Double clicking on any area in the chart will save the Price, which is your stop loss price. The script will then calculate the amount of shares required, and open the trade for you in one go. The 125 value in the script is the $ amount you want to risk. Change this as your account grows. Hope it helps, and let me know if there is a bug in the scripts. Buy Price=Ask-Price + 0.01;Share=125 / Price;ROUTE=SMRTL;Price=Ask+0.10;TIF=DAY+;BUY=Send Sell Price=Price-Bid + 0.01;Share=125 / Price;ROUTE=SMRTL;Price=Bid-0.10;TIF=DAY+;SELL=Send Quesiton, when a stock is SSR.S and you are trying to short using this hotkey I have had it give me an error message. Is it because it was not on a uptick? Share this post Link to post Share on other sites
Solomon Negusse 0 Posted May 29, 2019 hey @fjmocke, i was wondering if you managed to set the stop price from the intermediate x=125/share variable? i'd really appreciate your response - have really hard time w/ risk management. Share this post Link to post Share on other sites
Jramosent 1 Posted May 31, 2019 Any advice on using this hotkey for a short selling restriction stock? Share this post Link to post Share on other sites
Ercilia182 4 Posted June 6, 2019 HI guys, I Need help!!! so I created a hotkey in montage, that automatically places a SL .10 away from my entry. The thing is that I don't think its working and I am not sure what I am doing wrong. I enter the # of shares I want to buy hit the hotkey, but it prompts me to enter the SL amount. I want to DAS to do it automatically and I don't know how. Here is what I am using: Price=Ask+.05;TIF=DAY+;Buy=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost-0.10;Share=Pos;TIF=DAY+;SELL=Send; Price=Bid-.05;TIF=DAY+;Sell=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost+0.10;Share=Pos;TIF=DAY+;BUY=Send; thanks. Share this post Link to post Share on other sites
KyleK29 258 Posted June 6, 2019 39 minutes ago, Ercilia182 said: HI guys, I Need help!!! so I created a hotkey in montage, that automatically places a SL .10 away from my entry. The thing is that I don't think its working and I am not sure what I am doing wrong. I enter the # of shares I want to buy hit the hotkey, but it prompts me to enter the SL amount. I want to DAS to do it automatically and I don't know how. Here is what I am using: Price=Ask+.05;TIF=DAY+;Buy=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost-0.10;Share=Pos;TIF=DAY+;SELL=Send; Price=Bid-.05;TIF=DAY+;Sell=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost+0.10;Share=Pos;TIF=DAY+;BUY=Send; thanks. Without testing it myself, I believe the issue is that the AvgCost variable doesn't have any value to it until the initial order fills. In market time, your Hotkey is sending an entry order and the stop order at basically the same time. To test this, you could set the StopPrice = AvgCost-0.10 portion to StopPrice=Ask-0.10, since Ask/Bid variables are always populated by the data feed. You're better off using a Trigger Order for the stop which only executes after the initial entry order fills (and thus, provides an AvgCost value). For an example on how to do that you can check out the other Hotkey thread that spun off this one as it has a few Trigger Orders to build from. With that said, I would not recommend doing an auto stop at a set distance below your entry. Every stock is different and a .10 stop maybe fine for one, but incredibly tight for another (where you basically get instantly stopped). It also prevents you from accurately tracking your risk. The other thread as the versions to do the stop calculation by double-clicking the chart. 1 --------------------------------------------------------- ○ Profile / Project Pages (Dynamic Hotkeys, StreamDeck Files, and other contributions are located here) Share this post Link to post Share on other sites
Ercilia182 4 Posted June 7, 2019 thank you Kyle, I will test this out tomorrow. Yes, I also agreed, .10 stop may be ok for some stocks while tight for others. I wont be using this hotkey on all stocks. again thank you. Share this post Link to post Share on other sites
Ercilia182 4 Posted July 9, 2019 Good Morning Kyle hope all is well, I am testing the stop order below. I enter # of shares I want buy and the stop order triggers in montage .10 risk, I click on Sell and you can see my buy and sell order on montage. lets say the price action is going my direction and I try to sell half it gives me an error message, saying I don't have shorts available. I am just testing. I went long @ 2.62, SL 2.42 Thank You Kyle.. Price=Ask+.05;TIF=DAY+;Buy=Send;ROUTE=STOP;StopType=Market;StopPrice=Ask-0.10;Share=Pos;TIF=DAY+;SELL=Send: Share this post Link to post Share on other sites
Lee W 82 Posted July 9, 2019 4 hours ago, Ercilia182 said: Good Morning Kyle hope all is well, I am testing the stop order below. I enter # of shares I want buy and the stop order triggers in montage .10 risk, I click on Sell and you can see my buy and sell order on montage. lets say the price action is going my direction and I try to sell half it gives me an error message, saying I don't have shorts available. I am just testing. I went long @ 2.62, SL 2.42 Thank You Kyle.. Price=Ask+.05;TIF=DAY+;Buy=Send;ROUTE=STOP;StopType=Market;StopPrice=Ask-0.10;Share=Pos;TIF=DAY+;SELL=Send: Hi @Ercilia182, It appears you are trying to short something for which your broker doesn’t have available shares to short. If it were shortable, there would be an S in the montage next to VWAP. You would click the S and it would tell you how many shares your broker has available for short inventory. In this case, there is no S, hence it isn’t shortable for you. 🙂 Share this post Link to post Share on other sites
Ercilia182 4 Posted July 11, 2019 HI Lee, But that is the thing, I did not go short. I went long and when I tried to sell half, that's the message it gave me. Share this post Link to post Share on other sites
Lee W 82 Posted July 11, 2019 2 hours ago, Ercilia182 said: HI Lee, But that is the thing, I did not go short. I went long and when I tried to sell half, that's the message it gave me. Ah yes. I see that. Perhaps you weren’t actually in the position when you attempted to sell half. Maybe your buy order didn’t execute and when you tried to sell, you didn’t have any shares to sell. Subsequently, it tried to short (which is selling shares you don’t have). That’s my guess. Share this post Link to post Share on other sites
Drew2 5 Posted January 26, 2021 Hey Kyle is there a master list of all the different Hot keys youve come up with that would be great it there was a link to a file thank you for all you do its appreciated.. Share this post Link to post Share on other sites