Partially exit of position held

Questions about MultiCharts and user contributed studies.
TNPK

Partially exit of position held

Postby TNPK » 21 Jun 2007

I want to partially exit my position with the order name "Trailing Long". However, the order exit all my position. My code is as follows:

if RSI(C,14) crosses over 60 then
Buy ("Go Long") this bar at Close;

if MarketPosition = 1 and RSI(C,14) crosses under 50 then
Sell("Sell Long") next bar at Market;

If currentcontracts>=3 then
Sell ("Trailing Long") 1 contracts next bar at Lowest(Low, 2) Stop;

The attachment is self explained.

By the way, is the no. of contracts under the order name represent the total no. of contracts held or the no. of contracts executed in this order?

Thank you!
Attachments
picture1.png
(83.91 KiB) Downloaded 362 times

User avatar
Kate
Posts: 758
Joined: 08 Dec 2006

Postby Kate » 21 Jun 2007

Please try this code:

if RSI(C,14) crosses over 60 then
Buy ("Go Long") this bar at Close;

if MarketPosition = 1 and RSI(C,14) crosses under 50 then
Sell("Sell Long") next bar at Market;

If currentcontracts>=3 then
Sell ("Trailing Long") from entry ("Go Long") 1 contracts next bar at Lowest(Low, 2) Stop;

As for your question, the number of contracts represents the number of contracts executed in the order.


Return to “MultiCharts”