Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

double minValue = chartScale.MinValue;

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

    double minValue = chartScale.MinValue;

    Is it possible to get the bar number with an NT method of
    double
    minValue
    =
    chartScale.MinValue; ?

    thank you

    #2
    Hello frankduc,

    Thanks for your post.

    I do not understand your inquiry. ChartScale.MinValue represents the lowest value that the chart would use for the Y axis, so this would not have a bar index. ChartScale.MinValue also is not a method.

    ChartScale.MinValue - https://ninjatrader.com/support/help...e_minvalue.htm

    Could you clarify on your goal so we can provide further insight?

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      It returns the minimum value on the chart. In my chart the minimum value returned is 2971.66 even if the lowest value showed is 2974.5 for the last 3 days on the emini.

      It represents bars ago 727 or 854 of 1581. I want the number 727 or 854.

      Its because i use cursorX when i click on the chart the position in bar have an impact on all my calculations. The thing is, as a new bar appear on the chart the lowest value is moving. I want to replace cursorX by the bar with the minimum value. I thought if i could get the bar number of minValue i could replace cursorX.

      Comment


        #4
        Hello frankduc,

        ChartScale.MinValue shows the smallest value on the Y axis, it does not show the smallest bar value on the chart.

        If you are trying to find the bar with the lowest value on the chart, you could loop through all bars on the chart and see which one has the lowest value, and save the index as a variable whenever a new lowest value is found.

        Please let us know if we can be of further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi,
          I would like to know if i used the right method because i replaced Bars.GetHigh by Bars.GetLow and its not returning the lowest low bar of the index. I dont understand with GetHigh it return the highest bar of the visible bars on the chart but not with GetLow.
          for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
          {
          if (Bars.GetLow(barIndex) > lowPrice)
          {
          lowPrice = Bars.GetLow(barIndex);
          index = barIndex;
          Print(index);
          }
          }

          Thank you
          Last edited by frankduc; 07-22-2019, 07:08 AM.

          Comment


            #6
            Hello frankduc,

            Please check the operators you are using in your logic. You are checking if Bars.GetLow(barIndex) is greater than lowPrice and then you are assigning a new value for lowPrice.

            Please let us know if we can be of further assistance.
            JimNinjaTrader Customer Service

            Comment


              #7
              found it thank you


              double lowPrice = Int32.MaxValue;
              int index = 0;


              for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
              {
              if (Bars.GetLow(barIndex) < lowPrice)
              {
              lowPrice = Bars.GetLow(barIndex);
              index = barIndex;

              Print(index);
              }
              }


              ty
              Last edited by frankduc; 07-23-2019, 11:38 AM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by RookieTrader, Today, 09:37 AM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by alifarahani, Today, 09:40 AM
              0 responses
              2 views
              0 likes
              Last Post alifarahani  
              Started by Gerik, Today, 09:40 AM
              0 responses
              1 view
              0 likes
              Last Post Gerik
              by Gerik
               
              Started by KennyK, 05-29-2017, 02:02 AM
              3 responses
              1,282 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by AttiM, 02-14-2024, 05:20 PM
              11 responses
              184 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X