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

DoubleStochastics won't validate under CrossAbove Logic

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

    DoubleStochastics won't validate under CrossAbove Logic

    I'm trying to have a entry position based on the K value crossing the 10 value. I can get it to work through:

    Click image for larger version

Name:	Example.PNG
Views:	121
Size:	11.1 KB
ID:	1151485

    But this doesn't give me the precise entry I want, even though it's somewhat correct.

    I took multiple examples trying to answer this:

    Click image for larger version

Name:	Capture.PNG
Views:	85
Size:	35.7 KB
ID:	1151486


    As a result I get this:

    Error CS1503 Argument 1: cannot convert from 'double' to 'NinjaTrader.NinjaScript.ISeries<double>'

    Warning CS0436 The type 'Indicator' conflicts with the imported type 'Indicator' in 'NinjaTrader.Vendor, Version=8.0.24.1, Culture=neutral, PublicKeyToken=null'.


    Is it possible to fix it, allowing the DoubleStochastic to go through a CrossAbove/Under logic?

    If so, following the Error & Warning, do I need to create a custom DoubleStochastic, add a double reference (or something else), thus allowing it to follow the CrossAbove Rule?


    Thanks in Advance.
    Last edited by sentient254; 04-14-2021, 05:30 AM.

    #2
    Hello sentient254,

    Thanks for your post.

    With reference to the help guide for the CroosAbove method, there are two ways to use the method 1) with two series, 2) with 1 series and 1 fixed value. Reference: https://ninjatrader.com/support/help...crossabove.htm

    To detect the crossabove the 10 line, you would use the syntax of CrossAbove(ISeries<double> series1, double value, int lookBackPeriod)

    You were close with CrossAbove(DoubleStochastics(10).K[0], 10, 1) however when you used [0] this tells the method you want to use the current bar value when it was expecting the entire series, thus generating the error.

    The correct way to do this is CrossAbove(DoubleStochastics(10), 10, 1)
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Rapine Heihei, Today, 08:19 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by Rapine Heihei, Today, 08:25 PM
    0 responses
    5 views
    0 likes
    Last Post Rapine Heihei  
    Started by f.saeidi, Today, 08:01 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by Rapine Heihei, Today, 07:51 PM
    0 responses
    6 views
    0 likes
    Last Post Rapine Heihei  
    Started by frslvr, 04-11-2024, 07:26 AM
    5 responses
    97 views
    1 like
    Last Post caryc123  
    Working...
    X