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

Question about simple indicator

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

    Question about simple indicator

    Hello,

    I'm a newcomer to NinjaScript and I'm trying to write a simple indicator based on SMA of the previous bar

    After trying several times my indicator never plots a line.

    I´ve simplified the code to the minimum still showing the problem, so it's easier to debug:

    This is the standard code for mycustomindicator:

    Code:
     [FONT="Courier New"]  {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                Plot0.Set(Close[0]);
            }[/FONT]
    If I modify it in this way, the EMA 25 is plot:

    Code:
    [FONT="Courier New"]  {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                Plot0.Set(EMA (Close, 25) [0]);
            }[/FONT]

    But if I just modify it in this way to shift the indicator one bar, the indicator disappears from the chart:

    Code:
    [FONT="Courier New"]  {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                Plot0.Set(EMA (Close, 25) [1]);
            }
    [/FONT]
    Probably I didn't see an obvious mistake...
    But please, could anybody give me a hint?

    Best regards

    Francisco
    Last edited by frangonve; 08-15-2013, 04:25 PM. Reason: Improving readability

    #2
    Turn on the output window.

    Tools->Output window

    You should have an error there for the last statement:

    Plot0.Set(EMA (Close, 25) [1]);


    Originally posted by frangonve View Post
    Hello,

    I'm a newcomer to NinjaScript and I'm trying to write a simple indicator based on SMA of the previous bar

    After trying several times my indicator never plots a line.

    I´ve simplified the code to the minimum still showing the problem, so it's easier to debug:

    This is the standard code for mycustomindicator:

    Code:
     [FONT="Courier New"]  {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                Plot0.Set(Close[0]);
            }[/FONT]
    If I modify it in this way, the EMA 25 is plot:

    Code:
    [FONT="Courier New"]  {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                Plot0.Set(EMA (Close, 25) [0]);
            }[/FONT]

    But if I just modify it in this way to shift the indicator one bar, the indicator disappears from the chart:

    Code:
    [FONT="Courier New"]  {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                Plot0.Set(EMA (Close, 25) [1]);
            }
    [/FONT]
    Probably I didn't see an obvious mistake...
    But please, could anybody give me a hint?

    Best regards

    Francisco

    Comment


      #3
      Read up here:




      Originally posted by frangonve View Post
      Hello,

      I'm a newcomer to NinjaScript and I'm trying to write a simple indicator based on SMA of the previous bar
      But if I just modify it in this way to shift the indicator one bar, the indicator disappears from the chart:

      Code:
      [FONT="Courier New"]  {
                  // Use this method for calculating your indicator values. Assign a value to each
                  // plot below by replacing 'Close[0]' with your own formula.
                  Plot0.Set(EMA (Close, 25) [1]);
              }
      [/FONT]
      Probably I didn't see an obvious mistake...
      But please, could anybody give me a hint?

      Best regards

      Francisco

      Comment


        #4
        Solved!

        Thanks a lot for your help!!!

        Francisco

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        17 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        4 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        39 views
        0 likes
        Last Post love2code2trade  
        Started by junkone, Today, 11:37 AM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X