Portfolio_CurrentEntries

Questions about MultiCharts and user contributed studies.
rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Portfolio_CurrentEntries

Postby rgranero » 24 Feb 2011

Hi, in MC Portfolio Backtester I applied this code to a portfolio of symbol.

I woul have only one symbol in portfolio and then I used the function Portfolio_CurrentEntries.

The problem is when the signal go in position at the same day on different symbol, infact I have all the symbol (of the day when was generated the signal) in portfolio.

I did anything wrong or is a limit of Portfolio_CurrentEntries who haven' t the value on the same bar?

Many thanks
Riccardo

input: BandLen(20);

VALUE1=XAverage(C,BANDLEN);

VALUE2=Portfolio_CurrentEntries;

IF C cross above VALUE1 AND VALUE2<1 THEN
buy ("f") next bar at o;


IF C< VALUE1 THEN begin
sell next bar at o;

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Portfolio_CurrentEntries

Postby Dave Masalov » 17 Mar 2011

Dear Riccardo,

If Portfolio_CurrentEntries = 0 on the current bar, nothing stops MC from generating several signals at open of the next bar on several symbols:

C cross above VALUE1

rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Re: Portfolio_CurrentEntries

Postby rgranero » 17 Mar 2011

Thanks Dave,

MC have in program to modifiy Portfolio_CurrentEntries to work like Portfolio Backtesting

to explain how Portfolio Backtesting work from MC HELP:
Script Calculation and Raw Order Generation

During backtesting, a single bar of each symbol’s data series is evaluated by the strategy’s signal scripts, starting with the first (oldest) bar. The series’ bars are evaluated in the order that the symbols appear in the symbols table of the Portfolio Backtester. Based on evaluation of each series’ bar, a set of one or more orders may be generated by the scripts for each of the symbols. Order sets are generated in the same sequence as the series’ bars are evaluated.

This process is illustrated in the Raw Order Generation section of the diagram: the first bar for symbol 1 is evaluated first, and a set of orders is generated based on that bar. Then the first bar for symbol 2 is evaluated, and a set of orders is generated based on that bar. The process is repeated until the first bar for the last symbol (Symbol N) is evaluated.

The resulting sequence of order sets begins with the order set for the symbol 1, followed by the order set for symbol 2, and ends with the order set for symbol N.
Regards
Riccardo


Return to “MultiCharts”