Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

not firsttickofbar

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

    not firsttickofbar

    Hello,

    I know how to work with COBC=false and FirstTickOfBar. But as I have 2 setups in the script and there occur issues with orderhandling if both setups are true the same tick I want to add to my 2nd setup "not FirstTickOfBar". How one can do this please?

    ...
    && FirstTickOfBar // this is clear

    ....
    && NOT FirstTickofBar //how to write in the script please?
    (with ....&& FirstTickofBar == false (???))

    Thank you

    Best
    Tony

    #2
    Tony, yes you could check for FirstTickOfBar == false or ! FirstTickOfBar. FirstTickOfBar is just a bool.
    Then once your order handling is done I would ensure via a boolflag that this code is not continuously run throughout rest of the tick updates for the bar you're on.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you!

      Originally posted by NinjaTrader_Bertrand View Post
      Tony, yes you could check for FirstTickOfBar == false or ! FirstTickOfBar. FirstTickOfBar is just a bool.
      Then once your order handling is done I would ensure via a boolflag that this code is not continuously run throughout rest of the tick updates for the bar you're on.

      Comment


        #4
        Hello,

        with COBC=false and entryconditions

        if(FirstTickOfBar
        && Close[0] > Low[0]
        && Position.MarketPosition == MarketPosition.Flat)

        it works correctly with forex but not with futures. There is no entry. How can this be?

        (Dataseries: NinjaTrader Range-Bar)

        Thanks
        Tony



        Originally posted by NinjaTrader_Bertrand View Post
        Tony, yes you could check for FirstTickOfBar == false or ! FirstTickOfBar. FirstTickOfBar is just a bool.
        Then once your order handling is done I would ensure via a boolflag that this code is not continuously run throughout rest of the tick updates for the bar you're on.
        Last edited by tonynt; 09-14-2013, 08:18 AM. Reason: clearify

        Comment


          #5
          Originally posted by tonynt View Post
          Hello,

          with COBC=false and entryconditions

          if(FirstTickOfBar
          && Close[0] > Low[0]
          && Position.MarketPosition == MarketPosition.Flat)

          it works correctly with forex but not with futures. There is no entry. How can this be?

          (Dataseries: NinjaTrader Range-Bar)

          Thanks
          Tony
          This is a funny idea. A tick means a trade. After the first tick of bar, a single trade has been registered. Let us assume that the trade was transacted at a price p. In that case
          you have

          Open[0] = High[0] = Low[0] = Close[0] = p

          Therefore the condition Close[0] > Low[0] is always false, and you will never enter a trade. This your script works for futures as expected.

          I am more puzzled about the FOREX side of your observation. The only explanation that comes to my mind, is that the FOREX data may be based on bid/ask data, and that in fact the data shown on your screen is midpoint data as opposed to trade data. In that case you would have

          Low[0] = bid, High[0] = ask & Open[0] = Close[0] = midpoint

          which would explain why the Low[0] is smaller than Close[0], a condition which cannot hold true, if you just exploit trade data.

          Comment


            #6
            Harry,

            thank you very much for your reply. The idea is to enter a trade after close of bar with COBC=false. On NT support sites I found it and I thought this would work: http://www.ninjatrader.com/support/h...nt7/index.html

            Please, how would you do for having the entry after close of bar? (I need the entry with a reversal-bar in a range chart)

            Thank you!

            Best regards
            Tony


            Originally posted by Harry View Post
            This is a funny idea. A tick means a trade. After the first tick of bar, a single trade has been registered. Let us assume that the trade was transacted at a price p. In that case
            you have

            Open[0] = High[0] = Low[0] = Close[0] = p

            Therefore the condition Close[0] > Low[0] is always false, and you will never enter a trade. This your script works for futures as expected.

            I am more puzzled about the FOREX side of your observation. The only explanation that comes to my mind, is that the FOREX data may be based on bid/ask data, and that in fact the data shown on your screen is midpoint data as opposed to trade data. In that case you would have

            Low[0] = bid, High[0] = ask & Open[0] = Close[0] = midpoint

            which would explain why the Low[0] is smaller than Close[0], a condition which cannot hold true, if you just exploit trade data.
            Last edited by tonynt; 09-15-2013, 01:31 AM. Reason: typing error

            Comment


              #7
              Originally posted by tonynt View Post
              Harry,

              thank you very much for your reply. The idea is to enter a trade after close of bar with COBC=false. On NT support sites I found it and I thought this would work: http://www.ninjatrader.com/support/h...nt7/index.html

              Please, how would you do for having the entry after close of bar? (I need the entry with a reversal-bar in a range chart)

              Thank you!

              Best regards
              Tony
              With COBC = false, you probably want to compare open and close of the prior completed bar. For a reversal you could use the condition

              Code:
              if(FirstTickOfBar && Close[1] > Open [1] && Close[2] < Open[2])
              FirstTickOfBar : this is the first tick of the new bar
              Close[1] > Open[1] : the prior bar was an upclose
              Close[2] < Open[2] : the second but the last bar was a downclose

              Comment


                #8
                Harry,

                thank you for your help!

                Have a great day!

                Best regards
                Tony

                Originally posted by Harry View Post
                With COBC = false, you probably want to compare open and close of the prior completed bar. For a reversal you could use the condition

                Code:
                if(FirstTickOfBar && Close[1] > Open [1] && Close[2] < Open[2])
                FirstTickOfBar : this is the first tick of the new bar
                Close[1] > Open[1] : the prior bar was an upclose
                Close[2] < Open[2] : the second but the last bar was a downclose

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rexsole, Today, 08:39 AM
                0 responses
                4 views
                0 likes
                Last Post rexsole
                by rexsole
                 
                Started by trilliantrader, Yesterday, 03:01 PM
                3 responses
                30 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by cmtjoancolmenero, Yesterday, 03:58 PM
                4 responses
                26 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Brevo, Today, 01:45 AM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by rjbtrade1, 11-30-2023, 04:38 PM
                2 responses
                74 views
                0 likes
                Last Post DavidHP
                by DavidHP
                 
                Working...
                X