Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automated trading - strategy activated shows a highlight color of yellow

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

    Automated trading - strategy activated shows a highlight color of yellow

    After using the strategy wizard and checking it with the strategy analyzer to see all is okay, I activate it for live trading, but it shows a highlight color of yellow instead of green. Can't figure out why and it does not execute when I know the parameters are reached. How to find out the issue?

    #2
    Hello CactusMo,

    Thank you for writing in and thank you for your patience. A yellow highlighted "Strategy" cell indicates the strategy is waiting until it reaches a flat position before fully starting.

    Please see the video below on the different sync options available.
    https://www.youtube.com/watch?v=US9c...A140D7&index=7

    Please let us know if you have any further questions.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Automated trading - strategy activated shows a highlight color of yellow

      Thanks MichaelM,

      My positions are flat. I made a few variations of the same strategy and only one of them for some reason will not show green when activated. I will rewrite this particular strategy and call it a different name to see if it just the system that is messing up.

      Comment


        #4
        Change default number of contracts

        Of my automated strategies that are working, the default number of contracts to trade upon strategy execution is 1 contract. How to set number of contracts to 5? I am trading the E-mini ES futures contract.

        Comment


          #5
          Hello CactusMo,

          Please add the following code to the top of your OnBarUpdate() method:
          Code:
          if(Historical)
          {
              return;
          }
          and let me know if the issue persists. This code forces your strategy to be flat before real-time bars occur.

          To set the DefaultQuantity via code you would use the following:
          Code:
          protected override void Initialize() 
          { 
              //...
              DefaultQuantity = 5;
              //...
          }
          Our help guide covers this here: http://ninjatrader.com/support/helpG...ltquantity.htm

          Thank you in advance.
          Michael M.NinjaTrader Quality Assurance

          Comment


            #6
            Okay, I understand the problem. Should I execute my strategy now, and as a result of it's calculation it would have executed a position sometime in the not too distant past, it will consider itself not flat and therefore currently in a position. How to make it start fresh from the point of when I actually execute the strategy? Seems pretty stupid for it to think I had executed the strategy and therefore a trade at a time in the past when the strategy was not actually executed live.

            Comment


              #7
              I truly appreciate your efforts Michael M. However, I use the Ninja Wizard to create my strategies. Please pardon my ignorance. I would struggle to know where to place the code you sent regarding the change of number of contracts for a default of 1 to 5.

              Comment


                #8
                Hello CactusMo,

                There are two ways you can prevent the behavior you are describing when you are using the strategy wizard with your strategy.

                The first way:
                -Navigate to Tools -> Options -> Strategies tab -> NinjaScript tab -> Select "Immediately submit live working historical orders"
                -Then in the properties of the strategy itself, set "Sync account position" to false.

                If you need those options set to other values, you can do this the second way instead:
                -Import the attached indicator called "HistoricalData" and add a condition to each of your entries that says "if(HistoricalData()[0] != HistoricalBar)" where HistoricalBar is a User Defined Input set to 1.

                Here are all the steps:
                1. File -> Utilities -> Import NinjaScript -> HistoricalDataIndicator.zip
                2. Tools -> Edit NinjaScript... -> [your strategy]
                3. Next -> Next -> create "HistoricalBar" as an "int" with a Default and Min of 1.
                4a. Next -> For each "Set" (Set 1, Set 2, etc) that you enter/exit a position, you need to "Add" an additional condition
                4b. In the Condition Builder on the left side (the popup you get when you press "Add"), expand the indicators dropdown and select HistoricalData
                4c. Set the operator to "!=" in the middle.
                4d. Expand the User defined inputs on the right side and select "HistoricalBar" -> Press OK

                Unfortunately there is no way without unlocking your code (and not being able to use the strategy wizard to edit it anymore) to modify the default DefaultQuantity variable. When using a strategy created with the strategy wizard, the only way to do this is to set the DefaultQuantity value to 5 manually in the strategy properties window before running it.
                I have included a picture of where these properties are for your convenience.

                Please let me know if you have any further questions.
                Attached Files
                Michael M.NinjaTrader Quality Assurance

                Comment


                  #9
                  Thanks Michael M. It works perfectly. I can now execute my strategy without it turning yellow even if the parameters would have had it executed within the past few hours. I used your 2nd option to incorporate historical data within my strategy wizard. I now change the default of 1 contract to 5 by setting "Default quantity" each time I initiate my strategy.

                  Comment


                    #10
                    Hello CactusMo,

                    Thank you for the update. I am glad I could be of assistance and that everything is working for you.

                    Please have a great rest of your day!
                    Michael M.NinjaTrader Quality Assurance

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by samish18, Yesterday, 08:57 AM
                    11 responses
                    28 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by yertle, Today, 08:38 AM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by love2code2trade, Yesterday, 01:45 PM
                    3 responses
                    22 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by trilliantrader, Today, 08:16 AM
                    2 responses
                    6 views
                    0 likes
                    Last Post trilliantrader  
                    Started by samish18, Today, 08:31 AM
                    1 response
                    2 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Working...
                    X