Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        599 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        344 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        558 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        557 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X