Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start Behaviour is a pain, why?

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

    Start Behaviour is a pain, why?

    I don't understand why I can't just start a strategy with no prior positions and instead have to wait for it to flatten (or force it to flatten)?

    #2
    Hello Skifree

    You can do that, you would need to program your strategy to enter trades only in realtime. When you apply a strategy will backtest over the historical data before entering into realtime. The default start behavior is to wait for your strategy to finish any positions it entered before starting to work in realtime.

    Comment


      #3
      Does that impact the ability to backtest?

      Comment


        #4
        Hello Skifree,

        Yes, when you backtest a strategy that's the exact same process that happens when you apply a strategy to a chart. It places historical trades during the backtest on the chart or in the strategy analyzer. If you wanted to you could make a user input to toggle historical trading so that you could still backtest it.

        Comment


          #5
          Is there a way to close out all historical positions when you enable realtime? I don't understand why you can't do this without entering a real trade?

          Comment


            #6
            Hello Skifree,

            Your strategies logic would need to do that. Wait until flat is waiting for your strategies exit logic to happen so it becomes flat, that is a virtual trade because its closing a historical position. Real trades would be entered once the strategy actually starts running after the historical position is closed.

            To have it start right away you would either have to not make historical positions or have logic which exits the trade so its flat when it enters realtime.

            Comment


              #7
              Thanks for the help. For others: I use a custom input bool "isBacktest" to allow me more flexibility here. This seems to work so that I can enter flat without losing money going flat.

              Code:
              protected override void OnBarUpdate()
                      {
              
              
              
                           if (isBacktest == false && State == State.Historical)
                           {
                               return;
                           }​

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              602 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              347 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              559 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              558 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X