• 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

Assigning SetParabolicStop to a variable

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

    Assigning SetParabolicStop to a variable

    I was using a strategy built by the Strategy Builder because I'm not even good enough yet to be considered a beginner programmer. This strategy uses a Parabolic Stop which gave me an error when running during a live trade due to the strategy trying to set a long stop loss above the current market price. I thought I would put an if statement in that would basically check to see if the new parabolic stop is above the current price if I'm in a long position (and below if I'm in a short position). If the new stop value is going to be above then close the position and wait for a new entry signal (same thing with a short).

    Right now I'm having a hard time assigning the value of the parabolic stop to a variable to be able compare it to the current market price. Any suggestions on how to do that?

    I'm also planning on getting through a series of else if statements to test the parabolic stop value with the last else line reading something like else SetParabolicStop(calculationMode.Ticks, XX); which I believe would set it to the same original value that I had applied to my variable for the test. Any problem doing it this way?

    #2
    Maybe I'm going about this all wrong. What I want to do is close my position of an order gets rejected but not the strategy. I want the strategy to keep working and enter any new points that fill my requirements. What would be the best way to do that?

    Comment


      #3
      Hello GMiller64,

      Thanks for your post.

      In the strategy builder you would not be able to assign the SetParabolicStop value to a variable.

      I suspect that the reason for the rejected order being placed incorrectly would be due to using the calculate mode of Calculate.OnBarClose. In order to use the SetParabolicStop() (or the SetTrailingStop()) methods, you would need the strategy to use the calculate mode of Calculate.OnPriceChange or Calculate.OnEachTick.

      From the help guide on the SetParabolicStop(): "Parabolic stop orders are modified based on the strategies 'Calculate' settings. In the case of 'Calculate' on bar close, when the bar closes the parabolic stop order modification will occur using the closing price of the bar as the reference price to apply the trail offset. Subsequently if the open price of the next bar is significantly higher or lower then the current close price then there is a possibility that the calculated parabolic stop price is now an invalid stop price. This is a risk with modifying any stop order closer to the current market price since any modification above/below the current price would be rejected." Link: https://ninjatrader.com/support/help...abolicstop.htm

      Paul H.NinjaTrader Customer Service

      Comment


        #4
        That makes sense. Thank you, I'll try that.

        Comment


          #5
          I thought about it a while and was thinking if I change to OnPriceChange then as the bar moves so will my parabolic stop potentially stopping me out prematurely. I've had plenty of times where the bar shoots up drifts back down before the close then the next couple of bars continue the trend. With the OnPriceChange I could potentially miss most if not all if those other trend moves. I have to think about that one.

          Comment


            #6
            Hello GMiller64,

            Thanks for your post.

            I would suggest testing using PlayBack>Market replay data. Once you find that situation you described, you can repeatedly test with different parabolic settings or determine that a parabolic stop is not what you need.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by faisamtrader, Today, 10:31 AM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_Tyler  
            Started by ChazJ, Today, 09:48 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by maxie, Today, 10:01 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Melissa  
            Started by Bionian, Today, 09:36 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by tomd, Today, 09:48 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_Ariana  
            Working...
            X