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

Enter Long at concrete Price

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

    Enter Long at concrete Price

    Hello all.

    Im trying to set an entry price in a strategy whitch is above the current market price.

    When my strategy condition triggers, i would like to set the price above the current market price and also set the target and stop prices.

    Example:

    CUrrent market price: 64.00
    Strategy conditions trigger.
    Price to entry: 64.05 (id like to place a long limit order pending until the price reaches my order). If so, also place stop and target prices.

    If i try to use the EnterLongLimit, it enters at current price, not the above price.
    If i use enterlongstop the order becomes cancelled at the same time it fills.

    Thank you

    #2
    Hello motxu,

    This is correct. A buy limit cannot be placed above the market price.

    A limit order fills at the specified price or better. If a buy limit is above the market price, then the market price is a better price and the order will fill at the market price.

    A buy limit must be placed below the market price, a sell limit must be placed above the market price.

    A buy stop order must be placed above the market price, a sell stop order must be placed below the market price.

    If you want to place an order above the market price on the buy side, use a stop market (EnterLongStop()) or stop limit order (EnterLongStopLimit()).
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea.

      In my example, what would be the instruction?
      If I do EnterLongStop(64.05), I can see my order in Acepted status until the market price rise this value. My problem is that ther order goes to cancelled.
      I hace prints on every onbarupdate of my strategy and I can see the status of the order evolution:

      bar number 1000, order status: accepted
      bar number 1001, order status: accepted
      bar number 1002, order status: accepted
      bar number 1003, order status: working
      bar number 1004, order status: working
      bar number 1005, order status: cancelled

      I also try to call SetStopLoss and SetProfitTarget when I set the order with EnterLongStop and also when I see the status change. But always my order is cancelled. Qhat am I doing wrong?
      Same behaveior with EnterLongStopLimit(64.05, 64.05), beacue if I do EnterLongStopLimit(64.05, 63.9) the software breaks.

      Comment


        #4
        Hello motxu,

        The order is being cancelled due to the liveUntilCancelled not being used (which defaults to false).

        If an order is not filled on the bar it is submitted on without liveUntilCancelled being set to true, the order will be cancelled automatically.

        To keep the order alive you can re-submit the order using logic in your code, or you can unlock the script and use liveUntilCancelled as true.

        Below is a link to an example script that keeps a stop order alive by resubmitting this when a variable is above 0.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        6 responses
        23 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        13 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X