Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove Problem

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

    CrossAbove Problem

    I am trying to modify the Stochastics to plot a dot whenever %K crosses above a value of 80 or below a value of 20. I keep getting errors with my syntax and I can't figure out why. The code below:

    if (CrossAbove(Stochastics(7,14,3).K[0],80,1)) DrawDot("Dwn Dot", false, 0, Stochastics(7,14,3).K[0], Color.Maroon);

    gives me errors of:

    "The best overloaded method match for 'NinjaTrader.Indicator.IndicatorBase.CrossAbove(do uble,NinjaTrader.Data.IDataSeries,int)' has some invalid arguments"
    and
    "Argument '2': cannot convert from 'int' to 'NinjaTrader.Data.IDataSeries'"


    I've also tried the following and got the same results.

    double value20=Stochastics(7,14,3).K[0];
    if (CrossAbove(value20,80,1)) DrawDot("Dwn Dot", false, 0, value20, Color.Maroon);


    Can anyone kindly help me out here?

    Thanks in advance.

    #2
    TrendTracker, please try this code instead:
    Code:
    [FONT=Courier New]if (CrossAbove(Stochastics(7,14,3).K,80,1)) DrawDot("Dwn Dot", false, 0, Stochastics(7,14,3).K[0], Color.Maroon);
    [/FONT]

    AustinNinjaTrader Customer Service

    Comment


      #3
      Thank you very much. I was able to get it to compile, but another issue cropped up.

      The dots are being plotted on the same panel as price. I would like them to actually plot on the same panel as the Stochastics. I've used DrawDot successfully in the past. I can't see anything different in what I'm doing now that might be getting it to plot on the wrong panel.

      Any help would be appreciated.

      Comment


        #4
        TrendTracker, please set DrawOnPricePanel = false in the Initialize() section of your code.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Thank you very much!

          It works great now.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          580 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          336 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 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
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X