Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Switch to not load indicator

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

    Switch to not load indicator

    I have a strategy that is really slow to optimize, because it calls for a custom indicator.
    Is there a way to have an input variable (bool) to only load the custom indicator in State = State.Realtime and not in backtest?

    Optimization speed is a lot faster when I remove the custom indicator from my strategy script.



    #2
    Hello YakusaTrader,

    Thank you for the post.

    Yes, this should be possible, where do you use the indicator in the script is this from State.DataLoaded or is it being used in your logic in OnBarUpdate? It would really depend on how it's being used and if it can be totally removed during historical bars. If it's only visually being used, you can just surround its code with an if statement checking your inputs value. If it's used in your logic, that may not be able to be removed as that would prevent your logic from working.


    I look forward to being of further assistance.

    Comment


      #3
      Thanks for your help. I use it in (State == State.DataLoaded) but only conditionally:

      else if (State == State.DataLoaded)
      {
      if (BackTest == false)
      {
      MyCustomIdicator = MyCustomIdicator1(MyCustomIdicator);
      AddChartIndicator(MyCustomIdicator);
      }
      }


      I also use it OnBarUpdate, but again conditionally"

      if (BackTest == false)
      {
      if (MyCustomIdicator1 > 0)
      {
      Print(MyValue);
      }
      BackTest is an input variable (bool) that I turn on during optimization, but it's not helping.

      Comment


        #4
        Hello YakusaTrader,

        Can you explain what you mean that it's not helping? Is this not toggling the indicators or what are you seeing happen?

        Have you also tried to navigate away from the current strategy to a different one, then back to this strategy?

        I can see on my end that toggling the indicators like this does work in the analyzer, however in your use case from OnBarUpdate if there is any logic using that indicator that will affect the strategies results.

        I look forward to being of further assistance.

        Comment


          #5
          It's toggling off the indicator, however, optimization speed is slower compared to completely removing the indicator from my script.

          If Backtest == false, then it's really really slow.
          If Backtest == true, then it's slow (it uses lots of memory).
          If the indicator's script is removed from my strategy, then it's fast.

          Let me be clear, the custom indicator I am using is a news release indicator that pulls out Data (news time) from the internet and stores it.
          I only need this indicator to work in real trading and not backtest / historical.

          Comment


            #6
            Hello YakusaTrader,

            Thank you for your reply.

            I couldn't really say what may be happening in that example, it sounds like the indicator is still being called somewhere. If the indicator is being toggled off it should no longer be used. If you have the source code for the indicator, you may try adding in a print to see if the indicator is still being called somewhere from your script.

            Alternatively, you could comment out the indicator to disable it while backtesting if you cannot find a solution using the conditions.

            You could also try making a more simple test with the SampleMACrossover that just toggles the indicator to see if you can replicate the problem. If so, and if the indicator is an open source item you could provide that as a sample of the problem for further review.


            Please let me know if I may be of additional assistance.

            Comment


              #7
              I currently comment out the indicator from my strategy script, but the problem is: I have 2x of the same indicator, one for trading and 1x for backtest, which is not ideal.

              Anyway thanks for your help, I will investigate further and will let you know.

              Comment


                #8
                I am sorry, I meant 2x of the same strategy, not indicator.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                62 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                134 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                75 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                45 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                50 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X