Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Crossabove not working as expected

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

    Crossabove not working as expected

    hi ,

    i have written below code to check crossabove and crossbelow of Supertrend with close[0] , so when ever CrossBelow happens it writtens true as expected but when crossAbove happens it writtens false . can u let me know what mistake i am doing?

    Print(Time[0] +"above="+CrossAbove(STV1NEWIND11(Close, 22, 1, false),Close,1));
    Print(Time[0]+"below="+CrossBelow(STV1NEWIND11(Close, 22, 1, false),Close,1));
    Attached Files

    #2
    Hello shankar.deshapande,

    You would need to output the indicator and price values for the current and previous bar to get a better idea of what may have happened in that use case. The reporting of true/false is only helpful to know that the method worked or not, it won't provide any insight on why without knowing the indicator plot values.

    If you are comparing to a visual indicator that you manually applied that may also be the problem, using Prints would be the suggestion to verify if a crossing had actually occurred in the price data of the indicator.

    Comment


      #3
      hi ,

      i tried to print value of indicator at cross over but it is not printing . , but exactly at crossbelow it is writing true but same not happeing for crossabove

      05/04/2022 19:16:00above=FalseSTV1NEWIND11(Close, 22, 1, false)=STV1NEWIND11(MCL 05-22 (1 Minute),false,1,22)==close==>104.28
      05/04/2022 19:16:00below=TrueSTV1NEWIND11(Close, 22, 1, false)=STV1NEWIND11(MCL 05-22 (1 Minute),false,1,22)==close==>104.28

      Comment


        #4
        Hello shankar.deshapande,

        From the print we can see the method is working at least at that point so the other should also be working as well. If you are not seeing true then the method did not detect a crossing. To better understand why that specific bar was false you would have to output the actual value of the indicator you used for the current and previous bar along with the close from the current and previous bar. A crossing is detected if the price was below the price to be compared and then moved above it within the lookback period.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        78 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        45 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        29 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        32 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        64 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X