• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Create stop order reference to Position Average Price

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

    Create stop order reference to Position Average Price

    trying to implement exit long stop market order using a reference to the Position Average Price

    Ie Close(0) Less than position average price, ExitLongMIT position average price -40 ticks

    or Close(0) greater than position average price + 50 ticks ExitLongStopMarket position average price +10 ticks

    #2
    And what problem are you having?

    Comment


      #3
      when i create the above conditions and then create action to exit at stopmarket price NOTHING happens the order either is not sending or the conditions are not recognized
      thanks

      Comment


        #4
        Hello DTSSTS,

        Thank you for your note.

        Add prints outside of the condition that print the time of the bar and all values used in the condition.

        Below is a link to a forum post that demonstrates how to use prints to understand behavior.
        https://ninjatrader.com/support/foru...121#post791121

        Please add prints to your script as demonstrated in the forum post I have linked and send the output from the script and I will assist in analyzing this output to understand the behavior.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          ok i tryed for 3 hours i get the orders to show in the print output but they do not trigger I have a stop at -45 ticks from position average and after +60 ticks above entry position average a BreakEven stop at position average -5 ticks

          they never actually fill

          AMGN 1-11-2019 entry at 199.29 long

          Thanks
          Attached Files
          Take screenshots, screen GIFs, and full page captures you can instantly share now and search later. Get the free app for Windows, Mac, and mobile.

          Comment


            #6
            UNH 1-16 Breakeven order shown in OutPut script but does not work. the overstop loss closed position at 259.04 you can see the breakeven order created at 259.64 as the price advance > .45 profit above position average price

            I am using a close[1] less or equal to 45 tick profit and a close[0] greater than 45 tick profit to create the order
            I assume it cancels when price falls

            (the post above on AMGN i had the stop lose created on Long Position that does not reference any price levels after entry long, so i do not know why they are not working)
            Attached Files

            Comment


              #7
              Hello DTSSTS,

              Please provide more information.

              What time is the order "AMGN 1-11-2019 entry at 199.29 long" submitted?

              What are the numbers in the output? Can you add labels to these as demonstrated in the videos I have provided that demonstrate using prints to understand behavior?

              What is the condition that is not evaluating as true?

              What are the values for that condition on the bar that you are expecting this to be true?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                i do not understand the print labels i will continue to try to figure out

                Comment


                  #9
                  i added many items to print but i am not seeing anything in the log


                  https://gyazo.com/124d4889817b4bf8e629b06c530f3f30

                  i also do not think any reference i make to Position.AveragePrice is working

                  Comment


                    #10
                    Hello DTSSTS,

                    Prints do not go to the Log tab of the Control Center. Prints go to the NinjaScript Output window.

                    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
                    Please see the video linked with the lablel 'NT8 Strategy Builder'. This is under the sentence 'If you are using the Strategy Builder in NinjaTrader 8, you can also build prints in the Actions window under Misc -> Print.'.
                    This video demonstrates how to print values to the NinjaScript Output window and include the time of the bar and a label for every value so we know what this value is.
                    https://ninjatrader.com/support/foru...121#post791121

                    If you have the NinjaScript Output window open do you see the prints when the script is re-run?

                    Are any errors appearing on the Log tab of the Control Center that is causing the strategy to be disabled?
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      i do not follow exactly what goes in the print script, i used the incorrect description of where they go, i do KNOW where they go and i see that output window
                      the above screenshot is my print settings but i do not see anything in the output showing what you need to help me

                      Comment


                        #12
                        Hello DTSSTS,

                        You are not seeing any prints appearing in the output window at all?

                        The strategy is showing a enabled?

                        No errors about the strategy being disabled are appearing in the Log tab of the Control Center?

                        Are the prints in a condition set that has conditions or have you placed this in a new condition set with no conditions as advised?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          no errors strat enabled, i do see prints, i do not see prints that have anything to do with the screen shot of settings i share above

                          i thought the screen shot was the settings you advised, but when i add prints i do not get any ability to see cross above etc, so i sure i do not have enough info in the print request

                          I do not understand what i am suppose to put in the print area

                          Comment


                            #14
                            Hello DTSSTS,

                            The print needs to be the values used in the condition set that you are interested in finding out if it has evaluated as true or false and why.

                            To simplify if my condition requires the open of the current bar to be less than the close of the current bar and no action happened, I would print the time, a label for the open, the open, a label for the comparison type, a label for the close, and the close.

                            For the condition:

                            if (Close[0] > Open[0])
                            {
                            EnterLong();
                            }

                            I would print:

                            Print(Time[0] + " | Close[0]: " + Close[0] + " > Open[0]: " + Open[0]);

                            The output would appear as:

                            2/14/2019 10:06:00 AM | Close[0]: 2746.5 > Open[0]: 2747

                            With this example the Close is 2746 and is easily recognized with the label. We see the greater than symbol so we know this needs to be greater than the next value. The next value is the Open at 2747. Since 2746.5 is not greater than 2747, on this bar the condition would be false and no order would be placed.


                            The print needs to print what is used in your condition set. This needs to be printed in a separate condition set with no conditions (so it prints for every bar)

                            This lets you know how the condition set will evaluate as true or false and will let you know why.


                            Do you have other prints added to the script? Perhaps those are the prints are appearing in the output window?

                            Is the current print you are making in a condition set that has absolutely no conditions added?
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              every thing i do is on renko bars so reference is to close

                              is the > just another string stand along line >

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by mestril, Today, 06:00 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post mestril
                              by mestril
                               
                              Started by Goolden, Today, 05:47 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post Goolden
                              by Goolden
                               
                              Started by kujista, Today, 12:59 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post kujista
                              by kujista
                               
                              Started by Gerik, Today, 12:14 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post Gerik
                              by Gerik
                               
                              Started by Bionian, Yesterday, 11:47 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Bionian
                              by Bionian
                               
                              Working...
                              X