64 Comments

these are great, thank you. ive been trying to come up with a fixed risk hot key long/short but instead of using market to enter the order, been trying to do something like split the spread with a limit order. any idea?

Expand full comment

hi Chris, these are limit orders entry hotkeys. What do you need to solve?

Expand full comment

sorry, should've been a little more clear. instead of buying the ask with a limit order im wanting to fill closer to the bid. i guess i could do something like this?

CXL ALLSYMB;

$buyprice=Bid+0.01; // Adjust to buy at the bid price plus 0.01

$risk=20;

$mystop=price;

$pricetostop=$buyprice-$mystop;

$amount=$risk/$pricetostop;

SShare=$amount;

Share=$amount;

TogSShare;

ROUTE="SMRTL";

Price=$buyprice*1.005;

Price=ROUND2;

TIF=DAY+;

BUY=Send;

TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$mystop ACT:SELL STOPPRICE:$mystop QTY:Pos TIF:DAY+

Another one I've been struggling with is the same kind of order (fill slightly above bid) but use a stop limit order to exit - mostly for premarket small cap crazy stocks

but when I try this script

CXL ALLSYMB;

$buyprice=Bid+0.01; // Adjust to buy at the bid price plus 0.01

$risk=20;

$mystop=price;

$pricetostop=$buyprice-$mystop;

$amount=$risk/$pricetostop;

SShare=$amount;

Share=$amount;

TogSShare;

ROUTE="SMRTL";

Price=$buyprice*1.005;

Price=ROUND2;

TIF=DAY+;

BUY=Send;

TriggerOrder=RT:STOP STOPTYPE:LIMIT PX:$mystop ACT:SELL STOPPRICE:$mystop LIMITPRICE:($mystop-0.20) QTY:Pos TIF:DAY+

i get "invalid shares" as the error

Expand full comment

you probably have not enabled advanced hotkeys in das trader pro settings or you are using version 5.8.0.5 which has a bug

Expand full comment

Peter, I use the short with the oco 3r script. However, when I double-click and hit the hotkey, I don't see the short order entered, only the limit order. Do you know how to fix this?

Expand full comment

hi Dan,

it will be placed only after your limit entry hotkey is fully filled as it uses the TRIGGER ORDER command which has this limit

Expand full comment

I tested it on replay, I will try it on real-time tomorrow. Thank you very much

Expand full comment

These are great!

Expand full comment

Good day Peter,

When i use your Static risk of $20 with automatic stop loss order attached it pops up a message stating

"trigger order only work in montage window."

What should i do for this error?

Thanks

Expand full comment

I get the following error.

Msg Box Script : Invalid operator

and this error in Montage Error:Invalid Shares!

When I run the below script using hot Button ($20 risk with 3x target ), I first double click on chart where I want the stop price and then click this Hot Button then I get the above error.

I have latest version of DAS 5.8.0.4 9 Nov 29th, 2024.

Please help.

CXL ALLSYMB;

$buyprice=Ask;

$risk=20;

$mystop=price;

$pricetostop=$buyprice-$mystop;

$target=3*$pricetostop+Ask;

$amount=$risk/$pricetostop;

SShare=$amount;

Share=$amount;

TogSShare;

ROUTE="SMRTL";

Price=$buyprice;

Price=ROUND2;

TIF=DAY+;

BUY=Send;

TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$mystop HighPrice:$target ACT:SELL QTY:POS TIF:DAY+;

Expand full comment

Forgot to mention that I am using Replay mode.

Expand full comment

do not expect replay mode to work with advanced scripting as the data often does not exist

Expand full comment

Hi Peter, is there a way to store and change a variable's value in just one place, so that you can include that variable in multiple hotkeys, but only have to change the value in the one place, instead of having to change the value in each individual hotkey?

Expand full comment

hi EJ, sure there is a way. You can have a prompt for that if you need to change it often or use it as a switch between two values as i do in one of the later posts with the account switcher. Also you csn have it changed based on any calculated or measured indicator value.

Expand full comment

love your work and just started following your blog for the scripts. Quick question: For the 'Static risk of $20 with automatic stop loss order,' how do I set up a fixed number of shares (like 100 shares) instead of having it automatically calculate the number of shares. Thanks.

Expand full comment

you just place a static number at the shares part

Expand full comment

Thanks for your reply, Peter. I did as you mentioned but the stop loss is not working. It is simply not stopping when the loss is over $20. Appreciate your suggestion.

Expand full comment

how is it not working? has the order been placed or not?

Expand full comment

Yes, order has been placed. I am using a simulator account. Do you want me to share a screenshot with you?

Expand full comment

that would certainly help

Expand full comment

https://postimg.cc/DW3Ppvvv

here is the script:

---------

CXL ALLSYMB;

$buyprice=Ask;

$risk=20;

$mystop=price;

$pricetostop=$buyprice-$mystop;

$amount=$risk/$pricetostop;

SShare=100;

Share=100;

TogSShare;

ROUTE="SMRTL";

Price=$buyprice*1.005;

Price=ROUND2;

TIF=DAY+;

BUY=Send;

TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$mystop ACT:SELL STOPPRICE:$mystop QTY:Pos TIF:DAY+

Expand full comment

Hi Peter, For your entry hot keys, what is the reason or purpose for putting in the line SSHARE=$amount?

Expand full comment

that was an old school habit to toggle show share. it is not necessary and you can omit that completely

Expand full comment

Hi Peter, Love your scripts, good work, thank you.

I need to ask you if is it even possible,

Static risk with $20 and attached range (OCO) orders of 3R target - for this script,

can we have two different range orders at the end with 50% position out at 3R and rest of 50% at 4R? like two different targets?

Expand full comment

yes that is quite easy to acomplish-one is to divide it to two orders. the disadvantage is that if you get stopped you pay double commissions. the other is by calling the partial hotkeys at the desired time which has the disadvantage of being complex and has its limitations but i can figure it out with the new timer scripts

Expand full comment

Hi Peter,

I was testing the (Static risk with $20 and attached range (OCO) orders of 3R target) on DAS with a sim account. I have IBKR account by the way. It worked in buying the shares but didn't place any OCO orders for STOP or Take Profit at 3R. any idea why ?

Expand full comment

hi, you probably missed some of the prerequisities or have a syntax error in the script

Expand full comment

Advanced hotkey and double click to trade are both checked and Style is Stop. My other Kyle's hotkeys work fine.

I used the exact script in Replay Mode and selected the sim account on the montage. What should the route be?

Expand full comment

Replay mode is very special. many things do not work there. always test in SIM not in Replay Mode

Expand full comment

Never mind. I was testing them yesterday in a Replay mode and it didn't work properly. Today I tested them when the market opened, and it worked flawlessly.

I need to tweak a little bit on the ($buyprice=Ask) to make me get filled faster.

Also, I tested a risk of $10 on AMZN, and the realized gain was $28.40, I was expecting it to hit exactly $30 as a 3R profit target.

Expand full comment

you can always get some slippage

-on calculation (spread)

-on entry

-on exit

-on commissions and fees

Expand full comment

Hello Peter,

Is it possible to have a condition based on whether my position is a long or a short ?

If I currently hold a long : do this, but if it's a short : do that.

Thank you !

Expand full comment

yes for example you can exit in a single button.hotkey like this

$MYPOS=GetAccountObj("TRIBT8888").getposition($MYSYMB).share;

if ($MYPOS==0)

{

MsgBox("No position to close");

}

else

{

CXL ALLSYMB;

ROUTE=SMRTL;

if ($MYPOS > 0)

{

Share=$MYPOS;

Price=Bid*0.99;

Price=ROUND2;

SELL=Send;

}

else

{

Share=$MYPOS;

Price=Ask*1.01;

Price=ROUND2;

BUY=Send;

}

}

Expand full comment

Is it possible to not calling the account number ? So I can go easily from sim to real ?

Expand full comment

you can create account number trigger into a variable then use that variable in the scripts

Expand full comment

Great It works thank you.

Before that I was doing MYPOS=GetWindowObj("Montage").share;

but would only give me positive number whether it was long or short.

Now with your script it's fine ;)

Expand full comment

Thank you very much for sharing. I am new here. I will test all those hotkeys in the Sim. How can I get your exact chart layout and parameters as shown in the videos? It is super clean and organized. Can you share it please?

Expand full comment

Hello Peter, you say "Although it is possible to write a single hotkey".

Could you explain how ? I miss room on my keyboard.

Thank you 🙏

Expand full comment

hi Ben, that requires a condition if you clicked above or below the current price then execute one of the default hotkeys based on that. Let me know if you need help with that as it is pretty much the same as in the last few articles where i conditionally call a exechotkey() function

Expand full comment

I managed to make it work thank you ;)

Expand full comment

Dude, I just discovered your blog and it's amazing. It's going to change my trading life.

Can't wait to try these hotkeys on Monday.

Expand full comment

glad that it helps, there are new posibilities already and basically some kind of trading bot is possible now

Expand full comment

Yes definitely. You could even give paid lessons to teach how to use these advanced hotkeys so anyone could create its own bot. There is no documentation on it. I think you are the only one talking about it.

Expand full comment

and many of the features come from my requests as well :)

Expand full comment

This is not working in premarket I assume? Maybe in combination with the new premarket stoporder script?

Expand full comment

Hello peter,

Thank you so much.

Do you know how to replace the stop with a Stop limit? for example for Static risk of $20 with automatic stop loss order attached.

Useful for very volatile times, creating breakout and post-market orders.

Expand full comment

sure I do but I would never do stop on a limit order as it is too dangerous. your order could just be skipped (especially in very volatile times) and you will be left out with no stop. also note that any stop order type would not work in pre/post market so make sure you understand how stop orders work. there will be a partial solution dor post market orders in the next version of DAStrader and I will be covering that in a special post

Expand full comment