• 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

CalculateOnBarClose in strategy vs indicator

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

    #31
    Hello Chelsea,

    thank you for your reply and all your support!

    I didnt add it the first line of OBU (didnt know to do there, sorry)

    Yes, it plots now, but what I do not understand is why there is true eg the following statement, even when the referring bar was an upbar and close .75 is not <= open .50.

    9/24/2015 4:30:00 PM | Position: Flat == Flat && BarsInProgress: 2 && entryOrderLa: null == null && entryOrderLb: null == null && Closes[2][2]: 1919.75 <= Opens[2][2]: 1919.5 && Closes[2][2]: 1919.75 < Highs[2][2]: 1919.75 && Closes[2][1]: 1920.5 >= Opens[2][1]: 1920 && Closes[2][1]: 1920.5 > Lows[2][1]: 1920 && FirstTickOfBar: True

    Thank you
    Tony

    Comment


      #32
      Hi Tony,

      I would not expect the 4:30 bar to have evaluated as true.
      The print has multiple items that are false.
      (If this were true the order would appear on the 4:31 bar if Calculate on bar close is True)

      Do you have a print in the condition that is evaluating as true? Does this print print the time that the condition was true?
      Please post this output if so.

      Can you post the exact print and the exact condition?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #33
        Hi Chelsea,,

        my conditions works accurately in a 2 Range Chart. But when I change dataseries to 1min and in the code "Close[1]" to "Closes[2][1]"............... and add "BIP==2" there is no entry.

        I tried with FirstTickOfBar and without FirstickOfBar. (what I still didnt understand is if "FirstTickOfBar" refers to BIP==0 or BIP==2.

        The condition is simple:
        if(Position.MarketPosition == MarketPosition.Flat
        && BarsInProgress==2
        && Closes[2][2] <= Opens[2][2] && Closes[2][2] < Highs[2][2]
        && Closes[2][1] >= Opens[2][1] && Closes[2][1] > Lows[2][1]
        && FirstTickOfBar)

        Thank you for your support
        Tony
        Last edited by tonynt; 09-24-2015, 03:18 PM. Reason: typo

        Comment


          #34
          Tony,

          Its hard for me to answer this question.
          I have already said that FirstTickOfBar will refer to the BarsInProcess that is currently processing.
          I am unsure of how to answer this question;
          The series that FirstTickOfBar is referencing changes depending on what is being processed in OnBarUpdate.

          At this point I think we need to have a conversation on the phone, as I don't think I will be able to further explain this through text. Please send an email to platformsupport [at] ninjatrader [dot] com.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #35
            Chelsea,

            thank you for your support. I resolved it this moring and changed from

            "if (BarsInProgress!=0) return;" and in the Code "&& BarsInProgress==2" and referring to dataseries[2] (just wondering why no one told me that this doesnt work!?)

            to "if (BarsInProgress!=2) return;" and in the code only refer to dataseries [2]

            Best
            Tony

            Comment


              #36
              Hello Tony,

              dataseries[2] would refer to the 2 bars ago value of that data series and would not be a way of selecting that dataseries.

              Also, custom dataseries will be synced with 1 bar series (typically the primary) and will not have a series for every bar series.

              Using if (BarsInProgress == 2) { } would mean that Close, Open, Time, FirstTickOfBar, all refer to the 3rd dataseries.

              Using if (BarsInProgress != 2) return; would do the same for any code below that point.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Johnny Santiago, Today, 07:06 AM
              0 responses
              3 views
              0 likes
              Last Post Johnny Santiago  
              Started by HiddenPhilosopher, Today, 04:37 AM
              1 response
              21 views
              0 likes
              Last Post NinjaTrader_ChristopherS  
              Started by aprendiz, Today, 06:44 AM
              1 response
              2 views
              0 likes
              Last Post NinjaTrader_Jim  
              Started by frankduc, Today, 06:35 AM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_Jim  
              Started by Trexxx, Today, 06:34 AM
              0 responses
              2 views
              0 likes
              Last Post Trexxx
              by Trexxx
               
              Working...
              X