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

Cant edit or make a new version of StrategyGenerator/ai builder

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

    Cant edit or make a new version of StrategyGenerator/ai builder

    Im trying to edit or make a new version of the Strategy Generator/ai builder but when I make a new copy its saying missing refrence in the

    1375 public sealed class GeneratedStrategyLogic : GeneratedStrategyLogicBase

    So is it possible to edit the code of the strategy generator? Thanks for the help

    #2
    Hello rickyblah12,

    Thank you for your post.

    It is possible to edit the code of the StrategyGenerator script.

    Please see the attached example script which demonstrates how you could edit or make a new StrategyGenerator script.

    In the attached example, we right-click on the StrategyGenerator script in the Editor, select 'Save As', and give it the name of StrategyGeneratorMod. Next, we rename 'namespace NinjaTrader.NinjaScript.StrategyGenerator' to 'namespace NinjaTrader.NinjaScript.StrategyGeneratorMod' at line 584. Then, we replace all instances of 'NinjaTrader.NinjaScript.StrategyGenerator' with 'NinjaTrader.NinjaScript.StrategyGeneratorMod'. Finally, we add 'using NinjaTrader.NinjaScript.StrategyGenerator;' to our Using Declarations region at the top of the script. From here, you may edit the script to accomplish your goals.
    ​​
    Please let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hey Brandon thanks that worked...I was looking to see if the strategy generator optimized by profit factor and if I can edit that but I didnt find anything. How can I optimize it based on another metric than pf?

      Comment


        #4
        Hello rickyblah12,

        Thank you for that information.

        You could write your own custom logic in the OnOptimize() method to have the strategy generator optimized based on a different performance metric. OnOptimize() is located somewhere around line 231 in the StrategyGenerator script.

        Please see this help guide link for more information about OnOptimize() - https://ninjatrader.com/support/help...onoptimize.htm

        Let us know if we may further assist.

        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Hi all,

          Once the steps are followed above to create a new strategy generator, How do I get it to be used for AI Generate vs the original one?

          Thanks,
          Erik

          Comment


            #6
            Hi Erik, thanks for posting. The AI Generate feature of the Strategy Analyzer will generate strategies based on candlestick pattern and Indicator inputs. The strategy itself can not be used to generate other strategies.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by ErikHR1969 View Post
              Hi all,

              Once the steps are followed above to create a new strategy generator, How do I get it to be used for AI Generate vs the original one?

              Thanks,
              Erik
              Hi Erik,

              Did you managed to modify the AI Generate script?

              Im looking into adding some logic, like having a checkbox, "Mandatory exit on session close" or only trade between certain hours. etc

              Is this something you have in mind?

              Comment


                #8
                Hello prisonbreaker82,

                Thanks for your notes.

                You could add a public bool property to a strategy if you want to add a user-defined checkbox input.

                The Strategy Builder could be used to see how this could be accomplished. In the New > Strategy Builder window, create a user-defined bool input on the Inputs and Variables screen of the Strategy Builder. Then, click the 'View code' button to see the generated syntax.

                IsExitOnSessionCloseStrategy and ExitOnSessionCloseSeconds could be used to trigger the Exit On Session Close behavior.

                IsExitOnSessionCloseStrategy determines if the strategy will cancel all strategy generated orders on all strategy instruments and close all open strategy positions at the close of ANY session for multi-timeframe/multi-instrument strategies. The number of seconds before the actual session end time is determined by the number of seconds set for ExitOnSessionCloseSeconds.

                ExitOnSessionCloseSeconds is calculated based on the Trading Hours End of Day property set in the strategy's Trading Hours template. Trading Hour Templates are set up to contain the session start and end times of a specific market or instrument.​

                Time Filter and Time Comparison conditions could be used to limit the time that a strategy will place trades.

                See the help guide documentation below for more information.

                Strategy Builder Screens: https://ninjatrader.com/support/help...er_screens.htm
                IsExitOnSessionCloseStrategy: https://ninjatrader.com/support/help...sestrategy.htm
                ExitOnSessionCloseSeconds: https://ninjatrader.com/support/help...oseseconds.htm
                Creating Time Comparisons and Time Filters: https://ninjatrader.com/support/help...on_builder.htm

                Below is a link to a forum post with helpful information about getting started with NinjaScript.
                https://ninjatrader.com/support/foru...040#post786040
                Brandon H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by aa731, Today, 02:54 AM
                0 responses
                1 view
                0 likes
                Last Post aa731
                by aa731
                 
                Started by thanajo, 05-04-2021, 02:11 AM
                3 responses
                469 views
                0 likes
                Last Post tradingnasdaqprueba  
                Started by Christopher_R, Today, 12:29 AM
                0 responses
                10 views
                0 likes
                Last Post Christopher_R  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                166 responses
                2,237 views
                0 likes
                Last Post sidlercom80  
                Started by thread, Yesterday, 11:58 PM
                0 responses
                4 views
                0 likes
                Last Post thread
                by thread
                 
                Working...
                X