Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to create instance: BarsRequiredToTrade cannot be sent from this state

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unable to create instance: BarsRequiredToTrade cannot be sent from this state

    I am running into an issue with a strategy i have develeoped. I used a previously working strategy, and basically only modified the TP and SL methods but i am getting this error now about BarsRequiredToTrade.

    Between the two strategies, I did not make any changes to this area though. Any ideas what would cause this?

    Click image for larger version

Name:	image.png
Views:	57
Size:	12.8 KB
ID:	1306436



    Code:
    ​This is where i have BarsRequiredToTrade
    
    else if (State == State.Configure)
    {
    //AddDataSeries(BarsPeriodType.Tick, 1); // Secondary series with tick bars (or any other desired granularity)
    
    BarsToLoad = BarsBack;
    BarsRequiredToTrade = 1; // Set the desired number of bars required to trade
    /*
    if (NoTradeTimes != "0")
    {
    ParseNoTradeTimes();
    }*/
    // Initialize the EMA indicator

    #2
    Hello sofortune,

    Thank you for your post.

    You should be able to set BarsRequiredToTrade from State.Configure.



    Do you perhaps also have it set from State.SetDefaults? If not, try moving the code to State.SetDefaults and test to see if the error persists.

    I look forward to resolving this issue.

    Comment


      #3
      Thanks i think i addressed the issue, it was something wrong in my code. I think it was not actually related to BarsRequiredToTrade.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X