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

userdefinedmethods

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

    userdefinedmethods

    I've been working with code that uses the techniques listed in the pages below. I have 2 questions.

    1) How does one pass the current market position to the userdefinedmethod? I see from the example that you include the data type and the variable that you need passed on in the brackets, but don't know how this works with market position. For example, if the userdefined method needs to know that you are short to evaluate a condition, how do I pass on from the strategy that uses the userdefinedmethod, whether or not I am short?

    2) Is there any way to isolate an entire chunk of code into userdefinedmethod? For example, if I have a whole bunch of stratgies that have the same trailing stop is it possible to have the entire conditional statement for the stop contained in the userdefinedmethod to be called when the system is long or short? (as opposed to letting the userdefinedmethod evaluate the conditions, return a true or false and having the main strategy submit the closing stop order) & if so, an example would be greatly appreciated.

    Thank you very much in advance.

    ---

    #2
    1) In your user defined method have it take on a market position or position parameter.

    2) I have never tried it before, but you can give it a shot if you want. Just have it place orders from within the method. It may or may not work. Unfortunately there is no example.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Find / Replace in all strategies.

      Is there a find/replace command that will replace all instances of a userdefinedmethod with a modification?

      I remember seeing something like this but I can't remember whether it was for NT or another software.

      For example if I currently have ExampleUDM(var1) and want to add a new variable, is there a way to find replace in all strategies so that there won't be any compile error when I change it to ExampleUDM(var1, NewVar)?

      Thanks.

      Comment


        #4
        Unfortunately not.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          8DTK8,

          I know there are 3rd party tools that will let you do that. You can do a search replace across a group of files. Try looking into html editors as this is a common task when working with html files.

          Here is one that I found, but I have not tried it.


          It's freeware.


          Thanks,


          r2kTrader

          Originally posted by 8DTK8 View Post
          Is there a find/replace command that will replace all instances of a userdefinedmethod with a modification?

          I remember seeing something like this but I can't remember whether it was for NT or another software.

          For example if I currently have ExampleUDM(var1) and want to add a new variable, is there a way to find replace in all strategies so that there won't be any compile error when I change it to ExampleUDM(var1, NewVar)?

          Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by DanielTynera, Today, 01:14 AM
          0 responses
          2 views
          0 likes
          Last Post DanielTynera  
          Started by yertle, 04-18-2024, 08:38 AM
          9 responses
          41 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by techgetgame, Yesterday, 11:42 PM
          0 responses
          12 views
          0 likes
          Last Post techgetgame  
          Started by sephichapdson, Yesterday, 11:36 PM
          0 responses
          2 views
          0 likes
          Last Post sephichapdson  
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,615 views
          0 likes
          Last Post aligator  
          Working...
          X