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.

    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.

        Comment


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

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          154 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          72 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          125 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          79 views
          0 likes
          Last Post PaulMohn  
          Working...
          X