- ago
I am not see trades in my backtest using max risk % sizing. I have overridden GetMaxRiskStopLevel like this:

CODE:
public override double GetMaxRiskStopLevel(BarHistory bars, PositionType pt, int idx)       {          // Compute from the close using side-specific percent          double referencePrice = bars.Close[idx];          double referenceStopPercent = (pt == PositionType.Long) ? mLongStopPercent : mShortStopPercent;          double frac = referenceStopPercent / 100.0; // convert percent → fraction          double offset = referencePrice * frac;          double stop = (pt == PositionType.Long) ? (referencePrice - offset) : (referencePrice + offset);                              return stop;       }


I have printed the stop levels (code not shown) to the debug log, and the levels look reasonable but I get no trades. I know that the strategy generates trades because if I use % of equity all my expected trades show up.
0
115
Solved
1 Replies

Reply

Bookmark

Sort
- ago
#1
I solved my issue. Because the stops were so close, the number of shares being calculated * price/share was greater than the account value so no trades were taken.
0
Best Answer

Reply

Bookmark

Sort