Reverse marketposition

Questions about MultiCharts and user contributed studies.
evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Reverse marketposition

Postby evdl » 05 Mar 2012

Hi,

Is there a way of reversing a marketposition in Easy Language in one order. What I read in the EL guides and use right now is the "buy" and "sell short" reserved words. But this uses two different orders. One to close the position and one to open the new position. I would like to do this in one move. For example: 2000 short, then buy 4000, to get 2000 long. And vice versa.

At the moment the strategy creates a close short order of 2000, and then creates an buy order of 2000 to get the wanted 2000 long. This result in extra transaction costs.

Is it possible to do this in one order in easy language?

Thanks in advance!

Kind regards
Edwin

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Reverse marketposition

Postby Henry MultiСharts » 06 Mar 2012

Hello Edwin,

Sell and BuyToCover generate orders for closing the position.
Buy and SellShort can reverse the position with one order.
Last edited by Henry MultiСharts on 10 Apr 2012, edited 1 time in total.

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Reverse marketposition

Postby evdl » 06 Mar 2012

Hello Henry,

I will give that a try. thank you.

NW27
Posts: 177
Joined: 25 Dec 2010
Has thanked: 40 times
Been thanked: 85 times

Re: Reverse marketposition

Postby NW27 » 06 Apr 2012

Henry,
I was looking to do the same thing but I'm confused. You contradict yourself.
Hello Edwin,

SellShort and BuyToCover generate orders for closing the position.
Buy and Sell can reverse the position with one order.
In http://www.multicharts.com/discussion/v ... rse#p44579 you state the opposite -
"Sellshort" is used to reverse. if you want to close long position, use "sell".
Buy -> Sell
Sellshort -> Buytocover
I always want to be in the maket, so I want to Buy 1 contract and then short 2 (1 closes my long trade and the second enters my short trade direction) the idea being that there is only one order and the possibility of slippage only exists once.
Doing -
- Buy 1 then Sell 1 (Enter Long, Close Long)
- SellShort 1 then Buytocover 1 (Enter Short, Close Short)
Could incur two lots of slippage.

What I would like to do, assuming we enter the market on a Long position -
Buy 1
Sell 2
Buy 2
Sell 2
Buy 2 etc etc
This should give me a single contract in each direction and only 1 lot of slippage per trade.

Could you please provide an example of code on how to do this.

Neil.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Reverse marketposition

Postby janus » 06 Apr 2012

See Henry, even you are confused sometimes. Don't worry even I do sometimes despite the fact I've been using MC for over two years now. The cover orders are:
sell and buytocover

To go net short use sellshort, and to go net long use buy.

These keyword names are so confusing especially for novices. We should be using keywords like:

to go net short: sellshort (no change)
to go net long: buylong (same as buy)
to cover existing shorts: buytocover (no change)
to cover exiting longs: selltocover (same as sell)

It would be really nice to add the two new keywords above so we can re-write our strategies to read more correctly according to standard practices in trading. It would be such a trivial change to PL yet has the powerful benefit of removing any confusion about what the keywords mean. The existing ones remain of course for backward compatibility.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Reverse marketposition

Postby Henry MultiСharts » 10 Apr 2012

Sorry for confusion Nick. Thank you for correction Janus.
Sell and buytocover are exit orders.
Sellshort and buy are entries and reverses.

NW27
Posts: 177
Joined: 25 Dec 2010
Has thanked: 40 times
Been thanked: 85 times

Re: Reverse marketposition

Postby NW27 » 10 Apr 2012

H
Could you please give some example code that shows how we do a reverse order as per my posting.
Idea being do the reversal in a single trade.
Neil

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Reverse marketposition

Postby Henry MultiСharts » 11 Apr 2012

Hello Neil,

Buy and SellShort code words allow reversing the position.
Command opposite to your current position should be used with the target amount of contracts.
Here is an example of script for your pattern:

Code: Select all

if marketposition=0 then buy next bar at market;
if marketposition=1 then SellShort 1 Contract Next Bar at Market;
if marketposition=-1 then buy 1 Contract next bar at market;

NW27
Posts: 177
Joined: 25 Dec 2010
Has thanked: 40 times
Been thanked: 85 times

Re: Reverse marketposition

Postby NW27 » 12 Apr 2012

Hello Neil,

Buy and SellShort code words allow reversing the position.
Command opposite to your current position should be used with the target amount of contracts.
Here is an example of script for your pattern:

Code: Select all

if marketposition=0 then buy next bar at market;
if marketposition=1 then SellShort 1 Contract Next Bar at Market;
if marketposition=-1 then buy 1 Contract next bar at market;
Henry,
So are you saying that if I Buy 1 contract and then do a SellShort 1 contract, the order that is actually placed with the broker is a "Sell 2 Contracts"? 1 Contract closes the trade and the second starts a short position?
The SellShort does both things at once, closes the existing trade and opens a fresh trade in the opposite direction?

I thought this may have been how the "Total" statement was meant to work but it doesn't seem to do anything.
Ie SellShort 2 Contract Total Next Bar at Market;

My tests in either of the above examples tend to indicate that TWO separate orders are sent to the broker thus incurring TWO amounts of slippage when if an order was placed for twice the size, only one lot of slippage would be incurred.


Neil.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Reverse marketposition

Postby Henry MultiСharts » 12 Apr 2012

Henry,
So are you saying that if I Buy 1 contract and then do a SellShort 1 contract, the order that is actually placed with the broker is a "Sell 2 Contracts"? 1 Contract closes the trade and the second starts a short position?
The SellShort does both things at once, closes the existing trade and opens a fresh trade in the opposite direction?
Correct.
I thought this may have been how the "Total" statement was meant to work but it doesn't seem to do anything.
Ie SellShort 2 Contract Total Next Bar at Market;
Total word is allowed only for exits.
My tests in either of the above examples tend to indicate that TWO separate orders are sent to the broker thus incurring TWO amounts of slippage when if an order was placed for twice the size, only one lot of slippage would be incurred.
Neil.
Please let me know who is your broker.

NW27
Posts: 177
Joined: 25 Dec 2010
Has thanked: 40 times
Been thanked: 85 times

Re: Reverse marketposition

Postby NW27 » 12 Apr 2012

Hi Henry,

My broker is IB but that shouldn't make any difference, because the order that MC sends to the broker should be Sell 2 @ Market. This should be independent of broker.

Neil.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Reverse marketposition

Postby Henry MultiСharts » 13 Apr 2012

Hi Henry,
My broker is IB but that shouldn't make any difference, because the order that MC sends to the broker should be Sell 2 @ Market. This should be independent of broker.
Neil.
I have checked this sample script on IB demo and it works properly. Please have a look at the attached screenshot.
If you still have the issue - please come to our live chat Monday-Friday 6:30 am - 4 pm EST to demonstrate this behaviour. We will do our best to help you.
Attachments
Reverse.png
(15.83 KiB) Downloaded 1363 times


Return to “MultiCharts”