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

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.


        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




                  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.


                    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 Aviram Y, Today, 05:29 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Aviram Y  
                              Started by quantismo, 04-17-2024, 05:13 PM
                              3 responses
                              25 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by ScottWalsh, 04-16-2024, 04:29 PM
                              7 responses
                              34 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by cls71, Today, 04:45 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post cls71
                              by cls71
                               
                              Started by mjairg, 07-20-2023, 11:57 PM
                              3 responses
                              216 views
                              1 like
                              Last Post PaulMohn  
                              Working...
                              X