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

How to scale in to position?

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

    How to scale in to position?

    Please show me how to use the wizard to simply add to a long position if my current unrealized pnl is in the red. So if MACD crossed above 0 I go long and if my current position is negative then wait for MACD to cross above 0 again and add to this position. Basically I want to average lower my current position price. Thank you

    #2
    relogical,

    How many positions are you looking to add here maximum? The wizard is a bit limited in this regard.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      I want to ad the default quantity.

      Comment


        #4
        relogical,

        Basically what I am asking is how many additional positions you want to add. In other words, how many positions will you have open at any 1 time running this strategy.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          One long and one short. I just want to add more to my current open position if Unrealized PnL is negative X dollars.

          Comment


            #6
            relogical,

            Ok, so you can check PnL in your condition builder and compare to numeric value. The issue here is that the strategy wizard uses the "managed approach" so what can happen is it won't let you open another position with the same signal name, or even another position with a different signal name depending on your entry handling.

            Here is more information on entry handling, I would suggest you read and try to understand because it can change how you implement this : http://www.ninjatrader.com/support/f...37&postcount=2

            Please see the screen shot for info on how to setup one and only one additional order via unique entry signal. In this case we would want EntriesPerDirection = 1, and Entry Handling set to "UniqueEntries".
            Attached Files
            Last edited by NinjaTrader_AdamP; 07-08-2012, 11:48 AM.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              But comparing Realized PnL would look at the entire profit instead of the Unrealized PnL. My overall profit could be positive but not my current long position. I want to add to my current long position if the Unrealized PnL is negative.

              Comment


                #8
                Relogical,

                If you notice in the screen shot, there is a "Unrealized profit" as well you could change the left hand side to in the condition builder.

                Please let me know if I may assist further.
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  If I use a negative number instead of a zero to add to my position if Unrealized PnL is negative $100 will it work? Example: Urealized PnL < -100

                  Comment


                    #10
                    relogical,

                    Yes, this will work. "Numeric value" can be negative or positive decimal numbers.
                    Adam P.NinjaTrader Customer Service

                    Comment


                      #11
                      IT's not working for me. Please help me to resolve this. My code is below:

                      Code:
                              /// <summary>
                              /// Called on each bar update event (incoming tick)
                              /// </summary>
                              protected override void OnBarUpdate()
                              {
                                  // Condition set 1
                                  if (Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) < -30)
                                  {
                                      Variable0 = 0;
                                  }
                      
                                  // Condition set 2
                                  if (Open[0] > Open[1])
                                  {
                                      EnterLong(PositionSize1, "");
                                      Variable0 = 1;
                                  }
                      
                                  // Condition set 3
                                  if (Variable0 == 1
                                      && Variable0 == 0)
                                  {
                                      EnterLong(PositionSize2, "");
                                      Variable0 = 2;
                                  }
                      
                                  // Condition set 4
                                  if (Variable0 == 2
                                      && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) > 2)
                                  {
                                      ExitLong("", "");
                                  }
                      
                                  // Condition set 5
                                  if (Variable0 == 1
                                      && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) > 2)
                                  {
                                      ExitLong("", "");

                      Comment


                        #12
                        relogical,

                        What isn't working here? I.e. what behavior are you seeing?
                        Adam P.NinjaTrader Customer Service

                        Comment


                          #13
                          If Unrealized PnL is below my set numeric value it does not add to my position.

                          Comment


                            #14
                            relogical,

                            Whats your "EntriesPerDirection" Setting when you run this?
                            Adam P.NinjaTrader Customer Service

                            Comment


                              #15
                              If you mean position size it is 2. When I enter long I want to add 2 more to my position if PnL is less then -200. I'm not getting this to work.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by marcus2300, Yesterday, 10:21 AM
                              6 responses
                              20 views
                              0 likes
                              Last Post marcus2300  
                              Started by skorpn, Today, 01:28 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post skorpn
                              by skorpn
                               
                              Started by ETFVoyageur, Today, 12:52 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post ETFVoyageur  
                              Started by Board game geek, Yesterday, 02:20 AM
                              2 responses
                              22 views
                              0 likes
                              Last Post Board game geek  
                              Started by jackiegils, Yesterday, 11:05 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post jackiegils  
                              Working...
                              X