Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Based on Ask Price

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

    #16
    Hello Valyo,

    I think that using SetTrailStop(double currency) also works, but you have to be careful about the price its given. This needs to be a price behind the market at the time of submission.

    If you were to set this in Initialize() the price is likely going to be wrong by the time the order is submitted. So it's important that if this is set, it is set just before (like one line before) the entry order is called.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Valyo,

      I think that using SetTrailStop(double currency) also works, but you have to be careful about the price its given. This needs to be a price behind the market at the time of submission.

      If you were to set this in Initialize() the price is likely going to be wrong by the time the order is submitted. So it's important that if this is set, it is set just before (like one line before) the entry order is called.
      I thought that currency in SetTrailStop(double currency) is the loss and not the price. At least this is the explanation in NinjaTrader help. Isn't it loss?

      Is it true that the offset for Trail Stop should be at least $0.01?
      I will calculate different offsets and I should add it to calculations.

      Comment


        #18
        I have another question about the prices.

        Is it possible to use both Bid and Ask prices with primary bars?

        For example I would like to make decisions based on Ask price and to buy at Bid price.

        Is it possible and how it could be done?

        Thanks,

        Valentin

        Comment


          #19
          Hello Valentin,

          Yes, this is possible.

          At any time you can call GetCurrentAsk() or GetCurrentBid() (or GetCurrentAskVolume() or GetCurrentBidVolume).
          http://www.ninjatrader.com/support/h...currentask.htm

          You can also get this from OnMarketData.
          http://www.ninjatrader.com/support/h...marketdata.htm

          You could also add a secondary series to the script and use MarketDataType.Ask.
          http://www.ninjatrader.com/support/h...s/nt7/add3.htm
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Thank you, Chelsea.

            Can I get last order filling price like this: Orders[Orders.Count - 1].AvgFillPrice ?

            Comment


              #21
              Hello Valyo,

              You can either make an IOrder and use the IOrder to get the AvgFillPrice or use the trade collection.


              IOrder myOrder = EnterLong();

              Print(myOrder.AvgFillPrice);

              http://www.ninjatrader.com/support/h...nt7/iorder.htm

              Or

              Print(Performance.AllTrades[Performance.AllTrades.Count-1].Entry.Order.AvgFillPrice);

              http://www.ninjatrader.com/support/h...collection.htm
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Thank you, Chelsea.

                Actually I want to know the filling price of trail stop, so it should be

                Performance.AllTrades[Performance.AllTrades.Count - 1].Exit.Order.AvgFillPrice

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                606 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                353 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                560 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                561 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X