• 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

Calculation OHLC NT8

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

    Calculation OHLC NT8

    Hello,

    I have an issue and I´m working round now for 2 days (!!!) and dont get a solution for this "problem", that might sound ridiculous.
    I simply want to have the distance from Close to Open or Open to Close. I dont know whats goin on that I get strange values printed.

    I have COBC==true and if(BarsInProgress==0){
    range0=(Opens[0][0]-Closes[0][0]);
    range1=(Closes[0][1]-Opens[0][1]);


    Opens and Closes are plotted correctly, but I get as results:
    Opens[0][0] with 2482 and Closes[0][0] with 2482.75 it plots a range0 with -0.5
    Closes[0][1] with 2481.75 and Opens[0][1] with 2481.25 it plots a range with 1.25

    I tried it already with Math.Round and with "*TickSize" but always wrong values for distance open and close.
    What is necessary in there to get the correct values please for open-close or close-open?


    Thank you!
    Tony



    #2
    Hello Tony,

    Can we have the output of a print to fully understand?

    Print this after range0 is assigned its value.
    Code:
    Print(string.Format("{0} | BIP: {1} | (Opens[0][0]: {2} - Closes[0][0]: {3}) = {4} | range0: {5}", Time[0], BarsInProgress, Opens[0][0], Closes[0][0], (Opens[0][0] - Closes[0][0]), range0));
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply. Please find attached the output as txt from a playback and a screenshot of the lines where I tried to get the result.

      Thank you for your support!

      Tony
      Attached Files

      Comment


        #4
        Hello Tony,

        Unfortunately, you have not placed the print after range0 is assigned its value.

        You have placed this print before range0 is assigned its value.

        This means the print will not be printing the current bars value of range0.

        Try placing the print after range0 is assigned its value.


        We can see in the output that the subtraction is correct. The only incorrect value is your value. Likely because this is the value for the previous bar.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by indy73, Today, 04:42 PM
        0 responses
        10 views
        0 likes
        Last Post indy73
        by indy73
         
        Started by Italianforex, Today, 06:20 AM
        2 responses
        12 views
        0 likes
        Last Post gplatis
        by gplatis
         
        Started by alextrd, Today, 01:51 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_JoshG  
        Started by Boonfly8, Today, 12:10 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by NinjaTrader_PaulH, Today, 11:24 AM
        0 responses
        9 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Working...
        X