• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling a Strategy from another one

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

    Calling a Strategy from another one

    Hello,

    I'm quite new to NT- and C# - coding (but not programming at all).

    I have a strategy running for a couple of Forex-Pairs. The strategy is compiled and has around 50 inout parameters. Every time I wanna activate this one, I have to check all the parameters which is annoying.

    That's why I wanna create a strategy that simply calls this strategy with all the needed parameters so that I only have to put them into my strategy once. Imagin this like the follows:

    if(Instrument.FullName == "EURUSD")
    {
    Strategy(ABC).Call(param1,param2....param50)
    }
    else if (Instrument.FullName == "EURJPY")
    {
    Strategy(ABC).Call(param1x,param2x....param50x)
    }

    Is that possible? I guess I have to kind of "include" the Strategy ABC into my code. And/Or have to create an intance of X times the Strategy (for each Instrument).....
    Are there any examples available? I searched the forum but couldn't find any useful snippets.

    Bye
    Steakley

    #2
    Originally posted by steakley View Post
    Hello,

    I'm quite new to NT- and C# - coding (but not programming at all).

    I have a strategy running for a couple of Forex-Pairs. The strategy is compiled and has around 50 inout parameters. Every time I wanna activate this one, I have to check all the parameters which is annoying.

    That's why I wanna create a strategy that simply calls this strategy with all the needed parameters so that I only have to put them into my strategy once. Imagin this like the follows:

    if(Instrument.FullName == "EURUSD")
    {
    Strategy(ABC).Call(param1,param2....param50)
    }
    else if (Instrument.FullName == "EURJPY")
    {
    Strategy(ABC).Call(param1x,param2x....param50x)
    }

    Is that possible? I guess I have to kind of "include" the Strategy ABC into my code. And/Or have to create an intance of X times the Strategy (for each Instrument).....
    Are there any examples available? I searched the forum but couldn't find any useful snippets.

    Bye
    Steakley
    You cannot call a Strategy from a another Strategy. If you want to do what you have listed, do it in the Initialize() or OnStartUp() methods, by setting the parameter defaults using an if() or switch() statement.

    Comment


      #3
      Hello steakley,

      Thank you for your post and welcome to the NinjaTrader Support Forum!

      Koganam's post here is correct, you cannot call a strategy from another strategy.

      You could simply right click in the parameters section when setting up your strategy and select 'SetAsDefault for 'yourstrategyName'" after setting the parameters to make them the default parameters.

      For information on working with strategies please visit the following link: http://www.ninjatrader.com/support/h...strategies.htm

      Please let me know if I may be of further assistance.
      Patrick H.NinjaTrader Customer Service

      Comment


        #4
        Hello,

        Thank you both for your answers!

        The strategy is a compiled one. So I can't add anything into the initialize-Section of that strategy. That's why I was interested in calling it from another one.

        I do know about the other suggestion (set as default). But the problem here is that each pair has it's own values which differ from the other pairs. It would be just great to have some kind of possibility to store the values (or to set them as default) in combination with a certain instrument.
        I like the idea most that I could "wrap" this strategy into another one and then simply put in all the params I need and thats it. But if it's not possible then I probably can't solve this problem somehow elegant :-/.

        Thanks anyways!
        Steakley

        Comment


          #5
          Hello Steakley,

          Thank you for your response.

          Unfortunately, there is no option to save multiple templates for the strategy parameters. I will have forward this to our development team as a suggestion.

          Please let me know if I may be of further assistance.
          Patrick H.NinjaTrader Customer Service

          Comment


            #6
            Hello steakley,

            Thank you for your suggestion on how we can improve our product. It has been inserted into our tracking system with the unique ID # 50.
            Patrick H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by stalt, Today, 07:52 AM
            5 responses
            14 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by im197, 07-30-2019, 12:29 PM
            2 responses
            10 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by 7robert, Today, 08:20 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by GARZONJ, Today, 08:06 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by MarianApalaghiei, Today, 01:26 AM
            1 response
            18 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X