Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

# of ATM Strategies per SampleAtmStrategy

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

    # of ATM Strategies per SampleAtmStrategy

    Hi everyone

    I'm planning to use, amongst other methods, a strategy based on SampleAtmStrategy to enter ATMs automatically.

    Now, there is a maximum of only three 'targets' possible per ATM. However, I would like, if possible, to use more than three targets.

    I'm wondering if it's possible to have more than one ATM launched from within a single SampleAtmStrategy-based strategy.

    If this is possible, I'd like to know how this is done.

    If it isn't possible, as I suspect is the case, would it be feasible to launch two or more SampleAtmStrategy-based strategies simultaneously?

    Any thoughts on this will be much appreciated.

    #2
    Hello,

    Thank you for the question.

    It is possible to use the Sample to create multiple ATM strategies from the same script.

    What you would need to do is first in your Variables section where you see

    Code:
    private string	atmStrategyId		= string.Empty;
    private string	orderId				= string.Empty;
    Duplicate this and make new unique variables so you have something like:
    Code:
    private string	atmStrategyId		= string.Empty;
    private string	orderId				= string.Empty;
    private string	atmStrategyId2		= string.Empty;
    private string	orderId2				= string.Empty;
    Now you would essentially have to duplicate all of the code in OnBarUpdate, in the duplicated code you would replace atmStrategyId with atmStrategyId2 and the same for orderId to orderId2. the two sets of variables will be unique and have unique ID's associated allowing them to run at the same time.

    You can specify the same ATM strategy template name for both and it would use the same or you can specify two different template names.

    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks, Jesse. That's great news that more than one ATM can be created within a single strategy.

      It's obviously something I'll have to be very careful about implementing. I'll see what I come up with and if I do come across any problems, I'll be back here.

      Much obliged.

      Comment


        #4
        Hi again Jesse

        I've been trying to implement your suggestions - again thanks - and I've had no problems with the first section.

        However, with the sections involving the Print commands, I'd be very grateful for some clarifications:

        In the original Sample, there's the section beginning:

        if (orderId.Length > 0)

        I'm guessing that when using two 'orderId's, say orderId1 and orderId2, it would be best to have two separated sections: one starting:

        if (orderId1.Length > 0)

        and the other starting

        if (orderId2.Length > 0)

        or would it be possible to combine them, for example:

        if
        (
        orderId1.Length > 0
        && orderId2.Length > 0
        )


        though I think it might start getting a bit messy in adapting the coding, though it would be shorter.

        Likewise for the section starting:

        if (atmStrategyId.Length > 0)

        Thanks in advance and I look forward to hearing from you again.

        Comment


          #5
          Hello,

          Thank you for the questions.

          For this you want to keep everything separate, it may help to remove all of the comment lines to condense the actual code to make it more readable.

          Essentially everything you see in OnBarUpdate, copy that and add a few extra lines at the end of OnBarUpdate to give you some space and paste a copy right below it. then you would just need to replace the variable names in the pasted section of code with the new ones you have defined.

          I will attach a script with a duplicate in it so you can see what I mean. I have removed all of the comments so you can see just the real code its a lot easier to see but there will be no descriptions so please see the original sample for more information.

          Please let me know if I may be of additional assistance.
          Attached Files
          JesseNinjaTrader Customer Service

          Comment


            #6
            That's brilliant, Jesse. It was really nice of you to work up a 'multiple' strategy. What you've given me is effectively what I was setting out to achieve.

            Just a technical point about the file itself. I downloaded your .cs file which was placed in my (Windows 7) Downloads folder. When I tried to import it into NT7, I couldn't 'see' it in that folder. Now, this doesn't matter so much as I have a text file of your code but should I have been able to import it?

            Thanks.

            Comment


              #7
              Hello,

              No that is my mistake, I should have uploaded a zip file instead I just did not do the export step from NinjaTrader and only provided the .cs file. This can be placed into your strategy folder or Documents\NinjaTrader 7\bin\Custom\Strategy and then when you compile in NinjaTrader it would show up.

              NinjaTrader is only capable of importing zip files, I have attached the importable zip to this post as well.

              Please let me know if I may be of further assistance.
              Attached Files
              JesseNinjaTrader Customer Service

              Comment


                #8
                Download into NT7 successful this time! Thanks for making it into a zip.

                Much obliged for all your help.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by selu72, Today, 02:01 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Started by WHICKED, Today, 02:02 PM
                2 responses
                12 views
                0 likes
                Last Post WHICKED
                by WHICKED
                 
                Started by f.saeidi, Today, 12:14 PM
                8 responses
                21 views
                0 likes
                Last Post f.saeidi  
                Started by Mikey_, 03-23-2024, 05:59 PM
                3 responses
                51 views
                0 likes
                Last Post Sam2515
                by Sam2515
                 
                Started by Russ Moreland, Today, 12:54 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Erick  
                Working...
                X