Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Just to be sure...

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

    Just to be sure...

    Hi there:

    I just want to be sure that this does says:

    if the stategy on this one instrument is below -$300 (negative -$300)...in other words, I do not have to use > correct (i.e. a greater negative number)...it is how it is written logically right? I am reading it as simply < (less than) -$300 (i.e. -$325 etc would trigger it)?

    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) < -300)

    #2
    Hello birdog,

    Thank you for your post.

    This will work as expected. If you enter '< -300' it will return the condition true for any currency value on your unrealized PnL of your position that is less than negative $300.

    For information on GetProfitLoss please visit the following link: http://www.ninjatrader.com/support/h...profitloss.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      thanks Patrick...

      Comment


        #4
        Can this be used for ticks?

        ie: PerformanceUnit.Ticks

        If not, if I used points what would that be fore FOREX movement vs. ES or CL ( pip vs tick using points)...would like to simply use Ticks though if possible...PerformanceUnit.Points

        Please let me know if I do use it will it be per "pip" for FOREX and per "tick" for like ES or CL.

        Greg
        Last edited by birdog; 03-01-2013, 01:33 PM.

        Comment


          #5
          The terms Pip and Tick are interchangeable
          MatthewNinjaTrader Product Management

          Comment


            #6
            Right...so, can I use "PerformanceUnit.Points" for calculating both a "tick" and a "pip" in code?

            Comment


              #7
              Hello birdog,

              Thank you for your response.

              That is correct.

              Comment


                #8
                ok...thanks...have a great weekend...

                Comment


                  #9
                  Hi:

                  Are you sure they are interchangeable (tick and pip and vice versa)? I have two separate pieces of code here that do not seem work with "Points".

                  I am seeing it that the 1st one should exit if the pips positive are greater than 10 pips. But it does not exit then.

                  The second one should exit if pips lost are MORE NEGATIVE than -13 pips.

                  What do I need to adjust to make both work properly using Points?

                  Both are just for exiting the long side but it applies to the short side too...

                  1st one is:

                  Code:
                  else if (Position.MarketPosition == MarketPosition.Long // TESTING Take Profit Exit LONG POSITION in case stop loss gets skipped, removed, or missed (but unrealized and realize total PNL account wide how to disable ALL if total PnL?)
                                      && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) > 10)
                                  {
                                      Print ("Take Profit Exit Long");
                                      ExitLong("Take Profit Exit Long", "");
                                      // OFF Disable();
                                  }
                  2nd one is:

                  Code:
                  else if (Position.MarketPosition == MarketPosition.Long // TESTING Unrealized PnL Emergency Exit LONG POSITION in case stop loss gets skipped, removed, or missed (but unrealized and realize total PNL account wide how to disable ALL if total PnL?)
                                      && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) < -13)
                                  {
                                      Print ("UnP Emr Exit Long");
                                      ExitLong("UnP Emr Exit Long", "");
                                      // OFF Disable();
                                  }

                  Comment


                    #10
                    Hello birdog,

                    Thank you for your response.

                    In both cases you will need to times the value by TickSize.
                    Code:
                    && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) > 10 * TickSize)
                    Code:
                    && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) < -13 * TickSize)
                    For information on TickSize please visit the following link: http://www.ninjatrader.com/support/h...7/ticksize.htm

                    Please let me know if I may be of further assistance.

                    Comment


                      #11
                      Patrick...Ok, the *TickSize worked.

                      Lastly, what exactly do I need to add to the code below to force it to take those same actions intrabar (I have the general strategy set to COBC True but want the actions below to take action intrabar)?

                      See below

                      Originally posted by birdog View Post
                      Hi:

                      Are you sure they are interchangeable (tick and pip and vice versa)? I have two separate pieces of code here that do not seem work with "Points".

                      I am seeing it that the 1st one should exit if the pips positive are greater than 10 pips. But it does not exit then.

                      The second one should exit if pips lost are MORE NEGATIVE than -13 pips.

                      What do I need to adjust to make both work properly using Points?

                      Both are just for exiting the long side but it applies to the short side too...

                      1st one is:

                      Code:
                      else if (Position.MarketPosition == MarketPosition.Long // TESTING Take Profit Exit LONG POSITION in case stop loss gets skipped, removed, or missed (but unrealized and realize total PNL account wide how to disable ALL if total PnL?)
                                          && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) > 10*TickSize)
                                      {
                                          Print ("Take Profit Exit Long");
                                          ExitLong("Take Profit Exit Long", "");
                                          // OFF Disable();
                                      }
                      2nd one is:

                      Code:
                      else if (Position.MarketPosition == MarketPosition.Long // TESTING Unrealized PnL Emergency Exit LONG POSITION in case stop loss gets skipped, removed, or missed (but unrealized and realize total PNL account wide how to disable ALL if total PnL?)
                                          && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) < -13*TickSize)
                                      {
                                          Print ("UnP Emr Exit Long");
                                          ExitLong("UnP Emr Exit Long", "");
                                          // OFF Disable();
                                      }

                      Comment


                        #12
                        Hello birdog,

                        Thank you for your response.

                        We have a reference sample that shows how to separate calculation logic between COBC = true and calculate on every tick at the following link: http://www.ninjatrader.com/support/f...ad.php?t=19387

                        Please let me know if I may be of further assistance.

                        Comment


                          #13
                          What about sample code that shows if COBC is defaulted to TRUE but you only want parts of the code to calculate on every tick (this sample has it reversed where the default is COBC False though and the adding FirstTickofBar etc ?

                          Originally posted by NinjaTrader_PatrickH View Post
                          Hello birdog,

                          Thank you for your response.

                          We have a reference sample that shows how to separate calculation logic between COBC = true and calculate on every tick at the following link: http://www.ninjatrader.com/support/f...ad.php?t=19387

                          Please let me know if I may be of further assistance.

                          Comment


                            #14
                            Hello birdog,

                            Thank you for your response.

                            You would just set CalculateOnBarClose as False and use the method for FirstTickOfBar for any calculations you need as COB = True.

                            Please let me know if I may be of further assistance.

                            Comment


                              #15
                              Yes, but how can I do it the other way around so I can backtest?

                              Is it not possible to do the other way around?

                              Also, if I have to do it the way the sample shows, then how can I backtest it cause COBC does not backtest?

                              Greg

                              Originally posted by NinjaTrader_PatrickH View Post
                              Hello birdog,

                              Thank you for your response.

                              You would just set CalculateOnBarClose as False and use the method for FirstTickOfBar for any calculations you need as COB = True.

                              Please let me know if I may be of further assistance.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              648 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              369 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              573 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              575 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X