Strategy Positions: Backtesting vs. Auto-Trading

Questions about MultiCharts and user contributed studies.
User avatar
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 37 times
Been thanked: 73 times

Strategy Positions: Backtesting vs. Auto-Trading

Postby fbertram » 06 Aug 2015

Dear MultiCharts fans,

I am using Portfolio Trader w/ MultiCharts 9.1. I have developed a strategy that uses an "observer signal" to derive some information on the strategy position's trading performance in order to make portfolio decisions. The relevant code looks like this:


while(stats.LastPositionsAgo < MaxPositionsAgo) begin
var: thePos (0); thePos = MaxPositionsAgo - stats.LastPositionsAgo;
var: theEntry (0); theEntry = EntryPrice(thePos);
var: theExit (0); theExit = ExitPrice(thePos);
var: theDirection(0); theDirection = MarketPosition(thePos);

// derive some trading info here

stats.LastPositionsAgo+= 1;

This code works like a charm in backtesting. During auto-trading, I am not seeing MaxPositionsAgo increase while plowing through the historic data and historic positions. This results in the money-management signal not having the information it needs to work properly.

Here are my questions:

* how is MaxPositionsAgo supposed to behave during auto-trading and for historic positions? Should it show historic positions, or only real trades?

* is there any other way I can retrieve historic position information during auto-trading?

* is there any elegant way to save data during backtesting and reload them during auto-trading?

Thanks a lot,
best regards


User avatar
Henry MultiСharts
Posts: 9064
Joined: 25 Aug 2011
Has thanked: 1256 times
Been thanked: 2911 times

Re: Strategy Positions: Backtesting vs. Auto-Trading

Postby Henry MultiСharts » 07 Aug 2015

Hello fbertram,

SA mode recalculates the strategy on start, only actual trades executed at broker are displayed on the chart. All backtesting results are removed from the chart, therefore all order related values are reset in the code.

if you want to preserve the backtesting results/values - you can use AA mode.
For more details please refer to the following pages: ... to_Trading ... _Execution

Return to “MultiCharts”