barssinceexit() for multiple contracts scaling out  [SOLVED]

Questions about MultiCharts and user contributed studies.
kernel
Posts: 91
Joined: 19 Feb 2013
Has thanked: 21 times
Been thanked: 4 times

barssinceexit() for multiple contracts scaling out

Postby kernel » 26 Mar 2015

Hi,

If you have 2 contracts and scale them out, is there any function like barssinceexit() that returns the number of bars ago at which the "1st contract" being scaled out?

barssinceexit(1) doesn't work under this circumstance, your position has to be flat first before it may return anything. Thanks.

-K

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1504 times
Contact:

Re: barssinceexit() for multiple contracts scaling out  [SOLVED]

Postby JoshM » 27 Mar 2015

If you have 2 contracts and scale them out, is there any function like barssinceexit() that returns the number of bars ago at which the "1st contract" being scaled out?

barssinceexit(1) doesn't work under this circumstance, your position has to be flat first before it may return anything. Thanks.
PosTradeExitBar returns the bar number of an exit trade. `PosTradeExitBar(1, 0)` for example returns the bar number of the first entry of the previous position.

And `PosTradeExitBar(1, PosTradeCount(1) - 1)` returns the bar number of the last exit from the previous position.


Return to “MultiCharts”