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

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 ruudawakening, Today, 12:58 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by i019945nj, 12-14-2023, 06:41 AM
        4 responses
        64 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by thread, Yesterday, 11:58 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by stafe, Yesterday, 08:34 PM
        1 response
        16 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by jclose, Yesterday, 09:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X