• 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

Equivalent command or snippets for NT7

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

    Equivalent command or snippets for NT7

    Hello,
    I am transcribing indicator from NT8 to NT7 and I am struggling with these lines. Are there code snippets or equivalent command for these:

    1) y1 = chartScale.GetYByValue(Zones[i].h);
    2) ChartControl.GetXByBarIndex(ChartBars, Zones[i].b)
    3) ChartControl.GetXByBarIndex(ChartBars, ChartBars.ToIndex)
    4) ChartControl.GetXByBarIndex(ChartBars, ChartBars.GetBarIdxByTime(chartControl, BarsArray[1].GetTime(Zones[i].e)))
    5) ChartBars.GetBarIdxByTime

    Thanks for any advices

    #2
    Hello kujista,

    Thank you for your question.

    In this situation, there are not equivalent methods for all NT8 conversions methods as NT8 has been expanded and documented in this area. You can use the following items in NT7 however there is no documentation for this subject.

    ChartControl.GetYByValue
    ChartControl.GetXByTime
    ChartControl.GetXByBarIdx



    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 02-19-2019, 01:24 PM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you Jesse, this helped a lot. I have a few issue, which appeared..

      1) Is there a way to make this work in NT7 (or what method does the same)
      Code:
      protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
      2) Is ChartScale object accessible in NT7?
      I am wondering if this is equal
      Code:
      NT8: ChartScale.GetYByValue(Zones[i].h)
      equals to
      Code:
      NT7: ChartControl.GetYByValue(Bars, Zones[i].l)
      3) Is there a method equivalent for ChartBars.GetBarIdxByTime in NT7?
      Code:
      ChartBars.GetBarIdxByTime(chartControl, BarsArray[1].GetTime(Zones[i].e)))
      I need this for drawing purposes. I found that there is Bars.GetBars - but this is not equal to ChartBars.GetBarIdxByTime

      4) And last I hope
      Code:
      NT7: LastVisibleBar
      is equal to ?? or how should i do it
      Code:
      NT8: ChartBars.ToIndex
      Thanks a lot for help

      Comment


        #4
        Hello kujista,

        Thank you for your reply.


        1) Is there a way to make this work in NT7 (or what method does the same)
        Code:
        protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
        This would be the Plot override, you can see a sample that comes with NT7 as the CustomPlotSample indicator. However, this is not documented for NT7 so you would need to use C# online guides to learn more about using the "Graphics object" to draw. The graphics object would be the equivalent to NT8's sharpdx framework for windows forms.

        2) Is ChartScale object accessible in NT7?
        I am wondering if this is equal

        Code:
        NT8: ChartScale.GetYByValue(Zones[i].h) equals to
        Code:
        NT7: ChartControl.GetYByValue(Bars, Zones[i].l)
        Yes, this would have the same overall purpose, NT8 this area has been expanded so you will not see some of the graphics conversion methods in NT7. ChartControl contains the majority of all conversion methods like this in NT7.


        3) Is there a method equivalent for ChartBars.GetBarIdxByTime in NT7?
        Code:
        ChartBars.GetBarIdxByTime(chartControl, BarsArray[1].GetTime(Zones[i].e)))
        I am not aware of an equivalent of this, for the most part, the conversion methods in NT7 were one way meaning you can get x values from indexes or times, but not bars from x or time values.

        4) And last I hope
        Code:
        NT7: LastVisibleBar
        is equal to ?? or how should i do it
        Code:
        NT8: ChartBars.ToIndex
        I believe this could work however looking at the Pivots indicator which also uses Plot override, it uses LastBarIndexPainted which appears to be an inherited variable. That seems to be used for a similar purpose. I would suggest testing both to see which works for your goal and/or use prints to see what the value of each variable is in each use case.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by simjs, Today, 08:11 PM
        0 responses
        3 views
        0 likes
        Last Post simjs
        by simjs
         
        Started by mrlucky1x, Today, 06:01 PM
        0 responses
        3 views
        0 likes
        Last Post mrlucky1x  
        Started by dedouglas, Today, 03:17 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Jugado, Today, 02:22 PM
        2 responses
        30 views
        0 likes
        Last Post Jugado
        by Jugado
         
        Started by login_dejavu, Yesterday, 04:58 AM
        2 responses
        24 views
        0 likes
        Last Post login_dejavu  
        Working...
        X