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 rdtdale, Today, 01:02 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        18 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        9 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        41 views
        0 likes
        Last Post love2code2trade  
        Working...
        X