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

Price Alert

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

    Price Alert

    I have a task: I need to modify stop order based on Price alert.
    As soon as current market price reaches predefined price - modify stop order.
    What are the ways to do that?
    So far I can see that I would have to connect to tick price data and check tick by tick if necessary price has been reached.

    I tried to find something in API which would allow to set up alert and then some callback that would be called on alert - but did not found .
    Is there any other built-in ways to do that?

    I can see PriceAlert indicator - but it would create alert for alert window, where I need to call some method of Strategy, that would modify stop order.

    I am new to NinjaTrader, did try to search this topic through search forum, but found no results, that will answer my question.
    I will appreciate any help.

    #2
    Hello Andreano,
    Welcome to the forum and I am happy to assist you.

    In managed order simply reassign the Set method again to change the stop price.

    For example if your initial stop is
    Code:
    SetStopLoss(CalculationMode.Ticks, 10);
    and you want to change the stop to breakeven when price reaches 10 ticks above your entry price then just reassign the Set method again.

    Code:
    if (Close[0] + 10 * TickSize > Position.AvgPrice)
    {
    	SetStopLoss(CalculationMode.Ticks, 0);
    }
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank you for your quick answer.
      I think I did not convey my question properly. My bad. My question wasn't about: How to modify order? - you have a pretty good documentation on this BTW - It was about how to set up price alert.
      For example, on start strategy enters some position, sets up some stop (or limit order) and decides (based on some formula), that when price reaches X, I need to modify this order .
      The thing here is that I need to modify order as soon as price is reached, I don't want to wait until some of my bars are closed.
      So my question what would be the ways to organize such price alert?
      Should I add 1 tick time-frame and check price with each new tick manually or there are more convenient ways to do that?

      Comment


        #4
        Hello Andreano,
        To assist you further may I know, have you set CalculateOnBarClose, to True or False.

        I look forward to assisting you further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          It is set to true.

          Comment


            #6
            Hello Andreano,
            Thanks for the confirmation.

            You can use the OnMarketData event to check for the current price and set any alert there and modify your exit orders.

            Please refer here to know more about OnMarketData.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Thank you for your help.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by geddyisodin, 04-25-2024, 05:20 AM
              8 responses
              61 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              4 responses
              3,288 views
              1 like
              Last Post jgualdronc  
              Started by Option Whisperer, Today, 09:55 AM
              0 responses
              5 views
              0 likes
              Last Post Option Whisperer  
              Started by halgo_boulder, 04-20-2024, 08:44 AM
              2 responses
              22 views
              0 likes
              Last Post halgo_boulder  
              Started by mishhh, 05-25-2010, 08:54 AM
              19 responses
              6,189 views
              0 likes
              Last Post rene69851  
              Working...
              X