Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cross above/below methods confusion...

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

    Cross above/below methods confusion...

    Hi,
    I'm confused with above/bolow methods... If I want to write simple logic - if %K crossing 20% from below up, e.g. when %K is above 20% line (or %K = 21%) then put marker and/or alert... what method should I use CrossAbove() or CrossBelow() in this case? How to stop alerts and markers when %K is more 21, e.g. %K>=22 ? Same when the %K crossing 80% from above down, e.g. when below 80% or %K= 79 then put marker/alert... Stop when %K <= 78...
    Here's what I'm actually writing and getting no signals/alerts...

    If (K[0] > 80)
    {
    If CrossBelow(K, 80, 1) //If above 80 and crossing down, e.g. below 80% line...
    {
    // Then marker/alert short
    }
    }
    Else If (K[0] < 20)
    {
    If CrossAbove(K, 20, 1) //If below 20 and crossing up, e.g. above 20% line...
    {
    // Then marker/alert long
    }
    }
    ....
    Is there any other way to write this simple logic?
    Thank you very much.

    #2
    Hello Art09,

    I would take a look at this help guide article on defining crossover conditions in the condition builder. You can setup crossing conditions in a point and click interface and then view the code for it.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you. But I'm still not clear how to create strategy for Stoch. when %K crosses %D. This is what I get and I do not think this is correct:

      if (CrossAbove(Stochastics(D, K, Smooth).DUpper, Stochastics(D, K, Smooth).DUpper, 1))
      {
      DrawArrowUp("My up arrow" + CurrentBar, false, 0, 0, Color.Lime);
      }

      With MAs it is clear and easy. But not when Stoch crosses the Stoch as above. What's the DUpper argument? Should I replace one of those with KUpper? Still confusing and not answers my question.
      Thank you.

      Comment


        #4
        You would need to select the correct plot of the Stochastics to use, as they 'expose' 2 to use (%K and %D) - http://www.ninjatrader-support.com/H...ndicators.html

        In your example you used the %D in both cases which is not the condition you seek.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X