How to rank stocks?

Questions about MultiCharts and user contributed studies.
Dan122
Posts: 10
Joined: 10 May 2012
Has thanked: 1 time
Been thanked: 3 times

How to rank stocks?

Postby Dan122 » 01 Jun 2012

I´m a newbee to Easylanguage coming from AB, and I’m not a professional coder. My question is fairly simple.

I have 10 possible entries in one day. I want to rank then by RSI, to use 3 of them. I used PortfolioEntriesPriority=(100-RISI); and it didn’t work.
Is it strings the way to go?
Is there any example of this kind of code?
Thanks
Daniel Carvalho

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: How to rank stocks?

Postby Henry MultiСharts » 01 Jun 2012

I´m a newbee to Easylanguage coming from AB, and I’m not a professional coder. My question is fairly simple.

I have 10 possible entries in one day. I want to rank then by RSI, to use 3 of them. I used PortfolioEntriesPriority=(100-RISI); and it didn’t work.
Is it strings the way to go?
Is there any example of this kind of code?
Thanks
Daniel Carvalho
Hello Daniel,

Are you going to use this study in Portfolio Backtester or MultiCharts?
If it is Portfolio Backtester then do you need to limit each instrument to 3 trades or the entire porfolio of instruments?

Dan122
Posts: 10
Joined: 10 May 2012
Has thanked: 1 time
Been thanked: 3 times

Re: How to rank stocks?

Postby Dan122 » 01 Jun 2012

Henry, I will use it in the portfolio backtester. The portfolio has 40 instruments, from those 10 will show and entry point in a given day. I need to choose 3 stocks (from this poll) based on the smallest RSI.
thanks
Daniel

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: How to rank stocks?

Postby Henry MultiСharts » 06 Jun 2012

Hello Daniel,

You can use PortfolioEntriesPriority to achieve your goal.

Dan122
Posts: 10
Joined: 10 May 2012
Has thanked: 1 time
Been thanked: 3 times

Re: How to rank stocks?

Postby Dan122 » 06 Jun 2012

Henry Thanks for your answer,
If I use close it works perfectly well, but if I use the RSI value it doesn’t.

inputs: Price( Close ), Length( 14 ), OverSold( 20 ) ;
variables: MyRSI( 0 ) ;

MyRSI = RSI( Price, Length ) ;

condition1 = Currentbar > 1 and MyRSI < OverSold ;
if condition1 then
Buy ( " MyRSI " ) This bar on Close;

Sell next bar at open; {just one idea to think about later}

PortfolioEntriesPriority=(100- MyRSI);

I guess MyRSI should be an array so the program “see” the RSI value for the corresponding stock. But I’m thinking as in AB. I extensively googled this question but couldn’t find any simple function to retrieve one stock selected by whatever criteria I want in easylanguage.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: How to rank stocks?

Postby Henry MultiСharts » 14 Jun 2012

Hello Dan122,

We ran some tests in our environment and the code you have provided works ok.
Please have a look at the attached screenshot. Make sure you have Trade size set to "100% of Equity" in the strategy properties.
Attachments
PortfolioPrioity.png
(175.68 KiB) Downloaded 362 times


Return to “MultiCharts”