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 ZenCortexCLICK, Today, 04:58 AM
        0 responses
        5 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,280 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        8 views
        0 likes
        Last Post adeelshahzad  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X