Announcement

Collapse
No announcement yet.

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.

    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?

        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.

            Comment


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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              50 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              126 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              69 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X