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 samish18, Today, 11:26 AM
        0 responses
        1 view
        0 likes
        Last Post samish18  
        Started by Trader146, 03-29-2024, 01:22 PM
        2 responses
        14 views
        0 likes
        Last Post Trader146  
        Started by tsantospinto, 04-12-2024, 07:04 PM
        7 responses
        126 views
        0 likes
        Last Post aligator  
        Started by futtrader, 04-21-2024, 01:50 AM
        5 responses
        56 views
        0 likes
        Last Post NinjaTrader_Eduardo  
        Started by PeakTry, Today, 10:49 AM
        0 responses
        2 views
        0 likes
        Last Post PeakTry
        by PeakTry
         
        Working...
        X