Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

sma crossover calculating on [1] from the current intra bar

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

    sma crossover calculating on [1] from the current intra bar

    how can i have the sma stop calculating in the [1] one bar ago. the crossover didn't happen visually [1] one bar ago. but intra bar calculations made it be in the [1] bar ago but just can't see it until the intra bar closes. and, sometimes the crossover doesn't happen. but, the calculation for it during intra bar did have it happen. so trades execute. i don't want them to execute unless the crossover appears visually.

    i'm using update on price change.

    it also happens on this other strategy where i have: open less than bollinger line and close greater than bollinger line. you can see 2 bars ago from the green entry marker. the price on that candle was not like that. its like its calculating the bollinger line still. and, i'd like that not to happen. because, i'm getting executions i don't want.
    Attached Files
    Last edited by SteveReiza; 02-15-2024, 01:47 PM.

    #2
    Hello SteveReiza,

    Are you testing this in realtime? OnPriceChange requires using the strategy in realtime to see intrabar crosses.
    JesseNinjaTrader Customer Service

    Comment


      #3
      thanks for the reply. yes its real time on a simulated account

      Comment


        #4
        Have you tried using prints to verify the condition became true right when the crossover happened in realtime?
        JesseNinjaTrader Customer Service

        Comment


          #5
          thanks for the reply. my issue isn't that its not crossing over when there is one. my issue is that its doing it when there isn't one. its like the intra bar calculation at [0] is affecting the line at [1] and [2] even though the candle is closed.

          Comment


            #6
            Hello SteveReiza,

            You would need to use a print to see exactly when the condition is becoming true. The order will be submitted when the condition is true because you are using OnPriceChange. If you are using a 1 lookback period on the crossover that should be using the [0] and [1] bars ago values which would be the building bar and last closed bar when using OnPriceChange.
            JesseNinjaTrader Customer Service

            Comment


              #7
              thanks for the reply. okay, i'll check out using prints.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Option Whisperer, Today, 09:55 AM
              0 responses
              5 views
              0 likes
              Last Post Option Whisperer  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              8 responses
              58 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by halgo_boulder, 04-20-2024, 08:44 AM
              2 responses
              22 views
              0 likes
              Last Post halgo_boulder  
              Started by mishhh, 05-25-2010, 08:54 AM
              19 responses
              6,189 views
              0 likes
              Last Post rene69851  
              Started by gwenael, Today, 09:29 AM
              0 responses
              6 views
              0 likes
              Last Post gwenael
              by gwenael
               
              Working...
              X