Setting a fixed initial stop
Author: tassod
Creation Date: 5/9/2010 11:22 PM
profile picture

tassod

#1
Where in this code can I implement an initial fixed stop loss of $1500 once a position is entered? This is for Futures. I am also using the Percent Volitily PosSizer.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
If you're using the % Volatility PosSizer, it won't work together with a fixed dollar stop set in code.

As an alternative, add a percentage- or volatility-based stop using RiskStopLevel. The QuickRef example will show you how to implement it.
profile picture

tassod

#3
Can it be done without using RiskStopLevel? for example:
CODE:
Please log in to see this code.
profile picture

Eugene

#4
What you're trying to do is expressed like the following:
CODE:
Please log in to see this code.

However as I said it won't work because there's no direct access to portfolio equity (and you're working in portfolio simulation mode when using a PosSizer i.e. % Volatility). Check one of the remarks in the QuickRef for MFEAsOfBar where it says:
QUOTE:
In portfolio simulation mode, all trades are pre-executed using 1 share per Position, and then position sizing is applied after the fact. So the MFEAsOfBar property will always be based on 1 share while the Strategy is executing.
profile picture

tassod

#5
Ok so basically you are saying this can't be done in Portfolio simulation mode, but I should switch to Raw Profit mode and use the RiskStopLevel in my code to set an initial stop.
profile picture

Eugene

#6
It can be done in Portfolio simulation mode by using RiskStopLevel.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).