Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATMStrategyCreate query

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

    ATMStrategyCreate query

    I want to keep type of order entry selectable from ATMStrategyCreate method but it seems there is some problem with the code. Can anybody correct the code so that it selects market/limit orders as a user variable.

    Code:
     
    //variables for ATM
     
    private string atmStrategyId  = string.Empty; // Variable to hold the atmStrategyId 
    private string orderId    = string.Empty; // Variable to hold the orderId
     private string aTMStrategy   = string.Empty; // select ATM strategy from your saved ones
     private OrderType typeEntry         = OrderType.Market; //select type of entry prder
     private int limitOffset             = 1;  // Limit order offset
     private int stopOffset             = 1;  //stop order offser
     
    //OnBarUpdate content
     
    AtmStrategyCreate(OrderAction.Buy, TypeEntry, (TypeEntry != OrderType.Market ? Close[0]+LimitOffset*TickSize : 0),
         (TypeEntry != OrderType.StopLimit ? 0 : (Close[0]+StopOffset*TickSize)), TimeInForce.Day, orderId,  
         "ATMStrategy", atmStrategyId);
     
    //properties panel
     
    [Description("Type of order to be placed")]
      [Gui.Design.DisplayName("\t\tATM Strategy, Order Type")]
      [Category("Parameters")]
            public OrderType TypeEntry
            {
             get { return typeEntry ; }
       set{typeEntry = (value == OrderType.Market ? OrderType.Market : (value == OrderType.StopLimit ? OrderType.StopLimit : OrderType.Limit));}  
      }
            [Description("Number of ticks for Limit Order from the trigger bar CLOSE (1 tick should equate to next bar open).")]
      [Gui.Design.DisplayName("\t\tOrder Offset, Limit")]
      [Category("Parameters")]
            public int LimitOffset
            {
             get { return limitOffset ; }
       set{limitOffset = value;}  
      }
     
       [Description("Number of ticks for the StopLimit Order Stop price from the trigger bar projected High or Low (1 tick should equate to next bar open).")]
      [Gui.Design.DisplayName("\t\tOrder Stop Offset, StopLimit")]
      [Category("Parameters")]
            public int StopOffset
            {
             get { return stopOffset ; }
       set{stopOffset = value;}  
      }

    #2
    Hello,

    Thanks for the note.

    Just to clarify is this for the entry order or for the stop loss and profit targets?

    I look forward to assisting you further.

    Comment


      #3
      Hi


      This is the entry order when ATM is called for.
      There is a variable ATMStrategy and TypeEntry for choosing ATM strategy and the market/limit/stop order on main strategy entry signal. It works with market or limit order only but I want to keep it selectable from these three orders.

      Comment


        #4
        Hello,

        Only recommendation I would have here in this case is to allow this is to have 2+ separate ATMStrategyCreate() calls. One for stoplimit, the other for stop market.

        Then when the user selects a mode, check that condition that the user selected. For example have the user set a string or a number to 1 for stop limits. the number 2 for stop markets.

        Then do an if statement to submit the correct order statement depending on the users selection.

        Let me know if I can be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X