Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Postpone or Delay a Long entry for the next 5 bars??? Help

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

    Postpone or Delay a Long entry for the next 5 bars??? Help

    Hello Ninjatrader Team,

    I would like to know how I can Postpone a long entry by 5 bars. For example I have a strategy that goes long, every time the volume is 50,000 on a 5 min bar. So once that condition is met it should wait five bars THEN take the long trade. How can I do this.

    Thank you

    #2
    Originally posted by wallsteetking View Post
    Hello Ninjatrader Team,

    I would like to know how I can Postpone a long entry by 5 bars. For example I have a strategy that goes long, every time the volume is 50,000 on a 5 min bar. So once that condition is met it should wait five bars THEN take the long trade. How can I do this.

    Thank you
    You record the barNumber where your condition is triggered, then check for the barNumber that is 5 greater, and place your entry.

    Code:
     
    private int entryBar = -1;
    Code:
     
    if (EntryConditionsMet)
    {
    entryBar = CurrentBar + 5;
    }
    Code:
     
    if (CurrentBar == entryBar)
    {
    //enter trades here, EnterLong() et.c., then reset the entryBar variable.
    entryBar = -1;
    }

    Comment


      #3
      I have one more question for you, how can i do the same thing but instead of bars i want to work with price. for example lets say i don't want to enter right away, i want to wait when the price falls 3 points, then enter. how can i achieve this.

      Comment


        #4
        To your first question I would just ask Vol[5] > 50000.
        To your curent question, just put a limit order.

        Comment


          #5
          Hello wallsteetking,

          You may capture the price from your entry condition like you did when you captured the bar number and add the price that you want to see:

          Code:
          private double capturedPrice = 0;
          Code:
          if (EntryConditionsMet)
          {
          capturedPrice = Close[0] - 3;
          }
          Then check the current price if it is lower or equal to the price that you have set.

          Code:
          if (Close[0] <= capturedPrice)
          {
          // Enter your trade
          }

          Let us know if that will work for you.
          JCNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by FrancisMorro, Today, 03:24 AM
          0 responses
          1 view
          0 likes
          Last Post FrancisMorro  
          Started by Segwin, 05-07-2018, 02:15 PM
          10 responses
          1,770 views
          0 likes
          Last Post Leafcutter  
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          31 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          944 views
          0 likes
          Last Post spwizard  
          Started by Max238, Today, 01:28 AM
          0 responses
          11 views
          0 likes
          Last Post Max238
          by Max238
           
          Working...
          X