Jump to content

We have moved to Discord. Please click here to join us in the Trading Terminal Discord server.



These forums are read-only.

Sayaberdagang

Specific Hotkey Question

Recommended Posts

Sayaberdagang

Hi Guys,

thanks to a lot of ressources here at BBT (thank you, @KyleK29 ) , I finally managed to set up my hotkeys the way I want to - with one specific problem that I can't seem to get solved. 

The problematic hotkey goes long and automatically calculates the share size depending on my stop loss so that I risk 50 Usd per trade. Then, I want it to automatically set the stop and a target (r/r=2) as a range order. If I do it with two seperate hotkeys, I don't have problems, but when I try to do it in one, it doesn't calculate the high price of the range order correctly, it only calculates "3*AvgCost" instead of "3*AvgCost-StopPrice-StopPrice". Here is the script:

StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=50/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price=Ask+0.05;TIF=DAY+;BUY=SEND;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:StopPrice HighPrice:AvgCost*3-StopPrice-StopPrice ACT:SELL QTY:Pos TIF:DAY+;

If I use "=" instead of ":" to calculate HighPrice (like I would with a seperate hotkey), it doesn't work at all. 

I know it is a very specific question, but can anyone help me? 

 

Thanks a lot in advance guys,

 

Philipp

 

Share this post


Link to post
Share on other sites
GreenEyed

Hi!

I think that is because you set HighPrice to be dependant on Average Cost, but Average Cost is not yet defined because the stock is not purchased at that moment and there is no Average Cost. Only when you are in position, then you can use Average Cost. Maybe by using Ask price instead of Average Cost?

 

Anyhow, I am trying to get exactly the same what you are trying to do but it just wont.

 

If you find solution please share.

Share this post


Link to post
Share on other sites
Martin Duffy

I am trying to just set up a hot key that buys shares and sets a stop loss at the same time is this possible in DAS

Share this post


Link to post
Share on other sites
Sayaberdagang
3 hours ago, GreenEyed said:

Hi!

I think that is because you set HighPrice to be dependant on Average Cost, but Average Cost is not yet defined because the stock is not purchased at that moment and there is no Average Cost. Only when you are in position, then you can use Average Cost. Maybe by using Ask price instead of Average Cost?

 

Anyhow, I am trying to get exactly the same what you are trying to do but it just wont.

 

If you find solution please share.

Hi, thanks for your comment. However, AvgCost is already defined because it is a trigger order and is only triggered when the shares are bought. Also, it does calculate 3*AvgCost, it just "forgets" to subtract StopPrice twice.

I'll let you know when I find a solution!

 

Share this post


Link to post
Share on other sites
Sayaberdagang
1 hour ago, Martin Duffy said:

I am trying to just set up a hot key that buys shares and sets a stop loss at the same time is this possible in DAS

Yes, check this out: 

 

Share this post


Link to post
Share on other sites
Martin Duffy

I am so confused I am a newbie..but very good at computers so Its frustrating.
The hot key I am using is a separate one from the buy key. 
I want the hot key to set a stop loss about .20 below my entry price  (for small caps)
The script I am using from Andrew (above) is putting a profit stop above my entry price.

Thx

Share this post


Link to post
Share on other sites

[[Template core/front/global/mobileNavigation is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

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.