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

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.
    JesseNinjaTrader Customer Service

    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.
        Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.NinjaTrader 7 is an award winning end to end online ...


        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 PaulMohn, Today, 03:49 AM
        0 responses
        7 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        4 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X