ww58
- ago
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:
CODE:
      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;       }
Actual stop on the same algorithm.

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?
0
222
Solved
1 Replies

Reply

Bookmark

Sort
Glitch8
 ( 9.28% )
- ago
#1
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.
0
Best Answer

Reply

Bookmark

Sort