Page 1 of 1

Reverse position from a specified entry

Posted: Aug 19 2020
by masber2000
Hello-

Is there a better way to reverse a position from a specific entry than the following?

Code: Select all

if Condition20 then begin buytocover from entry ("Rev-S1") next bar at Market; buy ("XR-L") next bar at Market; end;
I tried using the syntax buy ("XR-L") from entry ("Rev-S1") next bar at market to reverse the position, it gave me the following error code:

syntax error, expecting 'stop', 'limit', 'contracts', or 'shares'. Then, after specifying the number of shares (which I shouldn't have to do), it still gave me an error code.

Thank you in advance for your help.

Re: Reverse position from a specified entry

Posted: Oct 06 2020
by Vlada MultiCharts
Hello masber2000,

It's not possible to reverse a position from entry.
The reason is that there are two pyramiding entries: Entry1 for 5 contracts and Entry2 for 10 contracts long. Summing up, the position is long +15.

It won't be possible to reverse from Entry2 into the short position because reversal means that the whole old position is closed and a reverse position for a specified number of contracts is opened. It's impossible to reverse only a part of the position.

So that's why the term "from entry" can not be used for reversal and as a result, the script does not compile.

Re: Reverse position from a specified entry

Posted: Jan 03 2021
by masber2000
"It won't be possible to reverse from Entry2 into the short position because reversal means that the whole old position is closed and a reverse position for a specified number of contracts is opened."

This is exactly what I'm trying to do! I want to close out all contracts if a specified entry is used. Although there are multiple entry setups, there's only 1 entry active at any point in time. I want to close the specified entry (Rev-S1) and reverse. There would be a contract to close the current position out, and a contract to reverse the just-closed position. Thus there's no part position to close out.