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

    #16
    Hello DTSSTS,

    Typically scripts are not specific to bar types and can be used on any bar type. Renko bars also have an Open[0] and a Close[0] price. However, I was only giving you a demonstration on how to make a print that prints the values used in the condition.

    Your print must print the values that are in your condition.

    Yes, the parts in quotation marks are strings and are being used as labels. This includes the " > Open[0]: " string.

    This is the part you would type in the string box in the Print window as demonstrated in the video I have provided you (instead of clicking set and selecting an object value).

    Below is a link to the Microsoft documentation on strings.
    https://docs.microsoft.com/en-us/dot...eywords/string


    What is the condition you are creating the print for?

    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


      #17
      i will try to work on this tonight and reply

      Comment


        #18
        i tryed more print items I DO NOT GET IT and have zero clue what to do to print what is happening, I do know the the order is being created when it should be, after that i know it does not get sent




        this the action window





        sorry i cant get any more info. I have spent 6 hours per night for 5 days trying to get this to work

        Comment


          #19
          Hello DTSSTS,

          Looks like BreakEvenPositionLongBounceVL is a bool.

          When the bool is true the exit is placed. That is all there is in this condition set.

          You need to print the time of the bar, a label for BreakEvenPositionLongBounceVL, and the value of BreakEvenPositionLongBounceVL.

          Below is link to a video that demonstrates how to print this in the Strategy Builder.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            that is a group of conditions shown in the image

            PositionLongBounce-true (bool and correct)
            Position.MarketPosition=MarketPosition.Long
            Default input[0]> (Position.AveragePrice + (45 - TickSize))
            BreakEvenLongBounce=true

            this creates the order

            I added the BreakEvenLongBounce=true SO THAT ONCE the action is created it become false so when the Default input[0] becomes less that +45 ticks the order will not cancel

            I have tryed this many many many many different ways with and with out the last bool

            Comment


              #21
              this is another that does not work and is just placed just after a long position is created as a StopLoss and can be unique for different entry signals which would then allow the use of a trailing stop in general settings and the breakeven would not be an issue

              the StopLoss is very simple



              it only had 1 bools and looks for a long position

              PositionLongBounce-true (bool and correct)
              Position.MarketPosition=MarketPosition.Long
              OrderStopLossLongBounce=true

              to create the order action to to set the ExitLongStopMarket order

              again the lower bool does not have to be used, i was just trying different conditions since the orders were not stopping out the position

              Comment


                #22
                i believe i am doing something very basic incorrectly. Any of the condition sets i have tried to implement create orders (or appear to) but they never submit for what ever reason that i am not doing correctly

                Comment


                  #23
                  Hello DTSSTS,

                  I have created a new video that demonstrates prints for the conditions in the condition group.


                  As there are no other groups in this condition set, a condition group is not needed.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #24
                    NO way to figure that out with the spaces and & etc 0 tyvm for the vid




                    CHART SHOWS Long Position VLST 266.85 the Stop Loss shown is 100 ticks from the general StopLoss

                    Our BreakEvenVLST should be at 266.80 as we have order at AveragePositionPrice -5 ticks

                    Attach in Print file

                    Date Jan 29 10:23 am entry long d- about 10:48 would have been exit time at the price of 266.80

                    Attached Files

                    Comment


                      #25
                      Hello DTSSTS,

                      As a heads up, the output in the text file ends on Feb 14th, while the screenshot shows the chart ending on Jan 29th. This may indicate the chart does not match the output. So we can ignore the chart and focus on output only.

                      To confirm the bar in question is 10:48:26 on Jan 29th?

                      The output at that time is:
                      1/29/2019 10:48:26 AM PositionLongBounce: True = true & MarketPosition: Long = Long & Close[0]: 266.6 > (AveragePrice + (45 * TickSize)): 267.3 & BreakEvenLongBounce: True = true

                      Looks like the Close at 266.6 was not greater than the entry plus 45 ticks at 267.3.

                      So this explains why the condition did not evaluate as true on the bar you are expecting.

                      Maybe try less distance?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #26
                        regardless off the distance that created the order once the price advances if you are creating a breakeven area stop, of course the current price will be below the +45 tick advance that created the order in the first place

                        instead of close > averageprice +45 ticks , maybe need to some how reference High since entry > averageprice +45 ticks, then the order would not cancel or not be submitted

                        NOT sure how to create that type condition about the high since i would include more that 1 bar closing for that to happen

                        Comment


                          #27
                          Hello DTSSTS,

                          I'm not sure I am understanding.

                          The condition is not evaluating as true.
                          The condition is not evaluating as true because 266.6 is not greater than 267.3.

                          Are you asking how to code if the high of the previous bar is greater than the average price plus 45 ticks?

                          if (High[1] > AveragePrice + (45 * TickSize))
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #28



                            i tried H4 >= which on this jan 31 entry was over 100 ticks and true, still no trigger of the stop order






                            Comment


                              #29
                              Hello DTSSTS,

                              If the condition did not evaluate as true then no action would be placed.

                              What bar time is the bar in question?

                              What are the values of Position.MarketPosition, High[4], and Position.AveragePrice + (65 * TickSize) on that bar?
                              Chelsea B.NinjaTrader Customer Service

                              Comment


                                #30
                                1/31 10:48 is the time should have filled stop at 270.06

                                output print attached
                                Attached Files

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                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
                                5 views
                                0 likes
                                Last Post cls71
                                by cls71
                                 
                                Started by mjairg, 07-20-2023, 11:57 PM
                                3 responses
                                214 views
                                1 like
                                Last Post PaulMohn  
                                Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                                4 responses
                                547 views
                                0 likes
                                Last Post PaulMohn  
                                Working...
                                X