SetLongRankingValue

Top  Previous  Next

Sets the long 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

 

SetLongRankingValue( rankingValue )

 

Parameters

rankingValue

 

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

 

Example code for the Rank Instruments script:

' Set the long ranking value for this instrument

instrument.SetLongRankingValue( rsi )

 

Example:

 

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

 

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

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

For instrument B you set the long ranking value to 53

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

 

These will be sorted from highest to lowest.

 

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

 

Instrument A will have a long rank of 2.

Instrument B will have a long rank of 1.

Instrument C will have a long rank of 3.