This script has Automatic Instrument Context by default. This means, when this script section executes, it is given direct access to all IPV Properties and Functions.
Called by Trading Blox Builder as the result of a call to the broker statement. This script can be used to determine if the order will be placed or not. The Can Add Unit script can be used to implement risk limits. For example, the Turtle System's Correlation Limiter uses the Can Add Unit script to limit the number of units which can be taken based on market correlation.
The Can Add Unit script is only called for entry orders created by calls to the Broker object in scripting. It is not called for entries due to Actual Broker Positions.
The entire order object is available. It contains information about this potential order to be placed. See the Order object for available properties and functions.
If multiple Can Add scripts are in a system, the order will be rejected if ANY Can Add script rejects the order.
IF instrument.closelyCorrelatedLongUnits >= maxCloselyCorrelatedUnits OR
instrument.looselyCorrelatedLongUnits >= maxLooselyCorrelatedUnits THEN
order.Reject( "Too Many correlated units" )
ENDIF
Edit Time: 9/26/2020 3:15:59 PM |
Topic ID#: 184 |