Portfolio Trader Rank/Priorization

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

Portfolio Trader Rank/Priorization

Postby Jonny473 » 21 Aug 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: 5
Joined: 12 Jun 2023

Re: Portfolio Trader Rank/Priorization

Postby ATCOTrader » 12 Mar 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: 11 Mar 2024

Re: Portfolio Trader Rank/Priorization

Postby Zordan3274 » 11 Apr 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?


Return to “MultiCharts”