• 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

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 Zuhier Dourgham, Today, 03:55 AM
          0 responses
          6 views
          0 likes
          Last Post Zuhier Dourgham  
          Started by JorgeDamien, Today, 03:47 AM
          0 responses
          2 views
          0 likes
          Last Post JorgeDamien  
          Started by jefferyfrench, Today, 03:45 AM
          0 responses
          3 views
          0 likes
          Last Post jefferyfrench  
          Started by alberts, Yesterday, 09:50 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Marco  
          Started by VincentMicah, Today, 12:46 AM
          0 responses
          3 views
          0 likes
          Last Post VincentMicah  
          Working...
          X