Jump to content
Abu Danny

DAS hotkey partial then set targets

Recommended Posts

I am trying to get a hotkey which would sell (lets say a long position) 10 or 25% percent of the open position to lock in some gains but still adjust the Target Range order . 

Here is what i currently do

1) Enter into a trade with say 2R (that is a hotkey). e.g using a $20 risk . 

Quote

StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=20/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price= Ask+0.05;TIF=DAY+;BUY=Send;DefShare=400;Price=Ask-StopPrice*2+Ask;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:StopPrice HighPrice:Price ACT:SELL QTY:Pos TIF:DAY+;

2) I want to lock some gain say 10% so i execute the following (yes i know i am canceling existing Trigger order but i cannot find a way to grab/replace it programmatically inline) 

Quote

CXL ALLSYMB;ROUTE=LIMIT;Share=Pos*.1;Price=Bid-.01;TIF=DAY+;SELL=Send;

 

I want my second hotkey to sell the 10% and re-set my targets based on the new remaining shares. However my problem is that Trigger range order is not executing and i cannot debug it .  It is technically the command from step 2 and the triggerorder with stop just below the avgcost and  X times that risk  ( X here is set to 10). Can be adjusted on the chart later. 

Quote

CXL ALLSYMB;ROUTE=LIMIT;Share=Pos*.1;Price=Bid-.01;TIF=DAY+;SELL=Send;Price=Ask-AvgCost*10+Ask;STOPPRICE=AvgCost;StopPrice=Round2;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:StopPrice HighPrice:Price ACT:SELL QTY:Pos*0.90 TIF:DAY+;

 

Edited by Abu Danny

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.