Jump to content

Recommended Posts

Can someone help me create a script, so I can get in a trade and walk away. So what I use now is a 3 to 1 script. But I have to wait for price to get to SL or 1R before I can walk away. I want to be able to enter my 3to1 and once stock gets to 1R it auto moves to B/E.   Is this possible, a year ago I was told it was not but maybe someone has figured it out.  

  • Like 1

Share this post


Link to post
Share on other sites

Would you post the script you are using for your entry?

I think there might be a way to do this.  It would require you to place (immediately after entry) a one-share (Shares=1) range order at 1R/SL with a remaining position (Shares=POS) range trigger order set for 3R/BE.

Of course you would be throwing away about $2 in fees every trade for the convenience of being able to walk away, and one of your shares would only profit 1R.  Also if the one-share order hit your stop before making it to 1R, there would be some extra slippage while the POS trigger order executed and stopped you out.

 

Russell

Share this post


Link to post
Share on other sites

CXL ALLSYMB;StopPrice=Price;DefShare=BP*0.975;Price=Price-Bid+0.00;SShare=25/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price=Bid-0.1;TIF=DAY+;SELL=Send;DefShare=200;Price=StopPrice-Bid*3;Price=Bid-Price;TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:Price HighPrice:StopPrice ACT:BUY QTY:POS TIF:DAY+

 

thx for trying.

Share this post


Link to post
Share on other sites

the first one is Short.

this one is Buy.

CXL ALLSYMB;StopPrice=Price;DefShare=BP*0.975;Price=Ask-Price+0.00;SShare=25/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price=Ask+0.1;TIF=DAY+;BUY=Send;DefShare=200;Price=Ask-StopPrice*3+Ask;TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:StopPrice HighPrice:Price ACT:SELL QTY:POS TIF:DAY+

Share this post


Link to post
Share on other sites

i'm looking through these hotkeys...

is there a reason you are entering with a LIMIT order?

do you get filled every time?

Are you using Interactive Brokers?

(I think I have some HotKeys for you.  I'm going to test them in SIM tomorrow before I post them)

Edited by RussWilliamL

Share this post


Link to post
Share on other sites

yes, i'm getting filled.  I've been using this script for over a  year.  I don't know much about how to figure the scripts so it's been working and i just kept using.  

Share this post


Link to post
Share on other sites

Okay, I've got some HotKey Scripts for you to TRY OUT IN SIM.  (never test things live)

Each trade has two HotKeys. 

The first one is the entry order where you double-click your Stop-Loss point.  (I basically just removed the TriggerOrder from your HotKey Script and moved it to my Exit Script)

The second one is the exit order which you would place immediately after your entry order is completely filled.  Don't double-click anything between the "fill" and when you activate the Exit HotKey because it gets it's calculations from your Entry HotKey.

Here is what the Exit HotKey does:

1. places a one-share RangeMarket order with a 1R/1R range.

2. Triggers a remaining-shares RangeMarket order with a 3R/BE range.

There is no other way to do what you want (as far as I know) without the tiny one-share order to trigger the Stop-Loss move to B/E.

With these HotKeys, this is what "should" happen (and it worked for me in SIM today).  If your 1R Stop-Loss is hit, the Trigger order exits your WHOLE position "near" your target Stop-Loss.  If the 1R profit point is reached, you will exit one share, then the Trigger order will be sent so that you will either profit 3R or B/E on the remaining position.  (You could change the exit orders to exit more of your position at 1R if you want to use these HotKeys to "partial" at 1R... something like Share=POS*.5 or Share=POS*.33 with your Trigger order remaining Share=POS)

Be aware, the first exit order of one share will cost you about $1 in fees more per trade if you are with IB.  (I mistakenly said $2 earlier)  (Fees are no longer a danger when your orders are more than 200 shares)

Here are the Scripts, you should be able to copy-paste them directly into your HotKeys.

LONG ENTRY

CXL ALLSYMB;
StopPrice=Price;
DefShare=BP*0.975;
Price=Ask-Price+0.00;
SShare=25/Price;
Share=DefShare-SShare;
DefShare=DefShare+SShare;
SShare=Share;
Sshare=DefShare-SShare;
Share=0.5*SShare;
TogSShare;
ROUTE=LIMIT;
Price=Ask+0.1;
TIF=DAY+;
BUY=Send;
DefShare=200;
Price=Ask-StopPrice*3+Ask;

LONG EXIT

CXL ALLSYMB;
Route=STOP;
StopType=RangeMKT;
LowPrice=StopPrice;
HighPrice=AvgCost-StopPrice+AvgCost;
Share=1;
TIF=DAY+;
Sell=Send;
TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:AvgCost HighPrice:Price ACT:SELL QTY:POS TIF:DAY+;

SHORT ENTRY

CXL ALLSYMB;
StopPrice=Price;
DefShare=BP*0.975;
Price=Price-Bid+0.00;
SShare=25/Price;
Share=DefShare-SShare;
DefShare=DefShare+SShare;
SShare=Share;
Sshare=DefShare-SShare;
Share=0.5*SShare;
TogSShare;
ROUTE=LIMIT;
Price=Bid-0.1;
TIF=DAY+;
SELL=Send;
DefShare=200;
Price=StopPrice-Bid*3;
Price=Bid-Price;

SHORT EXIT

CXL ALLSYMB;
Route=STOP;
StopType=RangeMKT;
HighPrice=StopPrice;
LowPrice=AvgCost+AvgCost-StopPrice;
Share=1;
TIF=DAY+;
Buy=Send;
TriggerOrder=RT:STOP StopType:RangeMKT LowPrice:Price HighPrice:AvgCost ACT:BUY QTY:POS TIF:DAY+;

 

 

Hope this helps,

Best,

Russell Landwehr

Edited by RussWilliamL
add semicolon at end of trigger order
  • Like 2

Share this post


Link to post
Share on other sites

i must be doing something wrong.  i'm trying the short script,  so i double click to place stop then click short button, then i need to double click outside of the entry order.  should i see two orders on my Orders tab?

Share this post


Link to post
Share on other sites

OK, it worked.  both orders don't show up and same time, once one hit the other showup.  i understand now. thx.  Can you please give me your Paypal email so i can buy you a coffee or something? 

Share this post


Link to post
Share on other sites

Just to confirm, the proper order is:

1. double click the StopLoss price

2. hit the entry button (order fills)

3. hit the exit button (without clicking on anything)

4. go for a swim in the pool

5. come back later and count your money

 

I'm glad to give back to the community. (and programming hotkeys is fun!)

Good luck!

 

Russell

  • Like 2

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.