NexusFi: Find Your Edge


Home Menu

 





How to gradually close a position?


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one irriss with 8 posts (1 thanks)
    2. looks_two ABCTG with 6 posts (1 thanks)
    3. looks_3 dimitri with 3 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 8,766 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 17 posts
    2. attach_file 0 attachments




 
Search this Thread

How to gradually close a position?

(login for full post details)
  #1 (permalink)
irriss
Singapore
 
Posts: 8 since Dec 2013
Thanks Given: 1
Thanks Received: 1

Hi guys,

After couple years of searching I am completely confused. Does Easy Language allow to close a position gradually?

Let say I sold 15 contracts using the comand

sellshort 15 contracts this bar on close;

Now I want gradually close this position.

Unfortunately, seems that can can partially close position only one time!

After I do

buytocover 3 contracts this bar on close;

and 12 contracts still open, all further buytocover requests are ignored.

There is note regarding this in the documentation:

Exit orders do not pyramid. Once the exit criteria are met and the exit order filled, the order is ignored for that position
until the position is modified (that is, more shares/ contracts are sold or a new short position is established).


But what to do if I dont want to increase the position?

Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Request for MACD with option to use different MAs for fa …
NinjaTrader
ZigZag displaying ticks
Platforms and Indicators
Volume profile TradeStation
EasyLanguage Programming
IQFeed MBO data experience
The Elite Circle
ISO Equity Curve Indicator
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Supertradersams Thread Journal on NQ/MNQ
28 thanks
GFIs1 1 DAX trade per day journal
26 thanks
Diary of a simple price action trader
13 thanks
Tao te Trade: way of the WLD
12 thanks
Deaddogs Stock Trading
12 thanks

(login for full post details)
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,426 since Apr 2013
Thanks Given: 437
Thanks Received: 1,618


What platform are you using? Multicharts, Tradestation or something else?

Regards,
ABCTG

Follow me on Twitter Reply With Quote
(login for full post details)
  #4 (permalink)
irriss
Singapore
 
Posts: 8 since Dec 2013
Thanks Given: 1
Thanks Received: 1

It should not really matter.

I am using OEC

Reply With Quote
(login for full post details)
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,426 since Apr 2013
Thanks Given: 437
Thanks Received: 1,618

There is a difference in the platforms and you can use different code between TS and MC for example. For OEC I don't know, but if you post your code (not only the two lines from the first post) you are using for the exits I can give it a try.

I posted an example here that might help you.
Regards,
ABCTG

Follow me on Twitter Reply With Quote
(login for full post details)
  #6 (permalink)
irriss
Singapore
 
Posts: 8 since Dec 2013
Thanks Given: 1
Thanks Received: 1

Thanks ABCTG,

In your example there are two different closing signals. That's why they work.

This is the surrogate example. Hope the idea is clear. You may need to adjust it or find appropriate instrument. It executes only one exit, instead of three.

 
Code
                            
vars:     i(0), 

        
p(0);

if(
i=0then
begin
    buy 15 contracts this bar on close
;
    
CurrentAsk;
    
i+0.1;
end
else
begin
    
if(CurrentAsk>p-ithen
    begin
        sell 5 contracts total this bar on close
;
        
i+0.1;
    
end;
end 

Reply With Quote
(login for full post details)
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,426 since Apr 2013
Thanks Given: 437
Thanks Received: 1,618

irriss,

I don't think you can avoid using more than one exit in your situation. This would concur with what you posted from the documentation. What is the problem with having several exit orders and making sure they get executed when you want?

Regards,

ABCTG

Follow me on Twitter Reply With Quote
(login for full post details)
  #8 (permalink)
 dimitri 
Athens - Greece
 
Experience: Intermediate
Platform: Metastock
Posts: 76 since Jul 2010
Thanks Given: 202
Thanks Received: 36

Hi, i have seen from a friend of mine this logic ... it is for MT4 ... and it was using a composite logic, with simultaneous moving of Stop Loss levels ... over the partial close ... the site is : Algorithmic Experts | Home
Hope it helps ...
Best Regards - Dimitri

Reply With Quote
(login for full post details)
  #9 (permalink)
irriss
Singapore
 
Posts: 8 since Dec 2013
Thanks Given: 1
Thanks Received: 1

I tried that. The problem that the signal name cannot be dynamic.

I can do like

Sellshort ("sig1") 5 contracts this bar on close
Sellshort ("sig2") 5 contracts this bar on close
Sellshort ("sig3") 5 contracts this bar on close


but I cannot generate signal name from a variable.

In my case it has to be dynamic. I dont know how many exit signal I will need at runtime.

Reply With Quote
(login for full post details)
  #10 (permalink)
irriss
Singapore
 
Posts: 8 since Dec 2013
Thanks Given: 1
Thanks Received: 1



dimitri View Post
Hi, i have seen from a friend of mine this logic ... it is for MT4 ... and it was using a composite logic, with simultaneous moving of Stop Loss levels ... over the partial close ... the site is : link Algorithmic Experts | Home[/url]
Hope it helps ...
Best Regards - Dimitri

Yeah, in MT4 it is possible. You need to play with individual orders and it is very flexible.

Thanks

Reply With Quote
The following user says Thank You to irriss for this post:





Last Updated on December 5, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts