• 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

trouble using the "AtmStrategyCreate" within the Strategy

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

    trouble using the "AtmStrategyCreate" within the Strategy

    I'm having trouble using the "AtmStrategyCreate" within the Strategy.

    This is the correct syntax?
    AtmStrategyCreate (OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, GetAtmStrategyUniqueId (), "ATMGAMA" GetAtmStrategyUniqueId ()); ?

    When printing, for example:
    Print ("4 - Position size is" + GetAtmStrategyPositionQuantity ("ATMGAMA"). ToString ());

    The return is:
    NT ** ** GetAtmStrategyPositionQuantity () method error: AtmStrategyId 'ATMGAMA' does not exist

    Is one ATM Strategy named "ATMGAMA".

    What am I doing wrong?

    Thank you

    Osvaldo

    #2
    Hello Osvaldo,

    Thank you for posting and welcome the NinjaTrader forums!

    This message is telling you that the AtmStrategyId that you are trying to pass through the GetAtmStrategyPositionQuantity() does not exist.

    ATMGAMA is a Strategy Template not the ID for the order.

    The AtmStrategyId would be what you are passing through GetAtmStrategyUniqueId() in the AtmStrategyCreate().

    Try applying the UniqueId to a string variable such as -

    Code:
    string myStrategyId = GetAtmStrategyUniqueId();
    
    AtmStrategyCreate (OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, GetAtmStrategyUniqueId (), "ATMGAMA", myStrategyId);
    
    GetAtmStrategyPositionQuantity (myStrategyId). ToString ()
    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply, I will try to reword my question:

      I have a created strategy that generates input signals to buy or sell. When this strategy generates the signal , I want the be able to use the command ATMstrategyCreate(...) to buy or sell but referencing to the "ATMGAMA" that I have created at the SuperDom .
      So how do I refer the ATMGama on the Atmstrategycreate???
      Thanks

      Comment


        #4
        Osvaldo,

        You are already doing that in your code
        Help Guide -
        Code:
        AtmStrategyCreate(OrderAction action, OrderType orderType, double limitPrice, double stopPrice, TimeInForce timeInForce, string orderId, string strategyTemplateName, string AtmStrategyId)
        Yours -
        Code:
        AtmStrategyCreate (OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, GetAtmStrategyUniqueId (), "ATMGAMA", GetAtmStrategyUniqueId ())
        The issue is not the name of the template rather the ID string that you passing through with this -
        GetAtmStrategyUniqueId ()

        You need to get the same string used here and pass it through GetAtmStrategyPositionQuantity (),
        which I laid out in my first post.
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by johnnybegoode, Today, 11:35 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by NickyD, Today, 09:07 AM
        3 responses
        14 views
        0 likes
        Last Post NickyD
        by NickyD
         
        Started by 7robert, Today, 06:46 AM
        3 responses
        62 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by ElMagoR, Today, 07:49 AM
        4 responses
        31 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by Nabil, 09-13-2019, 11:44 AM
        5 responses
        35 views
        0 likes
        Last Post Nabil
        by Nabil
         
        Working...
        X