Portfolio Trader Rank/Priorization

Questions about MultiCharts and user contributed studies.
Jonny473
Posts: 68
Joined: Apr 04 2016
Has thanked: 5 times
Been thanked: 1 time

Aug 21 2021

https://drive.google.com/file/d/1dUGV-f ... sp=sharing

Lets say I have number of X instruments in my Portfolio Trader Strategy.
I have one strategy applied. This strategy contains, besides calculations only based on the instrument itself, also a rank/ PortfolioEntriesPriority function.
What do I want to do here: I want the strategy to rank instruments based on an indicator (like relative Strength, RSI, etc.) and only want to continue with the best X% ones.
I tried different approaches but not working so far.
https://www.multicharts.com/trading-sof ... esPriority
This example is given: The higher price, the higher the priority. Ok, but how to continue here and how to implement into a strategy. See below that this is not working correctly.
PortfolioEntriesPriority = (-Close);

Approach 1:

Code: Select all

variables: MyR( 0 ) ; MyR = ((Close of Data1 / Close[100] of Data1) - (Close of Data2 / Close[100] of Data2) / (Close of Data2 / Close[100] of Data2)); PortfolioEntriesPriority= MyR; Buy ("MyR") next bar open; setexitonclose;
Here is a rank strategy officially mentioned here:
https://www.multicharts.com/trading-sof ... y_Examples

Code: Select all

Vars= BarNo2(0),MyIndicator(0),R(0); BarNo2= BarNumber of data2; If BarNo2>BarNo2[1] then Begin R = (C of data2 - C[1] of data2) / C[1] of data2; MyIndicator= (R - AvgReturn ) / Sdev end; {Retrieve MyIndicator Rank. Rank is from 1 to 500 since our universe is 500 Stocks} If Rank<=10 then Buy 200 contracts next bar at O; {Go Long the best 10 stocks} Else If Rank>=490 then SellShort 200 contracts next bar at O; {Go Short the worse 10 stocks}
Dont know how to interpret this example? It has a lot of bugs in it:
Rank function normally needs 4 parameters, here none are mentioned.

Here is the official rank strategy:

Code: Select all

inputs: Basedondata(1), TraceOutput(false); var:BarN(0),R(0); // *** restrictions once if barstatus(BasedOnData) < 0 then raiseruntimeerror("Portfolio Rank Signal Base needs datastream " + numtostr(BasedOnData, 0)); once if 1 <> getappinfo(aiisportfoliomode) then raiseruntimeerror("Portfolio Rank Signal Base can be applied for MCPortfolio application only."); // **************** value1=RelStaerke_0_100(Close,200); BarN = BarNumber; if BarN > BarN[1] then begin R = value1; pmm_set_my_named_num("value1", R); end; begin var: MoneyCostForInvestPerCtrct(0), potential_entry_price(close); MoneyCostForInvestPerCtrct = pmms_calc_money_cost_for_entry_per_cntrct(potential_entry_price, Portfolio_GetMarginPerContract) + pmms_calc_money_cost_for_entry_per_cntrct(potential_entry_price, Portfolio_GetMaxPotentialLossPerContract); if 0 > MoneyCostForInvestPerCtrct then raiseruntimeerror( text("Error! Price = ", potential_entry_price:0:6, "PMargin = ", Portfolio_GetMarginPerContract, "PMaxPLoss = ", Portfolio_GetMarginPerContract) ); // MoneyCostForInvestPerCtrct in currency of the symbol. Convert it to portfolio currency ... pmm_set_my_named_num("MoneyCostForInvestPerCtrct", pmms_to_portfolio_currency(MoneyCostForInvestPerCtrct)); end; buy 1 share next bar open; if barssinceentry>100 then sell all shares this bar close;


At the same time I am applying the Portfolio_Rank_MM_Signal as MM Signal here.


This does also not work.
What am I doing wrong? Can you please support here by sending me an example code. I should not be the first person asking this question and I saw couple of people raising this question in the forum. Unfortunately there was no clear example given, at least none worked for me.

„I have one strategy applied. This strategy contains, besides calculations only based on the instrument itself, also a rank/ PortfolioEntriesPriority function.
What do I want to do here: I want the strategy to rank instruments based on an indicator (like relative Strength, RSI, etc.) and only want to continue with the best X% ones.“

ATCOTrader
Posts: 7
Joined: Jun 12 2023
Has thanked: 1 time

Mar 12 2024

Hi,

Have you found a solution to this? I have the same problem and have been trying to figure it out for some time now but nothing is working...

Regards

Zordan3274
Posts: 2
Joined: Mar 11 2024

Apr 11 2024

Agree, all the examples provided below don't work. None of the below suggested rotation/ ranking code works,

https://www.multicharts.com/trading-sof ... amples.pdf
https://www.multicharts.com/trading-sof ... k_Strategy

Has anyone managed to find a working ranking code based on a defined indicator. eg ROC or RSI?

ATCOTrader
Posts: 7
Joined: Jun 12 2023
Has thanked: 1 time

Jun 13 2024

Sorry to hear that, it would be very useful if it worked!

tc12345
Posts: 15
Joined: Nov 01 2010
Has thanked: 1 time
Been thanked: 1 time

Jun 21 2024

Multicharts is this working?

User avatar
Polly MultiCharts
Posts: 264
Joined: Jul 20 2022
Has thanked: 1 time
Been thanked: 67 times

Jun 26 2024

Dear Users,

These pre-built signals are working on our end.
Please apply a specific pair of strategies to the portfolio in the Signals and Portfolio MoneyManagement Signal sections

Let’s take the Portfolio Rank signal as an example.
  • Portfolio Rank Signal Base should be used in the signals section on the Portfolio tree on the left.
  • Portfolio Rank MM Signal should be applied to the Money Management signal section.
Then please add the number of instruments specified in the inputs to the signal:

Code: Select all

BuyBestN(5), SellWorseN(5),
We have checked this setup on our end and it works.

Let’s take another example:
  • Portfolio_SpreadTradingSystem.Master
  • Portfolio_SpreadTradingSystem.Slave
You need to arrange the symbol in a cross order: you need to have identical list of symbols in the first and the second data series column but you need to have it crossed like
1 2
2 1
You can also refer to this forum thread for additional info.

If you have some specific issues with the strategies, please forward your requests to our support email for detailed investigation.