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 quantismo, 04-17-2024, 05:13 PM
              3 responses
              25 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              5 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              214 views
              1 like
              Last Post PaulMohn  
              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
              4 responses
              547 views
              0 likes
              Last Post PaulMohn  
              Working...
              X