Called once each day after the Compute Instrument Risk script has been called for each instrument. The Compute Risk Adjustment script can be used to calculate portfolio-level adjustments which can be applied on a per-instrument basis in the Adjust Instrument Risk script which follows.

 

The Total Risk Limiter block uses this script to determine the amount that stops need to be moved or positions need to be reduced.

 

VARIABLES: riskPercent TYPE: Percent
 
IF system.tradingEquity > 0 THEN
 
  ' Compute the current risk.
   riskPercent = totalRisk / system.tradingEquity
 
  ' If the risk is above our threshold...
  IF riskPercent > maximumRiskThreshold THEN
       reductionPercent = (riskPercent - maximumRiskThreshold) / riskPercent        
  ELSE
       reductionPercent = 0.0
  ENDIF
ELSE
   reductionPercent = 0.0
ENDIF

 

In this block, the maximumRiskThreshold is a parameter which defines the maximum percentage risk for all open positions.

 

The reductionPercent will be used in the Adjust Instrument Risk script to reduce the position size or move the stops.

 


Edit Time: 5/10/2017 7:52:58 AM


Topic ID#: 216

 

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