SetShortRankingValue

Top  Previous  Next

Sets the short ranking value. This function is generally used by a Portfolio Manager block as part of the instrument ranking process which is one way to select instruments for trading.

 

Syntax

 

SetShortRankingValue( rankingValue )

 

Parameters

rankingValue

 

the value to be used for ranking this instrument for short trades

 

Example code for the Rank Instruments script:

' Set the short ranking value.

instrument.SetShortRankingValue( rsi )

 

Example:

 

If you have three instruments in your portfolio A, B, and C.

 

In the Rank Instruments script you use the SetShortRankingValue function as follows:

For instrument A you set the short ranking value to 34.

For instrument B you set the short ranking value to 53

For instrument C you set the short ranking value to -12.

 

These will be sorted from highest to lowest.

 

Now in the Filter Portfolio script you can access the shortRank property.

 

Instrument A will have a short rank of 2.

Instrument B will have a short rank of 3.

Instrument C will have a short rank of 1.