Strategy Positions: Backtesting vs. Auto-Trading

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

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:
variables:
stats.LastPositionsAgo(1);

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;
end;
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


Felix

User avatar
Henry MultiСharts
Posts: 9121
Joined: 25 Aug 2011
Has thanked: 1259 times
Been thanked: 2927 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:
https://www.multicharts.com/trading-sof ... to_Trading
https://www.multicharts.com/trading-sof ... _Execution


Return to “MultiCharts”