• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Filling 2-4 Order In Succession

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

    Strategy Filling 2-4 Order In Succession

    I am running a strategy on playback and it placed 2 orders in a row instantaneously one after the other and added extra ticks to my stop loss. It seems to happen if my stop loss is hit right after order is filled. Is there a way to stop this? Will this happen in Live trading? I'm scared.

    #2
    Hello Sadat,

    This is likely due to the logic being used in combination with the strategy settings being used. It is possible that if your condition remains true after your stop is filled it will repeat the same process over and over.

    Are you currently setting the stop very close to the entry price where it may be filled within the same bar? Another item would be using the strategy OnEachTick, intrabar calculations can also result in many entries per bar with a condition that is not specific enough or an order placement that is very close to the entry price.

    If you are seeing this occur in playback during live playback, it is very likely that something similar may happen in realtime. Depending on what logic is being used and how specific the conditions to trade are will control this type of occurrence.



    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      The stop is 3 ticks. I am using market replay with a strategy. The part you said about conditions being specific enough could be the problem. I tightened up my values for volume and Buysell pressure before and it seemed to decrease the orders in succession. Right now my volume values are within 50 of each other and my buysell pressure values are within three of each other. Maybe that is not tight enough. I do not want to make it too tight to the point it will not trigger

      Comment


        #4
        Hello Sadat,

        If there should be no point where two or more entries/exits should happen in the same bar you could look into using the BarsSinceEntryExecution or BarsSinceExitExecution in your logic. For conditions that would be difficult to make more specific, you can always look at using logic to control that situation better.

        https://ninjatrader.com/support/help...BarsSinceEntry
        https://ninjatrader.com/support/help...=barssinceexit

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello Jesse,


          You mentioned using logic. Where would you place this logic in the strategy?

          Comment


            #6
            Hello Sadat,

            This syntax would need to be part of a condition similar to the samples shown in the help guide. Your strategy likely has other conditions in it, you could use these items in your conditions if that would assist in refining the condition to happen less frequently. I just mentioned these items because they deal with a number of bars since an event. If you wanted to ensure the condition cannot become true again in the same bar, these are good items for that use case.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Originally posted by Sadat View Post
              Hello Jesse,


              You mentioned using logic. Where would you place this logic in the strategy?
              You would use the logic as part of your entry gate. That would depend on exactly what you want your final state to be regarding the orders entered. As an example, if you wanted to ensure that there can be one and only one entry on a bar, and we shall assume that you (most efficient way) use a bool variable to determine whether to make an entry, here is some structured pseudocode that you could use.

              Code:
              // these are declared in class scope.
              private int entryBar =0;
              private bool entryAllowed = false;
              
              protected override void OnBarUpdate()
              {
                  if (IsFirstTickOfBar) entryBar = 0; //this resets this on entry to each bar, effectively allowing orders to be made, (q.v.)
              
                  if (/* all your entry conditions are met */) entryAllowed = true;
                  else entryAllowed = false;
              
                  if (CurrentBar != entryBar && entryAllowed)
                      {
                          /*your entry order here - EnterLong(... etc) */
                          entryBar = CurrentBar; //this ensures that the block cannot be entered again until the entryBar variable is reset on the open of the next bar
                      }
              }

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by reedstickets, Today, 07:53 PM
              0 responses
              6 views
              0 likes
              Last Post reedstickets  
              Started by Atilla, Today, 04:05 PM
              0 responses
              18 views
              0 likes
              Last Post Atilla
              by Atilla
               
              Started by Displacer, Today, 02:57 PM
              2 responses
              13 views
              0 likes
              Last Post Displacer  
              Started by SAILIKITY, 05-22-2019, 05:41 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by rmillar, 01-09-2019, 06:02 PM
              6 responses
              75 views
              1 like
              Last Post eDanny
              by eDanny
               
              Working...
              X