Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How is defined "point"?

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

    How is defined "point"?

    How is defined "point" in NinjaTrader.

    For example with Forex trading is 1 point = 1 pip?

    Thanks,

    #2
    Hello,

    This will depend on the specific instrument and is not the same as a pip. Pip is more closely comparable to ticks.

    To look at a specific instrument go to tools -> instrument manager -> type the instrument name into the name box and click search.

    For example 1 point in the ES is $50 or 4 ticks
    1 point in the $AUDUSD is $100,000 or 10,000 pips

    Pips/Ticks are both the smallest increment for a given market. NinjaTrader just calls them ticks as they have the same meaning



    Let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thank you Lance,

      I understand - the point is "is the smallest possible price change on the left side of the decimal point" and since 1 lot in $AUDUSD is $100 000, 1 point in $AUDUSD is $100 000.

      I have another question. I want to update my order quantity with the profit from previous trade.

      I have:

      Code:
      if(CurrentBar==2*longPeriod-1)[INDENT]
      {
      EnterLong(Instrument,orderQuantity,"EnterLongForexSignalName");
      }
      [/INDENT]
      else[INDENT]
      {
      ...
      ExitLong(Instrument,orderQuantity,"ExitLongForexSignalName","EnterLongForexSignalName");
      ...
      // Update orderQuantity here
      ...
      EnterLong(Instrument,orderQuantity,"EnterLongForexSignalName");
      ...
      }
      [/INDENT]
      It seems that the easiest way is to use Trade.ProfitCurrency.

      I found a sample code in NT Help for last trade:

      Code:
      Trade lastTrade = Performance.RealtimeTrades[Performance.RealtimeTrades.Count - 1];
      I thought that after first pair EnterLong - ExitLong the value of Performance.AllTrades.Count will be 1 or Performance.LongTrades.Count will be 1, but they are 0. And I have an error message, because

      Performance.AllTrades.Count - 1 = -1.

      How can I update orderQuantity?

      Comment


        #4
        Hello,

        This is a great resource example for using trade performance statistics: http://www.ninjatrader.com/support/f...ead.php?t=4084

        From the pseudo code i see here there is nothing stopping the performance from being checked on the very first bar before any trades have occurred.

        Try adding a print statement above where you expect the first trade and above the performance check. I'm guessing you'll see it print above the performance check before you see the entry print.

        Once you get the ordering setup you should then be able to update your order as desired. Again I strongly suggest using the above link for a starting example.

        Let me know if I can be of further assistance.
        LanceNinjaTrader Customer Service

        Comment


          #5
          Actually I have:

          Code:
          if (CurrentBar<2*longPeriod-1) return;
          
          if (CurrentBar==2*longPeriod-1)[INDENT]{
          EnterLong(Instrument,orderQuantity,"EnterLongForexSignalName");
          }[/INDENT]
          else[INDENT]{
          ...
          ExitLong(Instrument,orderQuantity,"ExitLongForexSignalName","EnterLongForexSignalName");
          ...
          // Update orderQuantity here
          ...
          EnterLong(Instrument,orderQuantity,"EnterLongForexSignalName");
          ...
          }[/INDENT]
          The performance is checked with CurrentBar>2*longPeriod-1 only.

          I will start with your link. Thanks.

          Comment


            #6
            Lance,

            I got it. I suppose that orders will be executed immediately and I try to use Performance.AllTrades.Count immediately. But usually orders are executed on the next day and Performance.AllTrades.Count is updated on the next day.

            The strategy works with one long position opened, then closed. I want to open a new long position after the previous is closed, after ExitLong is executed.

            Is there a way to check if the position is closed?

            For example, if I can count opened long positions and the count is 0, then I will know that ExitLong is executed and Performance.AllTrades.Count is updated. Is there any way to check it?
            Last edited by Valyo; 02-18-2013, 10:54 AM.

            Comment


              #7
              Hello,

              Glad to hear you got it working right.

              In terms of execution order, having a firm understanding of Calculate On Bar Close will help: http://www.ninjatrader.com/support/h...onbarclose.htm

              And realtime vs backtesting here: http://www.ninjatrader.com/support/h...ime_vs_bac.htm

              Forgot to link this earlier but quantities for FX trading will vary based on broker and when running backtests: http://www.ninjatrader.com/support/h...strategies.htm
              LanceNinjaTrader Customer Service

              Comment


                #8
                Lance,

                I edited my reply and I don't know if you receive messages about edited replies. Here it is again:

                The strategy works with one long position opened, then closed. I want to open a new long position after the previous is closed, after ExitLong is executed.

                Is there a way to check if the position is closed?

                For example, if I can count opened long positions and the count is 0, then I will know that ExitLong is executed and Performance.AllTrades.Count is updated. Is there any way to check it?
                Thanks,

                Comment


                  #9
                  You an check for market position along the way and this should allow you to filter trades accordingly.

                  Code:
                       if (Position.MarketPosition == MarketPosition.Flat) 
                          //do something


                  Additionally if you're looking to get into more advanced order handling the following is a great resource: http://www.ninjatrader.com/support/f...ead.php?t=7499
                  LanceNinjaTrader Customer Service

                  Comment


                    #10
                    Lance,

                    I tried Position.MarketPosition with backtest and it is always MarketPosition.Flat. Does it work with backtest?

                    Here is my output:

                    Market Position is Flat: True
                    Market Position is Long: False
                    Market Position is Short: False
                    CurrentBar is: 29 Current Date/Time is 16.1.2008 г. 00:00 ч.
                    ---
                    First bar is 29 First Date/Time is 16.1.2008 г. 00:00 ч.
                    First Instrument is $EURGBP Default
                    EnterLong(2, 100000, EnterLongForexSignalName);
                    ---
                    Market Position is Flat: True
                    Market Position is Long: False
                    Market Position is Short: False
                    CurrentBar is: 30 Current Date/Time is 17.1.2008 г. 00:00 ч.
                    ---
                    Market Position is Flat: True
                    Market Position is Long: False
                    Market Position is Short: False
                    CurrentBar is: 31 Current Date/Time is 18.1.2008 г. 00:00 ч.
                    Shouldn't it be MarketPosition.Long after EnterLong? EnterLong is executed on 17.1.2008 and MarketPosition is Flat after that.

                    Comment


                      #11
                      It does work in backtests as well.

                      Could you please provide the source file or simplified version that replicates the issue so that I may investigate further?
                      LanceNinjaTrader Customer Service

                      Comment


                        #12
                        Yes, here is a simplified code - attached.

                        The flow is:

                        1. EnterLong
                        2. If better Instrument is found and MarketPosition is Long, then ExitLong
                        3. If better Instrument is found and MarketPosition is Flat, then
                        3.1 update orderQuantity
                        3.2 EnterLong
                        Attached Files

                        Comment


                          #13
                          Thank you for the update.

                          When dealing with a multi instrument Strategy you will need to use Positions instead of Position
                          LanceNinjaTrader Customer Service

                          Comment


                            #14
                            So when I have

                            EnterLong(InstrumentIndex, ...
                            or
                            ExitLong(InstrumentIndex, ...

                            I need to use Positions[InstrumentIndex] with the same InstrumentIndex?

                            Comment


                              #15
                              Hello,

                              Yes that is correct, please let me know if I can be of further assistance.
                              LanceNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GussJ, 03-04-2020, 03:11 PM
                              11 responses
                              3,223 views
                              0 likes
                              Last Post xiinteractive  
                              Started by andrewtrades, Today, 04:57 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              438 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post FAQtrader  
                              Working...
                              X