Jump to content
Justin

DAS - Stop Limit Order for Future Entry with Dynamic Share Calculation - Using $Risk with a Stop Loss

Recommended Posts

What does this do:

 

This 2 part script will allow you to set a stop loss, set a future price on your chart where you want to enter, and dynamically calculate the shares you can afford based on a fixed dollar amount.

 

 

What do you mean by “2 part”?:

 

With the current limitations of DAS, it's required to use two scripts (hotkeys) for this to work.

 

1. The first hotkey will set where you want your Stop Loss to be

2. The second hotkey will set where you want your Entry to be
 

Example:

 

  • The High of Day is $49.99
  • The current price is $49.50 and trending back up towards HOD
  • The L2 has lots of strong ASKS at various price levels above $50.00
  • You want to enter if it breaks $50.00
     
  • Double click on the chart where you want to set your Stop Loss - $49.90
    • You hit Hotkey 1
  • Double click on the chart where you want to set your Entry - $50.01
    • You hit Hotkey 2
       
  • If and when the price hits $50.01 it will automatically enter you into the trade with your fixed $Risk and place your Stop Loss.

 

------------------------------------------

 

I used this on NVDA today at 9:51 ($415.63) for a HOD break. Luckily my preset stop was also set right below $415 at $414.97, so I didn't get wicked out 🙂 I actually set it up around 9:40 and wasn’t even looking at the chart when it entered for me! By the time I noticed I was in the trade I was already in the money!

 

 

Scripts:

 

Long $20 Risk:

 

Part 1:

StopPrice=Price

Part 2:

DefShare=BP*0.97;Price=Price-StopPrice;SShare=20/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare; SShare=Share;Share=Price*100; Price=StopPrice; DefShare=Price*100; Price=Share/100; Price=Price+StopPrice; StopPrice=Price; Share=SShare; TogSShare; Price=Price+.05;TIF=DAY+;Route=Stop;StopType=Limit; Buy=Send; Share=DefShare;Price=Share/100; StopPrice=Price; DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

Short $20 Risk:

 

Part 1:

StopPrice=Price

Part 2:

DefShare=BP*0.97;Price=StopPrice-Price;SShare=20/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare; SShare=Share;Share=Price*100; Price=StopPrice; DefShare=Price*100; Price=Share/100; Price=StopPrice-Price; StopPrice=Price; Share=SShare; TogSShare; Price=Price-.05;TIF=DAY+;Route=Stop;StopType=Limit; Sell=Send; Share=DefShare;Price=Share/100; StopPrice=Price; DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

 

Known Issues:

 

  • I have seen the script fail and only enter me with a small number of shares. Uncertain what caused this, but I’ll be looking for it again.

 

Final Thoughts:

 

I’ve been testing this in SIM for a week and wouldn’t advise using it live without doing the same.

 

I know a lot of people have been asking for something like this - I would love to hear what other scenarios people would use this for!

Edited by Justin
  • Like 4

Share this post


Link to post
Share on other sites

One other thing to note is that when you do hit the second hotkey, your order will look like a range order (see picture below). This is actually visually showing your "fill up to" range (Thanks for explaining this Kyle!)

This is a little embarrassing, but I think I had this hotkey working quite awhile ago, I just didn't understand what I was seeing! 🤪 I thought it was some kind of weird range order, that the script wasn't working, and so I always cancelled it before triggering and went back to the drawing board!

FuturePrice.jpg.cdbf8a0444b712cbc92b2d3bb30a4c07.jpg

 

And just going to tag some people who I know were interested in this in another thread:

@Travis Weirich @peterB @JenniferL @WindssKat @Ryan Wilson

  • Thanks 4

Share this post


Link to post
Share on other sites

thanks @KyleK29 and  @Justin.for the follow up as well as the DAS developer team!

the ability to preset limit orders combined with stop loss orders is a great feature that adds value to DAS.. we discussed this app end of 2019 w @KyleK29 so great to see him bring this to fruition working together with DAS developers...

My original idea was to capture an entry at a limit price in a fast moving stock....as happens in the case @Justin mentions above once a stock reaches a price level that often triggers a secondary move...in the case of break of HOD it can briefly trigger another burst when a series of automated orders get triggered so price moves higher very quickly. Setting a buy order that kicks in at a price level ensures you don't get too much slippage...and for scalpers this means a lot bc it ensures you can start partialing out sooner to lock in some profits..

Another use for this technique using hotkeys to program buy/stoplimit orders is when a fast moving stock retraces some part of a move up at the market open, e.g. back to VWAP, a 1, 0.5 or 0.25 point move or any prior resistance level carved out when a stock moved to a new ATH or HOD that then becomes a support level. With a slow moving stock doing this manually is not that hard but when you have a crazy ticker that's in price discovery mode like $NKLA or $BYND that has moderate float and there's a lot of turnover in, the stock can quickly run thru the price you were looking to get in on and since you don't want to chase it you miss out on the trade.

An easy target to watch stocks in retrace mode moving back to is VWAP...many times a stock will briefly touch and take off immediately to resume the upward move....this touch can last the fraction of a second so it's almost impossible to get in on the low price and since these stocks like BYND and NKLA have a high ATR they quickly move a good % away from the intended buy point...

So this technique is especially useful for stocks moving wildly with a strong catalyst at the market open and a huge ATR. For stocks moving at a more moderate pace like AAPL and FB finding these entries w/o slippage is fairly realistic manually...

 

Is an update to the scripts in @KyleK29 spreadsheet available that includes these scripts?

Share this post


Link to post
Share on other sites

Thanks @Justin and @KyleK29! My main strategy is HOD/LOD and this script helped me be much more precise then I normally am with my entries while making sure I still have a HARD stop. Just awesome 😄 

  • Like 1

Share this post


Link to post
Share on other sites
On 7/10/2020 at 3:56 AM, Justin said:

So what do you do when you can’t quite get the script right, and DAS says it’s impossible? Easy answer - You call @KyleK29! A very big thank you for his help on this one!

 

 

What does this do:

 

This 2 part script will allow you to set a stop loss, set a future price on your chart where you want to enter, and dynamically calculate the shares you can afford based on a fixed dollar amount.

 

 

What do you mean by “2 part”?:

 

With the current limitations of DAS, it's required to use two scripts (hotkeys) for this to work.

 

1. The first hotkey will set where you want your Stop Loss to be

2. The second hotkey will set where you want your Entry to be
 

Example:

 

  • The High of Day is $49.99
  • The current price is $49.50 and trending back up towards HOD
  • The L2 has lots of strong ASKS at various price levels above $50.00
  • You want to enter if it breaks $50.00
     
  • Double click on the chart where you want to set your Stop Loss - $49.90
    • You hit Hotkey 1
  • Double click on the chart where you want to set your Entry - $50.01
    • You hit Hotkey 2
       
  • If and when the price hits $50.01 it will automatically enter you into the trade with your fixed $Risk and place your Stop Loss.

 

------------------------------------------

 

I used this on NVDA today at 9:51 ($415.63) for a HOD break. Luckily my preset stop was also set right below $415 at $414.97, so I didn't get wicked out 🙂 I actually set it up around 9:40 and wasn’t even looking at the chart when it entered for me! By the time I noticed I was in the trade I was already in the money!

 

 

Scripts:

 

Long $20 Risk:

 

Part 1:


StopPrice=Price

Part 2:


DefShare=BP*0.97;Price=Price-StopPrice;SShare=20/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare; SShare=Share;Share=Price*100; Price=StopPrice; DefShare=Price*100; Price=Share/100; Price=Price+StopPrice; StopPrice=Price; Share=SShare; TogSShare; Price=Price+.05;TIF=DAY+;Route=Stop;StopType=Limit; Buy=Send; Share=DefShare;Price=Share/100; StopPrice=Price; DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

Short $20 Risk:

 

Part 1:


StopPrice=Price

Part 2:


DefShare=BP*0.97;Price=StopPrice-Price;SShare=20/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare; SShare=Share;Share=Price*100; Price=StopPrice; DefShare=Price*100; Price=Share/100; Price=StopPrice-Price; StopPrice=Price; Share=SShare; TogSShare; Price=Price-.05;TIF=DAY+;Route=Stop;StopType=Limit; Sell=Send; Share=DefShare;Price=Share/100; StopPrice=Price; DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

 

Known Issues:

 

  • I have seen the script fail and only enter me with a small number of shares. Uncertain what caused this, but I’ll be looking for it again.

 

Final Thoughts:

 

I very much consider this a BETA release.

 

I’ve been testing this in SIM for a week and wouldn’t advise using it live without doing the same.

 

I know a lot of people have been asking for something like this - I would love to hear what other scenarios people would use this for!

Hi Justin,

The last couple of days i got stopped out quite a lot. this might be something i have to try.  This should be give me more control.

Question #1: So lets say im using the following script. is it sufficient to remove the StopPrice=Price-0.01 part and put it into a different hot key?

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=LIMIT;Price= Ask+0.03;TIF=DAY+;BUY=Send;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.3 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;


Question #2: Maybe my stop price (Price-0.01) is a little to tight? what do you recommend?

Share this post


Link to post
Share on other sites

Thanks again! Made 12R on MRNA this morning (personal best trade in my 4-months trading) using the hotkeys for easy ADD and REDUCE strategy at HODs.

 

79620906_MRNATrade2020-07-24.thumb.png.b74f675ae512cb146ddbec076b46d3e0.png

Edited by Ryan Wilson

Share this post


Link to post
Share on other sites
1 hour ago, Ryan Wilson said:

Thanks again! Made 12R on MRNA this morning (personal best trade in my 4-months trading) using the hotkeys for easy ADD and REDUCE strategy at HODs.

Well done Ryan! Super happy for your success 🙂

Share this post


Link to post
Share on other sites
On 7/9/2020 at 9:56 PM, Justin said:

So what do you do when you can’t quite get the script right, and DAS says it’s impossible? Easy answer - You call @KyleK29! A very big thank you for his help on this one!

 

 

What does this do:

 

This 2 part script will allow you to set a stop loss, set a future price on your chart where you want to enter, and dynamically calculate the shares you can afford based on a fixed dollar amount.

 

 

What do you mean by “2 part”?:

 

With the current limitations of DAS, it's required to use two scripts (hotkeys) for this to work.

 

1. The first hotkey will set where you want your Stop Loss to be

2. The second hotkey will set where you want your Entry to be

 

Final Thoughts:

 

I very much consider this a BETA release.

 

I’ve been testing this in SIM for a week and wouldn’t advise using it live without doing the same.

 

I know a lot of people have been asking for something like this - I would love to hear what other scenarios people would use this for!

How is this working for you? Ready for Live? Any of issues or changes?

Share this post


Link to post
Share on other sites
1 hour ago, Thomas said:

How is this working for you? Ready for Live? Any of issues or changes?

Well with any hotkey you'll want to test in in sim yourself. But I have been using it live to great success!

Share this post


Link to post
Share on other sites

that's great to hear, I will try it in sim, TY!

Just wanted to check-in and see if any known issues or things to consider based on your recent experience.

I really appreciate your quick response. You have been very helpful and this is a nice script that should help me get better entries.

Share this post


Link to post
Share on other sites

Always try in SIM to get an understanding how it plays with your other hotkeys and style. I do a lot of adds and reduction in risk as I go, so I’ve had to learn a specific way to use these. For example, when I’m already in a position with a SL and this triggers, the new SL will be full Position size, leaving my old SL a potential issue. I have to make sure and clear the original SL out. There’s some other things as well as I like to stack future limit orders. 
 

I also had a weird hiccup today on a short entry. It’s worked probably 20 times already, but this time it doubled my risk. Really weird since it’s calculating shares based on fixed $ amount in the script. I tried reproducing the issue afterwards but wasn’t able to. I thought maybe slippage but looked back at the logs and it just doubled it for some reason. Wondering if I accidentally pressed the second hot key twice...

 

in short - try it out, it’s awesome! Fits my trading style so well. I’ve been struggling turning a profit (I’m 4 months new), and since this script I’ve been green everyday. 

Share this post


Link to post
Share on other sites

Hey All, @Justinthanks for posting this!

I'm having trouble understanding what's going on though, I'm probably misunderstanding what it's supposed to do but after setting the stop position with part 1 and then creating the market order with step 2 I was expecting the market entry to be at the price selected at part 1 and the entry to be at the price selected at part 2 but that doesn't seem to be happening.

The number of shares is being calculated correctly but the stop price seems to be the price selected in part 2 and the entry price seems to be 5c above that. So essentially part 1 is only used for the share calculation and not for the actual stop loss.

Example:

  1. Double click the chart at 250
  2. Press "Part 1" hotkey
  3. Double click the chart at 251
  4. Press "Part 2" hotkey

After step 4 a market order will be created at 251.05 with a stop loss at 251. That seems to match what I'm seeing in the script so I assume it is international?

Price=Price+.05;...;StopPrice=Price;

Is that right or maybe I'm using this wrong?

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

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.