Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stragety WILL NOT enter when I click activate...

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

    Stragety WILL NOT enter when I click activate...

    When I go to activate a strategy it says it is already in one, how do I get the strategy to just look at what is coming in at that moment instead of history? Is there a work around for this Highly Annoying feature?

    #2
    Hello tanju23,

    You can include the following statement in your code to avoid the strategy to be calculated on historical data.

    // Only run on real-time data
    if (Historical)
    return;

    Add the statement to the top of OnBarUpdate()

    Comment


      #3
      I'm using the wizard to start with...is this a problem? When i unlock code I see this

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()

      What would it look like with what you are saying to do?

      Comment


        #4
        What do you mean by "on top"?

        Comment


          #5
          You will need to unlock the code in order to insert the statement. Please see the attached screenshot for an example.

          I included the statement in the SampleMACrossOver strategy. It is the first statement below OnBarpdate() (to the top).
          Attached Files

          Comment


            #6
            Ahhhh...thank you very much!!!!

            Comment


              #7
              When i try to do this i get errors. Any suggestions?
              Attached Files

              Comment


                #8
                Can you please hit F5 or right click in the code window and select 'Compile'.

                Let me know if the errors remain.

                Comment


                  #9
                  Still Havings Problems

                  I know its been awhile since i last posted...but i never did get to work. When i hit F5 or right click and compile, a window pops up and says error generating strategy. Is this because I'm the strategy wizard to start off with?

                  Comment


                    #10
                    ???

                    I also just tried to duplicate the example from the sample ma cross that was posted below and it still says programming errors.

                    Comment


                      #11
                      Please debug the code to solve the compiling errors. You can find general debug information at the link below.


                      If the issue remains, please post a new screenshot of the compiling error.

                      Comment

                      Latest Posts

                      Collapse

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