Information about Recalculate Command ?

Questions about MultiCharts and user contributed studies.
maison6579
Posts: 3
Joined: 04 Dec 2013

Information about Recalculate Command ?

Postby maison6579 » 28 Apr 2022

I notice the multicharts 14 new features.

one of these is
"
PowerLanguage: Improved the operation of “Recalculate” keyword in Portoflio Trader. “Recalculate” command will recalculate the whole portfolio now. Also, variables of RecalcPersist type are no longer supported in Portfolio Trader.

Is there any more information about recalculate command for portfolio trader?
such as,
how to use recalculate command in PT ?
is it suppored in strategy signal only (left part of PT) or in money management signal only (right part of PT) or both ?

Thanks.

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Information about Recalculate Command ?

Postby Svetlana MultiCharts » 13 Jul 2022

Hi maison6579,

You may want to test this sample script in Portfolio Trader

Code: Select all

Var: ReCalcPersist recalc_once(True); // do not use recalcpersist in portfolio, it only works in charting Var: pf_recalconce(true), gvVal(0), gvErr(0); var: vo10(0); const: portfolioAppType(10); If LastBarOnChart Then Begin Print ("Last bar volume = ", Volume); if (getappinfo(aiapplicationtype) <> portfolioAppType) then begin If recalc_once Then Begin Print ("Recalculate study!"); recalc_once = False ; ReCalculate; End; end else begin pf_recalconce = pmm_get_global_named_num("RecalcOnce") = 0; If pf_recalconce Then Begin Print("Recalculate portfolio strategies!"); pmm_set_global_named_num("RecalcOnce", -1); ReCalculate; End; end; end;
It can be called from any part of PT.

maison6579
Posts: 3
Joined: 04 Dec 2013

Re: Information about Recalculate Command ?

Postby maison6579 » 01 Aug 2022

Thanks Svetlana for this reply.

However, I find a bug about this recalculate feature.

The portfolio trader(PT) recalculate-command works.
However, The right side information of PT , including (position, open P/L, even the Custom Text) could not refresh again after the recalculate is done.
The weird thing is that I add some print code and it still runs silently in the background.
====
the multicharts version: MultiCharts 14.0 Release 4 build 23013
os: win10

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Information about Recalculate Command ?

Postby Svetlana MultiCharts » 03 Aug 2022

We have reproduced the issue: the calculation works, but it is not displayed in the GUI. Sorry for inconvenience. Our engineers will work on improving this behaviour to include the fix in one of the future versions.


Return to “MultiCharts”