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

Swing parameters

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

    #16
    Now your feeding in BarsArray1? What is the primary and what is the secondary bar series?

    Could be something to do with the MTF and its actually running on a secondary series you're not charting? Or are you?

    As far as checking how many bars back that swing low is you could do something simpler such as when the value changes mark that bar as the start of a new swing by storing "CurrentBar" into some variable. Then check against that variable versus current bar to see how many bars has passed since it was set?

    If still running into issue only thing you would be able to do is to take a look at the script running out of idea's with the information provided so far.

    Comment


      #17
      It's actually BarsArray[0] that I'm using in the script, not sure why I have been putting [1] on here, typo. Either way Primary is 5min, Secondary 1min. I looked at the 1min chart and it doesn't correspond to the swinglows there either. It's seem like the BarsArray is not functioning. I am using BIP == 1 because I want the trade to trigger off the 1min so that's why I was using BarsArray within Swing to make sure the swing is based off the 5min bars.

      How would I go about checking that the value changes? I assume you mean the value of the swinglow.

      Comment


        #18
        Hello,

        If you take away the secondary series and just run it on the primary does it work now or still no go? If still no go then I needed the script and settings so I could test on my side.

        Comment


          #19
          Also, you could track it manually via storing the last swing high/low price in some variable and checking on each new bar that the value is == to that. If it is != to that then it is a new swing low and you could then update that variable and then store that bar number in a variable. This is how you would track it manually.

          Note: However the swing indicator is a redrawing indicator which means as new data comes in the swing indicator will correct itself in historical. This is why its better to use the methods in the help guide versus tracking yourself due to this. (Unless you didn't want the redrawn values.). Swing indicator is one of the few indicators in NinjaTrader that do this.

          Comment


            #20
            I believe I tried changing the BIP to 0 the other day and it did work properly. But I need to have the secondary in there.

            Also BarsArray and BIP 1 works with the Value Syntax script so it seems like the issue is specific to the Bars Ago Syntax script. Maybe something to do with adding Math.Max is making it malfunction.

            I kind of give up on the Bars Ago Syntax. How would I go about checking that the value changes as you mentioned before? Then I will use CurrentBar to store.
            Last edited by zachj; 12-27-2013, 02:05 PM.

            Comment


              #21
              I gave it a try but I don't think I'm even close.

              The condition is if the recent 5min SwingLow[0] is above the previous SwingLow[10] and also less than .15 above previous swing than looking to store the current bar. Then I don't want it triggering a trade more than 2 bars past that stored bar. I'm getting so crazy trades though.

              if(Swing(BarsArray[0], 3).SwingLow[0] < Swing(BarsArray[0], 3).SwingLow[10] + .15 && Swing(BarsArray[0], 3).SwingLow[0] > Swing(BarsArray[0], 3).SwingLow[10])
              mySwing = CurrentBar;
              int barsSinceSwing = CurrentBar - mySwing;
              if(barsSinceSwing < 3)

              Comment


                #22
                Hello,

                Sorry for the delay on this replay.

                Without analyzing what you're seeing exactly I think you may be running into the limits of the swing indicator. This is a common theme of this indicator when used in strategies when getting weird results. As this indicator redraws previous values as it builds into the future. Which means you may get a signal, act on that signal on bar 100. Then at bar 105 the indicator has redrawin the past results and removed the signal at bar 100. So then when you look at the chart at bar 105 the result you see at bar 100 seems weird and strange.

                Swing and doncian channel are a couple of the only indicators that NinjaTrader ships with that redraw themselves.

                If you believe this is not what your running into if you can provide a simple backtest/strategy to support at ninjatrader dot com for me to analyzer the trade with what is expected vs what happens I would be able to give you a concrete answer.

                Comment


                  #23
                  I think I will just stay clear of the pivots, at least in the way I'm attempting to use them here. Thanks for the explanation. I was really just attempting to find some double bottoms or slightly higher lows.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  2 responses
                  29 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by Mindset, 05-06-2023, 09:03 PM
                  10 responses
                  263 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by michi08, 10-05-2018, 09:31 AM
                  5 responses
                  742 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by The_Sec, Today, 02:29 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post The_Sec
                  by The_Sec
                   
                  Started by tsantospinto, 04-12-2024, 07:04 PM
                  4 responses
                  63 views
                  0 likes
                  Last Post aligator  
                  Working...
                  X