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 andrewtrades, Today, 04:57 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          3 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X