New functions: Account() and Ret%Chg()

Dear All,

These are now available. Please note that we made some changes to the organization of the reference. Should be intuitive. Let us know if you have any questions.


A new function Ret%Chg is now available under TECHNICAL->PERFORMANCE->Total Return. The function was added to add more flexibility and ease of use. Prebuilt factors were also added for convenience like Ret1W%Chg,Ret3M%Chg, etc.

These function and factors completely replace the now deprecated TotalReturn (12W,26W,etc) factors. If you are using those your systems will still run. You just will no longer find them in the reference.

Account( id or “name”, …)
AccountClose( id or “name”, …)
AccountCloseBar( id or “name”, …)
AccountOpen( id or “name”, …)
AccountOpenBar( id or “name”, …)

These screener function let you screen for stocks transacted in your accounts (paper or linked). They are similar to the Portfolio() functions. They are located under “SCREENER & HOLDINGS”.

For example, to see all the stocks that you own in an account , that you have held over 6 months (125 bars) and are losing 20%; enter these rules:

ShowVar(@bar,AccountOpenBar(“My account”))
@bar>125 and Ret%Chg(@bar) < -20


Marco - I assume that Ret%Chg includes dividends paid?


@Comunity: In what context would you use those functions to improve your systems?

Thank you


Ret%Chg includes dividends. It’s no different than 100* (Close(0)/Close(n) - 1) . Just much easier to write.

Andreas, not sure .They were added for selfish reasons. I wanted these functions bc I manage all my real money accounts (some with IB some with Tradier) from P123 . I buy a lot of biotechs which I find using the screener based on some criteria I developed. I let them sit there for 3-6 months before I re-examine them. I just wanted a quick way to see which ones I held for a while that have lost 50% (normal for biotech)


There are some issues to fix with this new function

  1. the pop-up help terminology is wrong for shorthands → look here
    e.g. It should state Ret6M%Chg, not Ret%Chg6M.

Note that the initial reference page is correct

  1. Create a new ranking. Try to add a node. In the search field, start typing ret% → nothing appears.

Thank you for fixing this



I am trying to use this formula to add up the return for past X number of years but I cannot seem to get it straight.

I think its something like this:
loopsum(“Ret%Chg(251, 251*CTR)”, 1, 0, 1)
which appears to be equal to: Ret1Y%Chg… so far so good

However loopsum(“Ret%Chg(251, 251*CTR)”, 2, 0, 1)
is NOT equal to: Ret2Y%Chg

What am I doing wrong here?

Returns are measured using compound averages. LoopSum just adds without compounding.