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!
Partially exit of position held [SOLVED]
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.
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.