Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position not being closed in strategy analyzer

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

    #31
    Wouldnt be eaiser if you look into my strategy code?

    Comment


      #32
      Hello tkaboris,

      Looking at the code wouldn't tell me if the price crossed above the working price of the order.
      The code doesn't have the bar high low information of each bar, the code doesn't show at what price the parabolic stop order is working at.
      So for diagnosing an issue, only the output from prints and traceorders are going to show what happened.

      From the print output we can see the strategy submitted the order and we can see that it is working and the price it is working at.
      We just need to see the bar price to verify this rose above 15250.
      Previously these prints were in the output. Did you remove this print?

      The amount of prints would be due to using a set method which is updated with every bar update. When using Calculate.OnEachTick or .OnPriceChange instead of .OnBarClose there will be several prints for each bar.

      If the price rising happens further back than what can be shown in the output window, it might be necessary to write to file instead of printing, but I'd like to look and confirm first.

      Right now, it looks like after the parabolic stop order is submitted the market price never goes up to 15250 and the parabolic stop may be too far away.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #33
        From chart it looks price never went to 15250. but its because it seems that this parabolic price is getting updated on everybar
        It was suppose to close at 15150 and about 8 hours ago.

        Comment


          #34
          Hello tkaboris,

          The order is working at 15250 by the end of output so the price would have to come up to that.

          Perhaps you are placing the parabolic stop with too great of a distance in ticks.

          All set methods are updated on every bar. This is how the parabolic stop is able to trail following the parabolic logic.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #35
            Chelsea Can I ask you to run the strategy on your end? I am not placing too many ticks only 25 ticks on 500t chart MNQ. I am on it for 3 days now and cant fiture out

            Comment


              #36
              Hello tkaboris,

              To confirm, you are only calling SetParabolicStop once before the entry is submitted as advised in post # 8?

              Please provide the script with that code.

              Currently, in the file from your post # 28, this appears to be re-submitting SetParabolicStop after the entry and on every bar, resetting it to the current price on each new bar.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #37
                Hi Yes
                Here is my entry for shorts and I am not seting parabolic anywhere else for shorts only for longs
                if (UseParabolicStop){
                SetParabolicStop("StochFS", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);

                }

                EnterShort(PositionSize, "StochFS");

                if (UseParabolicStop){

                SetParabolicStop("StochFL", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);

                }

                EnterLong(PositionSize, "StochFL");​​

                Comment


                  #38
                  Hello tkaboris,

                  This appears to be nested in a condition that looks for the position to be long, meaning this would be submitted after the entry and not before.
                  if (Position.MarketPosition == MarketPosition.Long && myFreeTradeLong == true || StochSwingLong == true)

                  Have you added prints to confirm this line of code is only being called before the entry is called?

                  I don't mean that it's above it in the code, I am talking about the sequence of actions.

                  If the position is already long, then you would be calling this after the entry was submitted and filled.

                  Further, what is stopping this from being called on every bar?
                  Have you added a print to confirm this code is being called once before the entry is placed and is not being called again after the entry has been submitted?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #39
                    I tried commenting out the whole region of for shorts and becacuse I dont need it since I place setparabolicstop before the entry order. But it still gives out same results, cant close short orders.
                    if (Position.MarketPosition == MarketPosition.Short && myFreeTradeShort == true || StochSwingShort == true)

                    I dont know how to confirm this ..
                    Have you added a print to confirm this code is being called once before the entry is placed and is not being called again after the entry has been submitted?

                    Comment


                      #40
                      i am stuck for last 3 days..
                      longs are ok but when it comes to shorts they dont get closed and we can see it by big drawdown..
                      Longs are first in sequence and then shorts.
                      Click image for larger version

Name:	image.png
Views:	80
Size:	731.2 KB
ID:	1259478

                      Comment


                        #41
                        Hello tkaboris,

                        I have suggested that you call set methods before calling the entry and not in a separate condition set. Have you attempted this?

                        if (Position.MarketPosition == MarketPosition.Flat)
                        {
                        SetParabolicStop("StochFL", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);
                        EnterLong(PositionSize, "StochFL");​​
                        }
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #42
                          hi yes i did all that and tried other combinations.
                          I wanted to take your provided example for setparabolic stop example and see if it runs correctly in strategy analyzer but its not working for me in analyzer even thought it gets enabled in real time.
                          I think there is an issue with setparabolicstop running in strategy analyzer when running both longs and shorts

                          Comment


                            #43
                            Do you think you can try to edit setparabolicstop example to both longs and shorts and run it in strategy analyzer? to see if it works

                            Comment


                              #44
                              Hello tkaboris,

                              Which example?

                              Are you referring to the code sample from the help guide that is placed in State.Configure?
                              https://ninjatrader.com/support/help...abolicstop.htm

                              Are you referring to this example from Brandon?
                              https://forum.ninjatrader.com/forum/...11#post1236111


                              I think there is an issue with setparabolicstop running in strategy analyzer when running both longs and shorts
                              I will test on my end and let you know what I find. I appreciate your patience.
                              Chelsea B.NinjaTrader Customer Service

                              Comment


                                #45
                                I was referring to the one by brandon...

                                Are you referring to this example from Brandon?
                                https://forum.ninjatrader.com/forum/...11#post1236111

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by NullPointStrategies, Yesterday, 05:17 AM
                                0 responses
                                56 views
                                0 likes
                                Last Post NullPointStrategies  
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                132 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                73 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                45 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                49 views
                                0 likes
                                Last Post TheRealMorford  
                                Working...
                                X