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:	54
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 NullPointStrategies, Today, 05:17 AM
      0 responses
      50 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X