How to know, that test position was changed.

Questions about MultiCharts .NET and user contributed studies.
zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

How to know, that test position was changed.

Postby zysmn » 26 May 2014

Hello everybody.

How during backtesting I can discover that the test position for strategy on the chart has changed? For instance, in real time trading come OnBrokerPositionChange() event. Is there some similar event for backtesting positions? Or how I can to know, that test order was executed?

Thanks.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: How to know, that test position was changed.

Postby JoshM » 26 May 2014

During a position change in backtesting, `StrategyInfo.MarketPosition` and/or `CurrentPosition.OpenLots` will change.

If you store the value of these in variables, and compare the current value with the variables on each calculation, you can see whether or not these have changed.

Alternatively, I think this also can be done with `Positions[x]`.

zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

Re: How to know, that test position was changed.

Postby zysmn » 27 May 2014

If you store the value of these in variables, and compare the current value with the variables on each calculation, you can see whether or not these have changed.

Alternatively, I think this also can be done with `Positions[x]`.
I already using similar method, but I thought exist standard event or decision.


Return to “MultiCharts .NET”