• 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 Vincere, Today, 04:38 AM
        0 responses
        2 views
        0 likes
        Last Post Vincere
        by Vincere
         
        Started by trader_rick, Today, 04:02 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_ChrisSch  
        Started by percma, Today, 02:51 AM
        0 responses
        5 views
        0 likes
        Last Post percma
        by percma
         
        Started by Abilene, Today, 01:27 AM
        0 responses
        15 views
        0 likes
        Last Post Abilene
        by Abilene
         
        Started by simjs, Yesterday, 08:11 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChrisSch  
        Working...
        X