Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Error when taking long position with bid price by ATM

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

    Error when taking long position with bid price by ATM

    Hi,

    I am getting the following error when try to take long position by ATM.

    Playback101, Buy stop or buy stop limit orders can't be placed below the market. affected Order: BuyToCover 1 StopMarket @ 80

    Code:
    void TakePosition()
    {

    Action<ErrorCode,string> callback = (atmCallbackErrorCode, atmCallBackId) => {
    if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
    isAtmStrategyCreated = true;
    };

    switch (GetBarStatus(CurrentBar))
    {
    case BarStatus.Falling:
    AtmStrategyCreate(OrderAction.Sell, OrderType.Limit, GetCurrentAsk(), 0, TimeInForce.Day, orderId, ATMName, atmStrategyId, callback);

    break;
    case BarStatus.Rising:
    AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, GetCurrentBid(), 0, TimeInForce.Day, orderId, ATMName, atmStrategyId, callback);

    break;
    default:
    break;
    }

    }

    #2
    The ATM strategy template specified by the string variable ATMName, what does it look like?

    Can you post a screenshot of that ATM strategy template's parameters?

    Comment


      #3
      Hi,

      when I use this template with SampleAtmStrategy, It is working but for me throwing the error.

      Comment


        #4
        Hello bosajin,

        You are using exact prices instead of a number of ticks or amount of currency?

        Are you certain that these are valid prices?

        A buy stop order must have the stop price above the market price.
        A sell stop order must have the stop price below the market price.

        What is the current price when the stop is placed at 80.00 and the target is placed at 60.00?
        Is this is a short entry order?
        Is the current price below 80.00?
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by WHICKED, Today, 02:02 PM
        2 responses
        6 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by selu72, Today, 02:01 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by f.saeidi, Today, 12:14 PM
        8 responses
        21 views
        0 likes
        Last Post f.saeidi  
        Started by Mikey_, 03-23-2024, 05:59 PM
        3 responses
        50 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by Russ Moreland, Today, 12:54 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X