I can't adjust the max risk so that it calculates correctly. With a capital of 100k and 0.05% risk stop should be strictly equal to 50, and it does not happen.
I use the following code:
I was able to limit using the "Automatically Issue a Stop Loss order" as in the manual, but I understand this is an emergency exit option, and ideally it should exit without it by using c# submitted stops.
Therefore, my questions are:
Do open positions affect the calculation of max risk?
Why can there be such a discrepancy as in the example above RCL - 37 and PXD - 278?
I use the following code:
CODE:Actual stop on the same algorithm.
public override double GetMaxRiskStopLevel(BarHistory bars, PositionType pt, int idx) { double atr = dayATR[idx] * Parameters[0].AsDouble / 100.0; double stop = (pt == PositionType.Long) ? bars.Close[idx] - atr : bars.Close[idx] + atr; return stop; }
I was able to limit using the "Automatically Issue a Stop Loss order" as in the manual, but I understand this is an emergency exit option, and ideally it should exit without it by using c# submitted stops.
Therefore, my questions are:
Do open positions affect the calculation of max risk?
Why can there be such a discrepancy as in the example above RCL - 37 and PXD - 278?
Rename
If the price gaps at open below the stop order price it will get filled below that price and produce a loss greater than the “max” risk. That’s just the nature of trading stocks.
Your Response
Post
Edit Post
Login is required