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

Version of 5 min VolStop for 1 min chart

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

    Version of 5 min VolStop for 1 min chart

    On a 1 min chart I want to plot the value of Vol Stop from 5 minute data i.e. vol stop values from a 5 min chart plotted on the 1 min chart.
    Curr 5min vol stop value to be based on the most recently completed 5 min bar i.e. the value would not change for 1 min bars within the same 5 min bar.

    I copied the Vol stop indicator and changed it to use 5 min data.
    Main changes that I made to make it multi timeframe were to use:
    Closes e.g. Closes[1][0]
    *ATR(BarsArray[1],aTRperiods

    I am not sure about:
    SignalClose = MIN(Closes[1],(aTRperiods))[0]; if that should be [1];
    Plotset.Set(SignalClose + (aTRmultiplier*ATR(BarsArray[1],aTRperiods)[1]));
    I am not sure if it should be [1])); or [0]));
    Also how to solve the issues below.
    Issues
    Flipping when it should not and sometimes value changes within the same 5min bar.

    Tried various ideas to fix it but I have not come up with the right code yet.
    Could someone please assist to debug it.
    Files with original code and my 5 min version are attached. Screen shot also attached.
    Attached Files
    Last edited by skiguy; 09-19-2016, 02:01 AM.

    #2
    Hello skiguy,

    Thanks for your post.

    If I may suggest there is another approach that does not require (re)coding that may meet your needs.
    Basically you would add a 5 minute data series to the chart, hide the 5 minute data series then add the indicator and set the input of the indicator to the 5 minute data series. This will provide the 5 minute indicator output on the 1 minute chart.

    The process is pretty straightforward to do this and I've made a short how to video: http://screencast.com/t/rqm6I5CMjzD
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul for your suggestion. The short video was a superb idea as it made it crystal clear what to do.

      I have done that and I will verify against my 5 min chart "flips" for 9/16.

      There first thing that comes to mind is that NT uses bar close as the time hence 0600 5min chart flip could not happen until close of 0600 1 min bar for example. So if 0559 close exceeds buy stop but 0600 does not then there would not be a "flip" to long as the 5 min bar does not close until end of 0600 bar.

      Expressed more generically, NT 5 min bar close is at ..05, ..10, ..15 etc

      Hence at ..06 (for example) code should not be considering if there is a "flip" as it is not relevant.

      Hope that makes sense.
      Last edited by skiguy; 09-20-2016, 02:19 AM.

      Comment


        #4
        If I look at your chart, I am seeing strange things. In my opinion

        - A stop should not move away from price, while price moves away from the stop. I would rather leave it in place.

        - Also a stop should not make giant leaps towards price, when price does not move. Otherwise you will be stopped out, because the stop has moved towards price, not because the price has moved. You can see such leaps on the right hand side of both your charts. In both cases these leaps would have taken you out of a profitable position.

        When correctly coded a stop does not move away from price. Also it should not cut into price.

        Then there is no need to use a higher timeframe data series to code a volatility based stop. If you wish to calculate the stop from a 5 min chart and apply it to a 1 min chart, it is possible to approximate the 5-min ATR by multiplying the 1-min ATR with a factor f = sqrt(5) = 2.24,

        Below is a chart with a Chandelier Stop applied. I have applied it to exactly the same bars that you have posted.

        I have used a ATR(25) on the 1-min chart (reference period 25 mins equivalent to an ATR(5) on a 5-min chart). The ATR multiplier is 1.5 and the conversion factor 2.24. This makes up for a composite multiplier m = 1.5 * 2.24 = 3.36.
        Attached Files

        Comment


          #5
          Thanks Maestro Harry.

          Absolutely agree it should not move away. That was one of the issues I observed and was the major giveaway that my coding was flawed

          I will try your solution.

          Comment


            #6
            Hi Harry,

            When I try to download the file I get the following:

            "It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help"

            I will send you an email as well. Posting here in case you see this first.

            Comment


              #7
              I want to publically acknowledge Harry's contribution. He fixed the broken link the same day I drew it to his attn and thanked me for highlighting that it did not work.

              I was trying to replicate the Vol Stop indicator from CQG platform which works as you would expect (see Harry's comments on odd behaviour versus what one should expect).

              The base Vol Stop I had downloaded for NT had flaws that were made even more obvious on higher timeframe.

              Harry's version works as he described and by using my own inputs I can replicate what I see in CQG which is what my original goal was. His version also has many other nice options such as displaying arrows etc.

              I found his tip on the sqrt to be a good one also. It does not totally replicate what happens on the higher timeframe exactly but it is very close. IIRC Harry even called out that it would not replicate exactly.

              The indictor loads instantly on my laptop which suggests efficient coding.

              He really goes the extra mile. Thanks again Harry.

              Comment


                #8
                @skiguy, are you able to share the updated volstop indicator code?

                Thank you

                Comment


                  #9
                  Originally posted by wsDK_II View Post
                  @skiguy, are you able to share the updated volstop indicator code?

                  Thank you
                  Go to Harry's site (http://www.lizardtrader.com) and become a member (it is free) then you will be able to download his indicator.It is under trailing stops.
                  Last edited by skiguy; 09-26-2016, 09:56 PM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by thanajo, 05-04-2021, 02:11 AM
                  3 responses
                  467 views
                  0 likes
                  Last Post tradingnasdaqprueba  
                  Started by Christopher_R, Today, 12:29 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post Christopher_R  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  166 responses
                  2,235 views
                  0 likes
                  Last Post sidlercom80  
                  Started by thread, Yesterday, 11:58 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post thread
                  by thread
                   
                  Started by jclose, Yesterday, 09:37 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post jclose
                  by jclose
                   
                  Working...
                  X