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

ThinkScript to NinjaScript (NT 8) conversion - Please help!

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

    ThinkScript to NinjaScript (NT 8) conversion - Please help!

    HTML Code:
    AddChart(high = UpH1, low = UpL1, open = UpO1, close = UpC1,
    type = ChartType.CANDLE, growcolor = GlobalColor("Bull"));
    AddChart(high = UpH , low = UpL , open = UpO, close = UpC,
    type = ChartType.CANDLE, growcolor = GlobalColor("WeakBull"));
    
    AddChart(high = DnH1, low = DnL1, open = DnO1, close = DnC1,
    type = ChartType.CANDLE, growcolor = GlobalColor("Bear"));
    AddChart(high = DnH , low = DnL , open = DnO, close = DnC,
    type = ChartType.CANDLE, growcolor = GlobalColor("WeakBear"));
    
    AddChart(high = NuH , low = NuL , open = NuO, close = NuC,
    type = ChartType.CANDLE, growcolor = GlobalColor("Neutral"));​
    Please help in below questions,
    1. AddChart is not a method mentioned in documentation of ThinkScript and I am unable to understand why it is used?
    2. Why are we calling these methods in-line and 5 times i.e. would these 5 calls to AddChart not mean we are plotting charts in the same time slot and only the last plot will be visible since last will win?

    #2
    Hello adeelshahzad,

    I was able to find a forum post with a description of that method using google. It looks like that was used to superimpose a second chart on your main chart in ThinkOrSwim

    An old platform I used allowed me to accidently put a daily price bar on top of a Heiken Ashi candle. I noticed that when the bar close price was above the Heiken Ashi center line the price was going up and when the price was retracting to below the candle the price was pulling back. Bar price...


    I am unsure if that was able to do anything other than superimpose a chart in another chart or why it may have been used in what you are trying to convert.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Actually these 5 lines are plotting Heiken-Ashi bars on chart; overlay-ed to the actual bars.

      But I am trying understand that are they doing that on close of each bar?

      And what equivalent way to be used for plotting candle for Heiken-Ashi bars in NinjaScript; the one I found (from ecosystem) was custom indicator that plotted Heiken-Ashi bars inside
      HTML Code:
      OnRender()
      and
      HTML Code:
      OnCalculateMinMax()
      If that is the way I have to use then how can I call
      HTML Code:
      OnRender()
      and
      HTML Code:
      OnCalculateMinMax()
      times (like ThinkScript) on each bar close?
      Last edited by adeelshahzad; 03-28-2024, 12:17 PM.

      Comment


        #4
        Hello adeelshahzad,

        I wouldn't be able to tell you how thinkscript processes, I don't know how that platform works to be able to say how it processes scripts.

        Plotting in NinjaTrader can be done in a few ways. For simple plots like lines you can use a Plot by using AddPlot(). For custom rendering you can place the OnRender override in the script, that is the SharpDX rendering outlet. You don't need to call that method, its called automatically for render passes.

        OnCalculateMinMax is not required but can be used to make a custom MAX and MIN value for the charts scale, that makes sure those values are visible in the chart.

        JesseNinjaTrader Customer Service

        Comment


          #5
          just learned about this : https://youtu.be/dprA_LefyhQ​ . AI code generator for NT : https://quantwisetrading.com/coder.php , it could debug your code too​
          mcosta72
          NinjaTrader Ecosystem Vendor - Quant-Wise

          Comment


            #6
            Hello mcosta72,

            I just wanted to provide the following disclaimer about AI services for any users who may encounter your post.
            From our experience at this time, ChatGpt and other AI models are not quite adequate to generate valid compilable NinjaScripts that function as the user has intentioned. We often find that the generated code will call non-existent properties and methods, use improper classes or inheritance, and may have incorrect logic. We highly encourage that you create a new NinjaScript yourself using the NinjaScript Editor, and use the code generated by ai as more as suggestions and guide than the actual code generated.

            Below is a link to a forum thread that discusses ChatGpt and it's limitations.
            I'm not a pro coder, and I only learned C# out of necessity due to Ninjatrader. I have actually gained some new, recent knowledge about C# from ChatGPT, and it's been very forthcoming in providing sample code that works. Especially if it involves something off the beaten NT path and yet simple for many but perhaps not to me (a


            While it would not be within our support model to help correct problems with these scripts at user request, we would be happy to provide insight for any direct specific inquiries you may have if you would like to create this script yourself. Our support is able to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.

            You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Thanks Jesse, I am posting the link for users try this new feature. Still in beta test and inputs are welcome. Of course NT is not involved.
              mcosta72
              NinjaTrader Ecosystem Vendor - Quant-Wise

              Comment


                #8
                Thanks a lot mcosta72

                Very helpful resource.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by fx.practic, 10-15-2013, 12:53 AM
                5 responses
                5,406 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by Shai Samuel, 07-02-2022, 02:46 PM
                4 responses
                98 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by DJ888, Yesterday, 10:57 PM
                0 responses
                8 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by MacDad, 02-25-2024, 11:48 PM
                7 responses
                160 views
                0 likes
                Last Post loganjarosz123  
                Started by Belfortbucks, Yesterday, 09:29 PM
                0 responses
                9 views
                0 likes
                Last Post Belfortbucks  
                Working...
                X