Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove

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

    CrossAbove

    re. SampleHighLowCross Calculate.OnEachTick (attached)

    Code:
    if (Position.MarketPosition == MarketPosition.Flat && CrossAbove(Close, highestHigh, 1))
    EnterLong();
    does this compare the current tick with the previous tick to determine if there has been a CrossAbove?
    Attached Files

    #2
    Hello dibDab,

    That would compare the current tick against the last bars closed price. Methods that take a lookback period always reference bar data. In realtime while using OnEachTick the Close price of 0 bars ago would be the current tick, the Close of 1 bars ago is the previous bar.

    Comment


      #3
      could you tell me what the difference would be in terms of catching a cross above?

      CrossAbove(Close, highestHigh, 0) vs CrossAbove(Close, highestHigh, 1)



      maybe this should be another topic? but would

      if (Time[0].TimeOfDay >= endOfDay.TimeOfDay)

      catch the end of day as soon as the current tick time was >= endOfDay.TimeOfDay?
      Last edited by dibDab; 10-16-2023, 09:33 AM.

      Comment


        #4
        Hello dibDab,

        Using 0 as the lookback period will make that always false, you need at least 2 bars of data to know if there was a cross. 1 is the minimum lookback that you can use with that method.

        Comment


          #5
          ok.

          if the last tick was 85.45 and the current tick was 85.46 and I wanted to catch a crossabove 85.45 how would I do that?

          Comment


            #6
            Hello dibDab,

            You would have to make a condition that checks if the Close is less than or greater than a variable. After doing that check you would set the close to the variable again to repeat that process. The CrossAbove and Below rely on the bar data, you never would be comparing two ticks when using bar data as you only have access to the current tick or the previous bars close depending on the BarsAgo used.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            52 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            43 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            47 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X