Script.InstrumentLoop

Similar to Script.Execute, runs a custom script for each enabled instrument in the portfolio. Sets the default instrument object.

Typically used in script with no instrument context, like the Before Trading Day or After Trading Day scripts, to loop over the portfolio instruments.

 

Example code in a custom script called “instrumentloopscript”

PRINT instrument.date, instrument.symbol

 

Example code in the Before Trading Day script:

script.InstrumentLoop( "instrumentloopscript" )

 

Syntax:

script.InstrumentLoop( "instrumentloopscript" )

 

Parameter:

Description:

"CustomScriptName"

Custom script's given name when it was created.

parameterlist

Optional: Parameters values custom script will require to execute correctly.

 

Returns:

Custom scripts can return a value, but it isn't required.  

 

Custom scripts that create a new function for processing information usually will return a Floating number or a string.

 

Example:

'  Custom script adds two numbers together
Print script.Execute( "AddTwoNumbers", 2, 2)

Return:

4

 

Example:

'  Custom script adds two numbers together
value = script.Execute( "AddTwoNumbers", 2, 2)
Print value

Return:

4

 

Links:

Script, Script Functions, Script Properties

See Also:

 


Edit Time: 11/7/2020 3:53:08 PM


Topic ID#: 96

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software