Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose True AND False

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

    CalculateOnBarClose True AND False

    I'd like to have a section of my strategy CalculateOnBarClose == false but also have a section of the code to execute once per bar.

    Can you tell me where I might have went wrong here?

    SET CalculateOnBarClose to false.

    Enclose the code I want to execute once (or during if trigger hit) within this condition...
    if (Historical || FirstTickOfBar || Close[0] > fixedPrice + (GraceTime+100*TickSize) || Close[0] < fixedPrice2 - (GraceTime+100*TickSize))

    fixedPrice 1 and 2 are my trade signals that i want to run once on 1. FirstTickOfBar AND 2. During Bar build if 100 ticks past my trigger anytime Bar is updated.

    Basically this is to avoid small spikes in market data that While taking advantage of significant moves during bar updates.

    Thank you for your time,
    Howie

    #2
    Hello owhie,

    Please follow this sample for how to use both types of logic in your code:
    Separating logic to either calculate once on bar close or on every tick

    Your code has many unconnected conditions joined by OR logic, and it's not clear how it matches what you're looking to do.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you Ryan

      Comment


        #4
        Originally posted by ohowie View Post
        I'd like to have a section of my strategy CalculateOnBarClose == false but also have a section of the code to execute once per bar.

        Can you tell me where I might have went wrong here?

        SET CalculateOnBarClose to false.

        Enclose the code I want to execute once (or during if trigger hit) within this condition...
        if (Historical || FirstTickOfBar || Close[0] > fixedPrice + (GraceTime+100*TickSize) || Close[0] < fixedPrice2 - (GraceTime+100*TickSize))

        fixedPrice 1 and 2 are my trade signals that i want to run once on 1. FirstTickOfBar AND 2. During Bar build if 100 ticks past my trigger anytime Bar is updated.

        Basically this is to avoid small spikes in market data that While taking advantage of significant moves during bar updates.

        Thank you for your time,
        Howie
        I don't see the issue with the || or logic. Can someone help me?

        If Historical (execute section because there are no firsttickofbar during historical
        or
        if firsttickofbar (execute once when running live even though calconbarclose = false)
        or
        Close[0] > fixedPrice + (GraceTime+100*TickSize) (exceeds my BUY HIGH LINE entry target point by 100 piptenths)
        or
        Close[0] < fixedPrice2 - (GraceTime+100*TickSize) (exceeds my SELL LOW LINE entry target point by 100 piptenths)

        HELP, WHAT IS WRONG WITH THAT IF STATEMENT IN AN INDICATOR?

        Thank you guys

        Comment


          #5
          Hello ohowie,

          Please let us know if you are running into any unexpected results with this code snippet.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Hi Ryan,

            I'm not sure about the 2 "or" statements regarding exceeding my targets by 100 tenthpips.

            the if historical and if firstick are operating fine.

            Thanks for the attention Ryan

            Comment


              #7
              If you want to combine COBC = true with COBC = false logic, then you must follow closely with this sample:
              Separating logic to either calculate once on bar close or on every tick
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by 8033075, Yesterday, 08:13 PM
              1 response
              33 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by futurenow, Yesterday, 06:13 PM
              1 response
              24 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by trader3000a, Today, 07:34 AM
              6 responses
              19 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by focus333, Yesterday, 11:28 PM
              1 response
              23 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by futurenow, Yesterday, 07:03 PM
              3 responses
              18 views
              0 likes
              Last Post NinjaTrader_Kate  
              Working...
              X