This block rejects entry orders for new units if the number of current positions in the same direction in closely or loosely correlated markets is greater than or equal to the user set maximum.

 

Unit Limiter Parameters:

Unit Limiter Parameters

Parameter:

Description:

Max Closely Correlated Markets

Integer value that controls the maximum number of closely correlated markets allowed at any time during the test period.

Maximum Loosely Correlated Markets

Integer value that controls the maximum number of loosely correlated markets allowed at any time during the test period.

 

Unit Limiter Control Logic - CAN ADD UNIT SCRIPT:

  '  ==============================================================
  '  Unit Limiter
  '  CAN ADD UNIT SCRIPT - START
  '  ==============================================================
  '  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  '  If this is a proposed new Long unit...
  '  --------------------------------------------------------------
  If order.position = LONG THEN
 
    '  Compute the total correlated units.
     closelyCorrelatedUnits = instrument.currentPositionUnits _
                                + instrument.closelyCorrelatedLongUnits
     looselyCorrelatedUnits = closelyCorrelatedUnits _
                                + instrument.looselyCorrelatedLongUnits
 
    ' If the total correlated units are below their respective limits...
    If   closelyCorrelatedUnits >= maxCloselyCorrelatedMarkets AND
        looselyCorrelatedUnits >= maxLooselyCorrelatedMarkets THEN
        '  Remove Order and Send Rejection Msg to Filter Log
        order.Reject( "Correlated long units greater than maximum" )
    ENDIF
  ELSE ' o.position = LONG
 
  '  --------------------------------------------------------------
  '  If this is a proposed new Short unit...
  '  --------------------------------------------------------------
    '  Compute the total correlated units.
     closelyCorrelatedUnits = instrument.currentPositionUnits _
                                + instrument.closelyCorrelatedShortUnits
     looselyCorrelatedUnits = closelyCorrelatedUnits _
                                + instrument.looselyCorrelatedShortUnits
 
    '  If the total correlated units are below their respective limits...
    If   closelyCorrelatedUnits >= maxCloselyCorrelatedMarkets AND
        looselyCorrelatedUnits >= maxLooselyCorrelatedMarkets THEN
 
        '  Remove Order and Send Rejection Msg to Filter Log
        order.Reject( "Correlated short units greater than maximum" )
    ENDIF
  ENDIF '  ' o.position = LONG
  '  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  '  ==============================================================
  '  CAN ADD UNIT SCRIPT - END
  '  Unit Limiter
  '  ==============================================================

 


Edit Time: 9/12/2020 9:50:00 AM


Topic ID#: 231

 

 

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