Jump to content
Justin

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

Recommended Posts

On 2/2/2021 at 4:14 PM, Justin said:

This will show on the chart (below) as a range order, as the hotkey is set to do a 5 cent range (Price=Price+.05) - you can change this to whatever you're comfortable with.

Could I have this trigger a market order instead of a range?  In other words, one the selected price is hit, I'm fine getting in at any price.

Share this post


Link to post
Share on other sites
12 minutes ago, evan said:

Could I have this trigger a market order instead of a range?  In other words, one the selected price is hit, I'm fine getting in at any price.

Long

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;TIF=DAY+;Route=Stop;StopType=Market; 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

DefShare=BP*0.95;Price=StopPrice-Price;SShare=30/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;TIF=DAY+;Route=Stop;StopType=Market; 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+;

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi Justin,

This is something i've been looking for.

how will this script look for long/short without the calculated risk% but with manually set stop loss?

and how will it look like if its for marked order and limit - short/long.

I'm not at the level that i can reverse engineer the ones you have provided, sorry!

Edited by Alxander

Share this post


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

how will this script look for long/short without the calculated risk% but with manually set stop loss?

Like, you just want to set an order in the future to go long for a fixed $, but the stop is a fixed amount... like 20c?

Share this post


Link to post
Share on other sites

** Changed it myself - Justin and Kyle, this Script is amazing!! this is something you should learn people to use, this is also great for risk management when you want to catch a break out! 

ten out of ten! 

 

Sorry Justin, my head is a little slow these days due to the flu. Ignore my first post.

Is it possible to change the script to buy a fixed amount of 100 shares?

the stop loss is perfect as it is !

My head is just better at handling fixed shares and when i get better i can change the number as i grow as a trader 

Edited by Alxander

Share this post


Link to post
Share on other sites

Hi Justin,

Great work, I am testing this out myself and I prefer trailing stops instead of a limit stop.

Will it be possible to help me adjust the code to a trailing stop?

Share this post


Link to post
Share on other sites

I just started using this and running into an issue. It works in my simulator perfectly, but when I switch to my live account it does not work.  I set the stop and then the second hotkey is not sending an order.  Any idea why this would be happening?   Do i need to add anything to the hotkey script for it to work in live?

Share this post


Link to post
Share on other sites

My broker is interactive brokers.  I am using the same exact hotkey script in this post.  I have it set to CTRL+1 and CTRL+2 to execute the stop and entry hotkeys.   It works perfect in papertrade mode, but no entry hotkey does not respond when live. 

Share this post


Link to post
Share on other sites

this is the LONG ENTRY HOTKEY:

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+;

  •  

Share this post


Link to post
Share on other sites

I changed Route=Stop to Route=SMRTL.  This did not work.  It made me immediately enter the trade at the current price, instead of entering at the entry target I selected. 

Share this post


Link to post
Share on other sites
9 hours ago, peterB said:

you need to have Route=SMRTL for Interactive brokers

No, not for stop orders @peterB.

@justinstrommer9 It's either a syntax error from when you copied it into DAS or you're not executing the script properly.

If you could outline a real example and step by step of exactly what you're doing that would be helpful. Like down to the detail. "I double click on the chart at x price, then hit the first hotkey. Then I double click on the chart at y price and hit the second hotkey."

Share this post


Link to post
Share on other sites

Hey guys thank you so much for the help. I’m not sure what happened before but I was able to use it correctly with the original script on Friday. Seems to be working fine now. Not sure what went wrong before.  I’m going to use this a lot or make trades as I prefer to get in on a break of a candle vs just jumping in. 

Share this post


Link to post
Share on other sites

I tried looking at the script , what would i have to change to setup a script for a 50 , or 100 dollar risk ?

Any help woudl be appreciated

Share this post


Link to post
Share on other sites
12 minutes ago, ivo1969 said:

I tried looking at the script , what would i have to change to setup a script for a 50 , or 100 dollar risk ?

Any help woudl be appreciated

SShare=20/Price;

That number denotes the risk. It's set to $20 currently.

Edited by Justin

Share this post


Link to post
Share on other sites

Thank you Justin , I cant believe I missed  that , must have been looking further down in the script

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.