• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close-Value is printed as Median

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

    Close-Value is printed as Median

    Hi,

    I have a really strange situation:
    I use following code inside a custom indicator to produce data-input for excel:

    double LinRegSlope5 = (LinReg(3)[1] - LinReg(3)[2])/Close[1];
    double LinRegSlope10 = (LinReg(10)[1] - LinReg(10)[2])/Close[1];
    double LinRegSlope30 = Close[0];

    Print(Time[0] + "§" + Close[0]);
    Print(Time[0] + "§" + High[0] + "§" + Low[0]+ "§" + Median[0] +
    "§" +High[1]+ "§" +Low[1]+
    "§" +BGstatus[0]+ "§" + BGstatus[1] + "§" + ATR(15)[1] +
    "§" + LinRegSlope5 + "§" + LinRegSlope30 + "§" + Open[0]);

    When I checked the data quality I realized that Close[0] is not printed correctly, instead the Median[0] value was returned by the code.

    I tried several different possibilities:
    1st: what you now see as red code "LinRegSlope30" was Close[0] before
    2nd: I changed the variable "LinRegSlope30" above the print command to Close[0], but again the Median[0] was produced
    3rd: I added the simple Print-Command (blue font) to double check, but again only Median was produced (look at attached screenshot). The DataBox in the Chart shows me the correct Close-value of the bars.

    Interestingly enough, when I create a new custom indicator with only the green Code Line, it works properly, so it has to have something to do with the rest of the code in the other indicator, which you can see at the end of that comment (I copied everything from the very top to the very bottom of the code and also exported the indicator via NT-Export-Tool -> the indicator is named "CccMaDifferenceBackColor"). The indicator is working without any error notice as it should. Only the printing seems to be a problem.

    I have the screenshot attached as pdf out of word.doc of the output window.
    image1: produced by the the code above
    image2: produced with new custom indicator -> only green print command

    Can you explain this behaviour of NT/reproduce it on your end??? To me it looks like a major bug!

    kind regards
    Attached Files

    #2
    koalboy,

    If you look at the first line of your screen shot, it says 9995. Where you are printing the LinRegSlope30 it is the same value, and you have assigned it to double LinRegSlope30 = Close[0];

    What it looks like is Median is the same as Close, not necessarily that Close IS the Median. Have you tried calculating the Median yourself to compare?

    It's just (High[0] + Low[0] )/ 2
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      thanks for fast reply,
      as I told you, I came across this error, while doing some basic data quality checks in Excel before "trusting" the data...
      please check not only the first value but also the others!!!
      thx

      Comment


        #4
        We tried to look into your attachment / code file but unfortunately it contained compiled code with no source code access to review. I would suggest reworking your print parts in the original file to see where it 'breaks' exactly, since the test indicator code itself prints ok, I would not suspect a data issue nor NinjaScript method one surfacing here. Try commenting out all prints and just add back them one by one and observer the output generated closely.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by zoreanuv, Today, 01:14 AM
        0 responses
        1 view
        0 likes
        Last Post zoreanuv  
        Started by profitabletrader306, Today, 12:00 AM
        0 responses
        2 views
        0 likes
        Last Post profitabletrader306  
        Started by marcelodelta, Yesterday, 08:28 PM
        2 responses
        11 views
        0 likes
        Last Post marcelodelta  
        Started by junkone, Yesterday, 09:06 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by ferenc., Yesterday, 04:54 PM
        2 responses
        17 views
        0 likes
        Last Post ferenc.
        by ferenc.
         
        Working...
        X