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

AI Generated Indicator

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

    AI Generated Indicator

    I'm sure that this is beyond your remit, but, if you could help me, it would be greatly appreciated:

    I want to create an indicator that will generate high and low lines (and labels) each day for the Globex MES session (6PM-9:30AM EST). I know almost nothing about C programming.

    Microsoft CoPilot generated the code. When inserting it in the script editor, I only get two errors. I realize that if I were able to fix those errors, many more might appear. In the hope that it isn't much more than those two errors and that they're caused by my mis-placement of the code, please find the following:
    1. The NT code template segment in which I attempted to insert it.
    2. The CoPilot code

    I'm hoping that I just placed the wrong portion of the snippet between the braces and that you can insert the proper one in the right place and post it.

    Any help would be greatly appreciated.

    NT Indicator Template Code

    {
    //Add your custom indicator logic here.
    }​


    CoPilot Code
    Unfortunately, it uploads without line breaks, so it's not very readable. I've attached it in a text file.
    Attached Files

    #2
    Hello sgordet,

    Below is a link to a support article with helpful resources on getting started with C# and NinjaScript development.


    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 ChatGpt 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 correct 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.​


    With your script, the framework of this is not correct.
    Strategies must be in the NinjaTrader.NinjaScript.Strategies namespace.
    SetDefinition() is not a NinjaScript method and there is definition for this method in the script.
    The Strategy should not be a partial class.
    I would not recommend the class name to be Script. If you are intending for the name to be LowestAndHighestPrices, this should also be the classname and the filename.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DJ888, Today, 10:57 PM
    0 responses
    5 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    158 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Today, 09:29 PM
    0 responses
    7 views
    0 likes
    Last Post Belfortbucks  
    Started by zstheorist, Today, 07:52 PM
    0 responses
    7 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    151 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Working...
    X