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 charlesugo_1, 05-26-2026, 05:03 PM
                0 responses
                60 views
                0 likes
                Last Post charlesugo_1  
                Started by DannyP96, 05-18-2026, 02:38 PM
                1 response
                148 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 05-11-2026, 05:56 AM
                0 responses
                162 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 05-10-2026, 08:12 PM
                0 responses
                98 views
                0 likes
                Last Post CarlTrading  
                Started by Hwop38, 05-04-2026, 07:02 PM
                0 responses
                286 views
                0 likes
                Last Post Hwop38
                by Hwop38
                 
                Working...
                X