Jump to content
Justin

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

Recommended Posts

Hmmm hard to say... it does look like it's trying to work ūüėõ The sell of 50% (28 shares) at the current price, the new stop at your average price for the remaining 50% (29 shares).... But the old stop should have cleared.

Did you remember to remove the + after DAY in the script?

Share this post


Link to post
Share on other sites
CXL ALLSYMB;ROUTE=LIMIT;Price=BID-0.05;Price=Round2;Share=Pos*.50;TIF=DAY;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=DAY;SELL=SEND

works for me everyday. so i would suspect you have a syntax error in your actual hotkey. if you test the hotkey on non-shortable stocks, does it work? it should not allow you to place the order as you cnat sell the stock until you do the CXL ALLSYMB before. so test that please

Edited by peterB

Share this post


Link to post
Share on other sites
On 2/3/2021 at 4:16 PM, Justin said:

You can definitely do a 2:1 range order in the same "part-2" hotkey, but it would be a full exit at the stop loss and 2R.

How would you script this?  I have a hotkey for manual entry that does this, but I'd love to be able to pre-select my entry price.

Share this post


Link to post
Share on other sites
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

so maybe state exactly what you want to achieve by words and there is a 90% chance that someone has it already prepared for you ūüôā

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
18 hours ago, justinstrommer9 said:

Route=Stop

you need to have Route=SMRTL for Interactive brokers

edit: sorry i missed that it is for future entry order

Edited by peterB

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.