MicroTrendsLtd / NinjaTrader8

NinjaTrader8 Components Strategies and Trading tools
MIT License
72 stars 17 forks source link

Wrong order size for stoploss/profittarget in replay mode #42

Closed Sidlercom closed 3 years ago

Sidlercom commented 3 years ago

in replay/playback mode, stoploss and profittarget are not calculated correctly, and are usually not the same size as the entry order size. In live sim mode everything seems to be correct

MicroTrendsTom commented 3 years ago

The samples are provided only to show how to code with the engine. In the samples the position is hard coded to 4 and the exits are hard coded to 4 in the basic samples

I can't see why replay mode would change any of that - as it is hard coded - unless If there were anomalies under fast play back the samples do not attempt to navigate or fix that.

Trade/Testing Modes

  1. Under demo/live/sim use a self correcting cycle of the trade engine if anomalies occur.
  2. Backtest and replay share the same code cycles and do not fix anomalies - in backtest there should be none

Soak/Unit Testing Focused on realtime trading. For replay there was a simple test to see it worked in replay only same for backtest. So maybe you uncovered fast market anomalies which the system does not attempt to fix in replay or something else quirky

Diagnosis - steps to replicate.

  1. Instrument Dataseries, days back/date range, playback speed
  2. which strategy and its settings in play,
  3. Any Screenshots, Logs, trace etc
Sidlercom commented 3 years ago

I hope this helps

NinjaScript Ausgabe 27.01.2021 13_28.txt

Screenshot_4

Screenshot_1

admintiger commented 3 years ago

@MicroTrendsTom I can confirm that the wrong order sizes for stop-loss & profit-targets are submitted exactly as reported by @Sidlercom. It is not a fast market anomaly. It happens exactly the same regardless of market price rate-of-change or market replay speed. Even though those order sizes do seem to be hard-coded to 4 contracts, orders totaling 8 contracts each are submitted.

MicroTrendsTom commented 3 years ago

@MicroTrendsTom I can confirm that the wrong order sizes for stop-loss & profit-targets are submitted exactly as reported by @Sidlercom. It is not a fast market anomaly. It happens exactly the same regardless of market price rate-of-change or market replay speed. Even though those order sizes do seem to be hard-coded to 4 contracts, orders totaling 8 contracts each are submitted.

ok ty will have to investigate this and resolve. I am due to wheel back to this in fact to use it for a Backtester/Strategy NT8 version of AFT http://www.algofuturestrader.com so i will definitely test and fix as soon as i can get on to that task list.

What Instrument. time series were you using? Any particular settings/time series etc

admintiger commented 3 years ago

ES 03-21 8-Renko initially. However, the same thing happens with any instrument, bar-type or time series. It will be easy to reproduce the problem.

MicroTrendsTom commented 3 years ago

image removed a double call to place stoploss by means of workflow change