Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 alifarahani, Today, 09:40 AM
          6 responses
          36 views
          0 likes
          Last Post alifarahani  
          Started by Waxavi, Today, 02:10 AM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by Kaledus, Today, 01:29 PM
          5 responses
          14 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by Waxavi, Today, 02:00 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by gentlebenthebear, Today, 01:30 AM
          3 responses
          17 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X