Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Input name for ATM in strategy

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

    Input name for ATM in strategy

    I am running an automated strategy that invokes a named atm, to actually execute the trades. Right now the name of the strategy is embedded in the code and if I want to change the name I have to edit and re-compile the code. Is there a way to include a string variable that I can type the name of an ATM strategy into so that when the strategy enters a position via ""AtmStrategyCreate" I can use the Atm name I entered when I applied the strategy to a chart?
    Thanks
    Daven

    #2
    Hello,

    This is certainly possible using a public property.

    To accomplish this you will need to do two things, first create a private varaible in your variables section like the following:

    Code:
    private string atmStrategyName = "inseretDefaultStrategyNameHere";
    Next you need the public property that will expose this to the user interface by adding the following to your properties section near the bottom:

    Code:
    [Description("ATM Strategy Template Name")]
    [GridCategory("Parameters")]
    public string AtmStrategyName 
    {
    	get { return atmStrategyName ; }
    	set { atmStrategyName = value; }
    }
    Note that the public property of AtmStrategyName is capital, this is the variable you will reference in the OnBarUpdate code to determine the name of the strategy you enter in the strategy properties panel.

    the public will use the default you set as a private, or if the user sets it in the interface it would use that instead of the default.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks, added it to my strategy. I have one more question if you don't mind.
      When I add the input name into the actual AtmStrategyCreate command, to I put it inside quotes, as the embedded name is below, or do I insert it without the quotes?

      AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Limit,Variable1, 0, TimeInForce.Day, orderId, "AtmStrategyName", atmStrategyId);


      Thanks

      DaveN

      Comment


        #4
        Hello,

        Thank you for the question.

        Because the variable is already a string you will only need the variable name.

        In your method call here:

        Code:
        AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Limit,Variable1, 0, TimeInForce.Day, orderId, "AtmStrategyName", atmStrategyId);
        You would want it to be without the quotes like so:

        Code:
        AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Limit,Variable1, 0, TimeInForce.Day, orderId, AtmStrategyName, atmStrategyId);
        Quotes are only needed if you are manually typing in a string or defining a variable as you did with the private variable in the prior message.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Fixed it. Thanks so much for your help.
          Dave

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Perr0Grande, Yesterday, 08:16 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by f.saeidi, Yesterday, 08:12 AM
          3 responses
          24 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by algospoke, Yesterday, 06:40 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by quantismo, Yesterday, 05:13 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by The_Sec, 04-16-2024, 02:29 PM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_ChristopherS  
          Working...
          X