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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        168 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        322 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        246 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X