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.

RussWilliamL

I Flipped the Script on a Dynamic Hotkey to Enter and RangeExit based on Profit instead of Loss

Recommended Posts

RussWilliamL

I flipped the script on some hotkeys PeterB posted in another thread.

PeterB's original Hotkeys were designed so that you could double-click your StopLoss Price.  The Hotkey would calculate the Shares required based on your chosen $Risk, then after entering the position, a TriggerOrder would be sent that would be a Range Exit base on a Risk/Reward ratio of your choosing.  In the Hotkey script, you would need to modify some lines depending on your Risk and your Risk/Reward target ratio.

I found that I was better at predicting where a Price WOULD go (TakeProfitPrice) instead of where it might NOT go (StopLossPrice).  So I modified PeterB's Hotkey script so that instead of double-clicking the StopLoss Price, I double-click my TakeProfit Price.  The Hotkey script then calculates the correct number of shares required to achieve the $Profit, enters the position, calculates the StopLoss based on the Risk to Reward ratio I choose, then places a Range Exit order with my double-clicked TakeProfit Price and the calculated StopLoss Price.

Here are the scripts for DAS Trader Pro with IB.  Even though I've tested these Hotkeys (in SIM), YOU SHOULD TEST THEM IN SIM BEFORE GOING LIVE!  Since the script is flipped, it is easy to end up with a StopLoss that is too tight if you aren't careful.

Here are the 1:3 Risk/Reward scripts:

MARKET LONG RISK $100, double click ProfitTargetPrice, get 1 to 3 RR MARKET Range Exit

CXL ALLSYMB;
StopPrice=Price+0;
DefShare=BP*0.975;
Price=Price-Ask+0.00;
SShare=300/Price;
Share=DefShare-SShare;
DefShare=DefShare+SShare;
SShare=Share;
Sshare=DefShare-SShare;
Share=0.5*SShare;
TogSShare;
ROUTE=SMRTM;
TIF=DAY;
BUY=Send;
DefShare=10;
Price=StopPrice-Bid/3;
Price=Round2;
Price=Ask-Price;
TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:Price HighPrice:StopPrice ACT:SELL QTY:POS TIF:DAY;

 

MARKET SHORT RISK $100, double click ProfitTargetPrice, get 1 to 3 RR MARKET Range Exit

CXL ALLSYMB;
StopPrice=Price-0;
DefShare=BP*0.975;
Price=Bid-Price+0.00;
SShare=300/Price;
Share=DefShare-SShare;
DefShare=DefShare+SShare;
SShare=Share;
Sshare=DefShare-SShare;
Share=0.5*SShare;
TogSShare;
ROUTE=SMRTM;
TIF=DAY;
SELL=Send;
DefShare=10;
Price=Bid-StopPrice/3+Ask;
Price=Round2;
TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:StopPrice HighPrice:Price ACT:BUY QTY:POS TIF:DAY;

 

 

Here are the 1:1 Risk/Reward scripts:

MARKET LONG Risk $100 double click ProfitTargetPrice, get 1 to 1 Risk to Reward MARKET Range Exit

CXL ALLSYMB;
StopPrice=Price+0;
DefShare=BP*0.975;
Price=Price-Ask+0.00;
SShare=100/Price;
Share=DefShare-SShare;
DefShare=DefShare+SShare;
SShare=Share;
Sshare=DefShare-SShare;
Share=0.5*SShare;
TogSShare;
ROUTE=SMRTM;
TIF=DAY;
BUY=Send;
DefShare=10;
Price=StopPrice-Bid/1;
Price=Round2;
Price=Ask-Price;
TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:Price HighPrice:StopPrice ACT:SELL QTY:POS TIF:DAY;

 

MARKET SHORT RISK $100, double click ProfitTargetPrice, get 1 to 1 Risk to Reward MARKET Range Exit

CXL ALLSYMB;
StopPrice=Price-0;
DefShare=BP*0.975;
Price=Bid-Price+0.00;
SShare=100/Price;
Share=DefShare-SShare;
DefShare=DefShare+SShare;
SShare=Share;
Sshare=DefShare-SShare;
Share=0.5*SShare;
TogSShare;
ROUTE=SMRTM;
TIF=DAY;
SELL=Send;
DefShare=10;
Price=Bid-StopPrice/1+Ask;
Price=Round2;
TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:StopPrice HighPrice:Price ACT:BUY QTY:POS TIF:DAY;

 

Here is how you use the scripts:

1. Determine your Risk

2. Determine your Risk/Reward Ratio

3. Change two lines in each Script.  The line that says "SShare=???/Price;" and the line that says "Price=Bid-StopPrice/?+Ask;" (or) "Price=StopPrice-Bid/?;"  ---- the SShare amount will be your $Risk times the Ratio.   For instance, if your Risk is $100 and the Ratio is 1:2, then you would place 200 for the amount.   ---- in the Price portion of the script, you will place the number that corresponds with your desired R/R ratio.  For example: 1 for 1:1, or 2 for 1:2.

4. Double-Click where you want to take profit

5. Activate the Hotkey.

 

I hope some people find this helpful.

 

Best,

Russell Landwehr

 

 

 

 

Edited by RussWilliamL
  • Like 2

Share this post


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

but what happens if your stop is set for a non technical point? 🙂

The stops usually ARE at non-technical points with these hotkeys.

My intent with these is to capture moves to a certain point based on the level 2.  I am "expecting" prices to continue to my TakeProfitPrice with little to no pullback or retrace at the time of my entry.  So my entry is based on momentum and trend, and my TakeProfit exit is based on what I see in the level 2.   I think it's a bit like scalping, except that I don't scale out.  I'm still experimenting with timing and distance so my stops don't end up too close.

Plus before, I was finding my stops being taken out anyway when the big boys would manipulate the prices to search them out at the "technical points" where everyone else's stops were clustered.

 

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.