I am not see trades in my backtest using max risk % sizing. I have overridden GetMaxRiskStopLevel like this:
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.
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.
Rename
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.
Your Response
Post
Edit Post
Login is required