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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        181 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        334 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        258 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        358 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        187 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X