Increases or decreases an existing position by the specified factor, if the market hits the stop price. See: AdjustPositionOnOpen for a more complete description of the adjustment factor.
Increasing a position size will result in adding units since the contract/share additions will have a different entry date than any of the existing units. Decreasing a position size will remove contracts/shares starting with the last unit on, and working back to the first if necessary.
This function is generally used by a Risk Manager Block to lighten a position to meet certain risk restrictions.
Syntax: |
---|
broker.AdjustPositionOnStop( [symbol], adjustmentPercent, stopPrice ) |
Parameter: |
Description: |
---|---|
[symbol] |
Symbol is optional when intended broker order is for the instrument naturally in context. |
adjustmentPercent |
The factor by which will be multiplied by the existing position quantities to arrive at the new unit sizes. |
stopPrice |
The price which the market must hit to trigger an adjustment. |
Returns: |
---|
Example: |
---|
' Adjust the position size by our computed adjustment when Stop price is penetrated. broker.AdjustPositionOnStop( 0.75, stopPrice ) |
Links: |
---|
See Also: |
Edit Time: 9/7/2020 2:30:08 PM |
Topic ID#: 134 |