I have a small question to the code in post #48 from https://www.wealth-lab.com/Discussion/9199, how to add Breakeven correctly? Right now I have this code
CODE:just added as an if else to an existing stop. With the addition of breakeven I will have this as a reference implementation for any strategy.
if (Parameters[2].AsDouble > 0 && LastOpenPosition.MFEPctAsOf(idx) >= Parameters[2].AsDouble) { ClosePosition(LastOpenPosition, OrderType.Stop, orderPrice, "Breakeven"); }
Rename
A follow-up conversation has been extracted from https://www.wealth-lab.com/Discussion/9199 into this new thread for convenience.
Instead of "orderPrice" use LastOpenPosition.EntryPrice
Your Response
Post
Edit Post
Login is required