I have following error during Playback/Replay which throws few Alert messages and strategy disabled after that. For sure I do not run into issue of NON-unique IDs (you can see in code).
I tried to prepare/isolate as much as I could to help you to reproduce the issue on your side:
Here is what I'm attaching:
1) log file
2) strategy code(which has minimum code to reproduce the issue)
3) screen with settings of strategy
4) replay file (since blog has limits to extension/sizes/number of uploads, don't know how to upload 37 MB) (\db\replay\CL 03-19\20190213.nrd)
I uploaded it to filebin: https://filebin.net/szwvb2n29ra7jz4i
5) screen settings of replay controller
Please let me know if anything else I can provide to help you to reproduce this?
using System.Collections.Generic;
namespace NinjaTrader.NinjaScript.Strategies
{
public class PL1ForNTForumStrategy : Strategy
{
private Dictionary<int, string> longTradesDict;
private Dictionary<int, string> shortTradesDict;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "PL1ForNTForumStrategy";
Calculate = Calculate.OnEachTick;
}
else if (State == State.Configure)
{
SetStopLoss(CalculationMode.Ticks, 10);
SetProfitTarget(CalculationMode.Ticks, 10);
longTradesDict = new Dictionary<int, string>
{
{ 1776, "LONG_BID_5355_2BDZdAn+UkOj3Cm6/YhEIA" },
{ 2252, "LONG_BID_5332_lQPS6wRoAUuQrkP8QPG3dg" },
};
shortTradesDict = new Dictionary<int, string>
{
{ 2270, "SHORT_ASK_5350_Q1ykteoKSEy43CLnYjvLyw" },
{ 2277, "SHORT_ASK_5360_LOW5K7DwGE6636G6O/UjyQ" },
{ 2278, "SHORT_ASK_5362_24OJhmysJkiFaICg6sv72Q" },
{ 2312, "SHORT_ASK_5385_oOE3vr4zVUmHDMMXc8Iw2A" },
{ 2313, "SHORT_ASK_5390_r86tcxxAi0qSx7pjhKpzig" },
{ 2316, "SHORT_ASK_5400_z1fv93n/s0KgRVEUYMyYLg" },
};
}
}
protected override void OnBarUpdate()
{
if (longTradesDict.ContainsKey(CurrentBar))
EnterLong(longTradesDict[CurrentBar]);
else if (shortTradesDict.ContainsKey(CurrentBar))
EnterShort(shortTradesDict[CurrentBar]);
}
}
}
Comment