Jump to content
Robert H

Hotkeys for Flipping Position

Recommended Posts

EDIT 16-APR-2018: With the help of Raymond W, we've been able to define a single hotkey for flipping an open position:

Simulator: ROUTE=MARKET;Share=Pos*2;TIF=DAY+;SEND=REVERSE

Interactive Brokers: ROUTE=SMRTM;Share=Pos*2;TIF=DAY+;SEND=REVERSE

 

Note that this hotkey will send a market order.

 

=====

 

I'm trying to define a single hotkey to switch an open position. For now, I was able to create two separate hotkeys for switching a long-to-short, and a short-to-long.

 

Flip Long to Short

ROUTE=SMRTL;Share=Pos*2;Price=Bid-.05;TIF=DAY+;SELL=Send

 

Flip Short to Long

ROUTE=SMRTL;Share=Pos*2;Price=Ask+.05;TIF=DAY+;BUY=Send

Share this post


Link to post
Share on other sites

Very cool Robert! I could have used this today in trading BABA. Sorry I don't know the answer to your question.

 

Share this post


Link to post
Share on other sites

Hi Robert, I used the hotkey today to flip a position from short to long, but i did not work out well.

i was short MU with 183 Shares and after flipping it to long i was in possession of 2 Shares :) Long to short works fine.

i think its because of the -2 in the script.

 

instead of

 

ROUTE=SMRTL;Share=Pos*-2;Price=Ask+.05;TIF=DAY+;BUY=Send

 

i was trying

 

ROUTE=SMRTL;Share=Pos*(-2);Price=Ask+.05;TIF=DAY+;BUY=Send

 

but that does not work either. I was playing around but i couldnt figure it out. Any suggestions?

 

 

 

 

Share this post


Link to post
Share on other sites

Great catch, Martin! I updated the original post with the corrected script:

 

ROUTE=SMRTL;Share=Pos*2;Price=Ask+.05;TIF=DAY+;BUY=Send

  • Like 1

Share this post


Link to post
Share on other sites

With the help of Raymond W, we’ve been able to define a single hotkey for flipping an open position:

Simulator: ROUTE=MARKET;Share=Pos*2;TIF=DAY+;SEND=REVERSE

Interactive Brokers: ROUTE=SMRTM;Share=Pos*2;TIF=DAY+;SEND=REVERSE

 

Note that this hotkey will send a market order.

  • Like 2
  • Thanks 1

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.