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, 04: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 DJ888, 04-16-2024, 06:09 PM
              6 responses
              18 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              1 view
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              6 views
              0 likes
              Last Post Javierw.ok  
              Started by timmbbo, Today, 08:59 AM
              2 responses
              10 views
              0 likes
              Last Post bltdavid  
              Started by alifarahani, Today, 09:40 AM
              6 responses
              41 views
              0 likes
              Last Post alifarahani  
              Working...
              X