Could you please let me know how to intercept the change positions for a strategy?
Using Position [1]. ClosedTrades I can access previous positions, it works when I close a position, but this is not enough when there is a change in the number of contracts.
Using Currentposition.ClosedTrades know how many trades are open but I can not determine the time at which this change occurs.
I need a kind of OnPositionChanged ().....
Many Thanks for attention and regards.
Sabino.
p.s:
how intercept position value change? ... OnPositionChanged()
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: how intercept position value change? ... OnPositionChang
Hello Sabino,
We don't have this exact event, but the same functionality can be accessed using TradeManager events. Please refer to the following sample code.
We don't have this exact event, but the same functionality can be accessed using TradeManager events. Please refer to the following sample code.
Re: how intercept position value change? ... OnPositionChang
Thanks for fast response.
I know that the OnPositionChanged() event does not exist, but due to its great utility I needs to rebuild it ...
however... If I'm not mistaken I can not use TradeManager in backtest mode, correct?
Regards, Sabino
I know that the OnPositionChanged() event does not exist, but due to its great utility I needs to rebuild it ...
however... If I'm not mistaken I can not use TradeManager in backtest mode, correct?
Regards, Sabino
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: how intercept position value change? ... OnPositionChang
In backtesting you can keep the OpenLots value in a variable, when variable value changes you can get the closing time of the previous bar to get the time when the position value has changed.