Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Annoying delay starting bot

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

    Annoying delay starting bot

    I really need my bot to simply activate WHEN I activate it. I do NOT want it thinking it is in the middle of some fictional trade and missing out on real opportunites because on startup it thinks it's already in one.

    My bot does things long term, and if it is waiting until a fictional trade is finished then it may be way too long into the day for it to be of any use!

    How do I get the bot to understand EVERYTHING IS ALREADY FLAT WHEN I TURNED IT ON???

    I appreciate any help, this has been annoying the heck out of me and makes testing take WAY longer than it should, as well!

    #2
    Hello Mistoffelees,

    Thank you for your post.

    To make sure the strategy is flat at the end of processing historical data, you can check the position on the last historical bar and either exit long or exit short.

    Code:
    if (State == State.Historical && CurrentBar == Count - 2)
    {
    if(Position.MarketPosition == MarketPosition.Long)
    //exit short
    else if (Position.MarketPosition == MarketPosition.Short)
    //exit long
    }
    Or if you don't want it to process historically at all, just include this check:

    Code:
    if (State == State.Historical) return;

    Comment


      #3
      I appreciate your help, but how do I do this in the Wizard?

      Also, if I have to unlock it, then where do I put the check: if (State == State.Historical) return; ?

      Comment


        #4
        If this is a Strategy Builder script, you will need to unlock the script and edit it in the Wizard.

        You would put that check at the top of the OnBarUpdate() method.

        Comment


          #5
          I see. Okay, thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          52 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          48 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X