Trading Articles
Article Categories
Article Tools
How to gradually close a position?
Updated December 5, 2013
Top Posters
looks_one
irriss
with 8 posts (1 thanks)
looks_two
ABCTG
with 6 posts (1 thanks)
looks_3
dimitri
with 3 posts (0 thanks)
looks_4
Quick Summary
with 1 posts (0 thanks)
trending_up
6,394 views
thumb_up
2 thanks given
group
3 followers
forum
17 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
How to gradually close a position?
(login for full post details)
#1 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
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
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,470
received
What platform are you using? Multicharts , Tradestation or something else?
Regards,
ABCTG
(login for full post details)
#4 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
It should not really matter.
I am using OEC
(login for full post details)
#5 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,470
received
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
(login for full post details)
#6 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
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 = 0 ) then
begin
buy 15 contracts this bar on close ;
p = CurrentAsk ;
i = i + 0.1 ;
end
else
begin
if( CurrentAsk > p - i ) then
begin
sell 5 contracts total this bar on close ;
i = i + 0.1 ;
end ;
end
(login for full post details)
#7 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,470
received
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
(login for full post details)
#8 (permalink )
Athens - Greece
Experience: Intermediate
Platform: Metastock
Posts: 76 since Jul 2010
Thanks: 202 given,
36
received
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
(login for full post details)
#9 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
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.
(login for full post details)
#10 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
dimitri
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
The following user says Thank You to irriss for this post:
(login for full post details)
#11 (permalink )
Athens - Greece
Experience: Intermediate
Platform: Metastock
Posts: 76 since Jul 2010
Thanks: 202 given,
36
received
Hi, again ... what i have seen working has 4 levels of partial position close .... and possibility to move for each level ... the stop loss ...
Thanks
Dimitri
(login for full post details)
#12 (permalink )
Athens - Greece
Experience: Intermediate
Platform: Metastock
Posts: 76 since Jul 2010
Thanks: 202 given,
36
received
irriss
Yeah, in MT4 it is possible. You need to play with individual orders and it is very flexible.
Thanks
You can try with them if they can do it for you ... according your specifications ...
just a thinking -- Thanks
Dimitri
(login for full post details)
#13 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,470
received
I am afraid but that won't work with Easylanguage .
irriss
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.
(login for full post details)
#14 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
Actually I found very strange thing.
If you execute my example.
Code
vars : i ( 0 ),
p ( 0 );
if( i = 0 ) then
begin
buy 15 contracts this bar on close ;
p = CurrentAsk ;
i = i + 0.1 ;
end
else
begin
if( CurrentAsk > p - i ) then
begin
sell 5 contracts this bar on close ;
i = i + 0.1 ;
end ;
end
It will close the position partially and some part of the position remains open. (this is correct)
However, if you add keyword total it will do exactly as I want - perform multiple exit.
sell 5 contracts total this bar on close;
But, at the end there is an open position! Could you run it on your platform and confirm whether it is bug in OEC or unclear logic of EL?
(login for full post details)
#15 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,470
received
In Multicharts your code with total added to the exit only exits 5 contracts once.
Regards,
ABCTG
(login for full post details)
#16 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
Thanks, ABCTG!
So there is no difference with or without total keyword?
(login for full post details)
#17 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,470
received
Yes, at least in MC there is none.
irriss
Thanks, ABCTG!
So there is no difference with or without total keyword?
The following user says Thank You to ABCTG for this post:
(login for full post details)
#18 (permalink )
Singapore
Posts: 8 since Dec 2013
Thanks: 1 given,
1
received
Yes, I checked myself also in MC.
It is a bug (or unexpected behavior) in OEC.
Thanks for your great help, ABCTG!
Last Updated on December 5, 2013
Right now
Ongoing
Right now
February
Register to Attend
Feb 25
Coming soon
March