Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need help to call indicator in my custom strategy

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

    Need help to call indicator in my custom strategy

    Hi gurus,

    I am very new to Ninja programming but have some experience with basic programming.

    I have a ninja script ready indicator and documentation says four values can be called directly in a strategy

    UpperBoll()
    LowerBoll()
    Reversal()
    Stohastics()

    I have used strategy wizard and unlock code to come to a coding screen. How do I call this indicator in my strategy?

    I need to build four rules to create this strategy for day trading.

    Thanks for your help.

    #2
    Hello,

    Thank you for the question.

    If the description of what you are reading says that these can be called directly from a strategy, try the following as a test

    Code:
    Print(UpperBoll());
    If you are able to press F5 and hear the compile sound, then the documentation would be correct and this would be how you call the method.

    If instead this is a method of an indicator, you may instead need to call it like the following:

    Code:
    MyIndicatorsName().UpperBoll();
    If you can provide a screenshot of the document you are reviewing, it would be helpful to see what you are to better understand the question.

    I look forward to being of further assistance.

    Comment


      #3
      Need help to call indicator in my custom strategy

      Thanks for all help. I am able to code four conditions now and see them doing something close to what I need.

      Issue 1 - I am still unable to plot trades on the chart while back testing.

      Issue 2 - I am trying to understand the condition "Signal bar needs to be a down bar" as per documentation. Hence I cant code it.

      Enclosing sample code from four conditions.

      Please let me know if you need the whole code. This was generated using wizard. I am not yet so advanced that I can directly use my custom indicator.
      Attached Files

      Comment


        #4
        Hello [email protected],

        To have a condition that looks for the bar to be a down bar, check the open is greater than the close (or the close is less than the open).

        The conditions you have are very specific and may not be evaluating as true.
        A way to find out why the condition is not true is to print the values of the condition.

        Below is a link to a video of this.


        If you make a copy of your script and then unlock the copy and add this print below. Then compile, open the output window, and run the copy script with the print, what prints in the output window?
        Code:
        Print(string.Format( "{0} | Stoch[1]: {1} > Kvalue40: {2} & Stoch[0]: {3} < Kvalue40: {2}\r\n" +
        	" & Close[1]: {4} > Bollinger(2, 14).Lower[1]: {5} & Close[0]: {6} < Bollinger(2, 14).Lower[0]: {7}\r\n" +
        	" & Open[1]: {8} < Bollinger(2, 14).Lower[1]: {5} & Open[0]: {9} > Bollinger(2, 14).Lower[0]: {7}\r\n" +
        	" & Close[1]: {4} < Open[1]: {5} & Close[0]: {6} > Open[0] > {9}",
        	Time[0], Stochastics(7, 14, 3).K[1], Kvalue40, Stochastics(7, 14, 3).K[0],
        	Close[1], Bollinger(2, 14).Lower[1], Close[0], Bollinger(2, 14).Lower[0],
        	Open[1], Open[0] ));
        This prints all values used in your condition. What is the output of this?
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X