Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

vol bars up down

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

    vol bars up down

    Hi,

    I am trying to "code" something and cant figure out how to set if volume up down is above x then enter
    so for example if the 5 min chart is above 20000 then enter long also this need to only be for longs ie green bars

    any help would be great thanks

    #2
    Hello minip,

    Thank you for your post.

    This could be accomplished using the Strategy Builder. In the Strategy Builder's Conditions and Actions screen, you would create a condition that checks if the UpVolume plot of the Volume Up Down indicator is greater than 20000. To have your entry occur for only up bars you could add a condition that checks if the Close is greater than the Open. Then you would call EnterLong for your Action. Once your strategy is created, you would enable it on a 5-minute chart.

    To see the code that accomplishes this, you would click the 'View code' button in the Strategy Builder.

    See the attached strategy that demonstrates how this would be accomplished.

    Also, see the help guide documentation below for more information about making indicator to value comparisons in the Strategy Builder.
    Indicator to Value comparisons - https://ninjatrader.com/support/help...lueComparisons

    Let us know if we may assist further.
    Attached Files
    Last edited by NinjaTrader_BrandonH; 02-09-2021, 11:20 AM.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      thanks for the quick reply that helps alot, next question would be how would i make it so there is only 1 entry a day? I figured out how to do the one trade a day but not how to reset it. For example I am testing 30 days worth of data on the first day it got an entry but then after that it did not trade. Is there a way to reset this value each day or after a certain time ie RTH close?



      Thank you!
      Last edited by minip; 02-09-2021, 12:59 PM.

      Comment


        #4
        Hello minip,

        Thank you for your note.

        To accomplish this you could use a bool that is initially set to true. You would check if the bool is true in your order entry conditions followed by setting the bool to false after the trade is placed. Then, you would create a set that checks if IsFirstBarOfSession is true and sets the bool to true. IsFirstBarOfSession is found under the Misc folder in the Strategy Builder.

        For example, if the bool is true in your entry conditions, call EnterLong and set the bool to false. Then, check if IsFirstBarOfSession is true and flip the bool to true. This would ensure that only one trade is placed since the bool must be true to place the order. The bool is the reset on the first bar of a new session.

        See the help guide documentation below for more information.
        IsFirstBarOfSession - https://ninjatrader.com/support/help...rofsession.htm

        Please let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          could you elaborate on this? I have the bool set to true but am having a hard time from there.

          Are you saying go to add in the first box of conditions > user variables>(true bool what i named the bool) > not equal> true > okay

          if you could break these steps down to an elementary level that would be awesome. I follow you but having an issue of implementing it

          Thanks

          Comment


            #6
            Hello minip,

            Thank you for your note.

            Please see the attached strategy that demonstrates how to accomplish this. First, we create a bool that is initially set to true. In set 1 we check if the Close is greater than the Open for our entry condition. We also check if the bool is true. In the Actions section we call EnterLong and flip the bool to false. In set 2 we check if IsFirstBarOfSession is true and if our bool is false. In the Actions section we flip the bool to true.

            Let us know if we may further assist.
            Attached Files
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              Brandon,

              That did not work now there are 0 trades showing, I tried adding your start to mine and adding mine to the one you attached and it still did not work. If I delete it then I get trades just multiple times a day. Any suggestions?

              Thank you,

              Comment


                #8
                Hello minip,

                Thank you for your note.

                I have tested the EnterOnceDaily script on my end and trades are being placed on the first up bar of each new session. After the trade is placed, the bool is flipped to false and is not flipped to true until there IsFirstBarOfSession becomes true. See the attached screenshot that demonstrates this. Please note that this script is meant to be an example and not a fully working strategy.

                If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true or the order is being ignored for other reasons.

                To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

                In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

                Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

                If you are unable to determine why an order is not being placed after adding prints, you could enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

                Below is a link to a forum post that demonstrates using prints to understand behavior and including a link to a video recorded using the Strategy Builder.
                https://ninjatrader.com/support/foru...121#post791121

                Please let me know if I may further assist
                Attached Files
                Last edited by NinjaTrader_BrandonH; 02-10-2021, 08:47 AM.
                Brandon H.NinjaTrader Customer Service

                Comment


                  #9
                  here is what I have, I dont see what is holding it up

                  Comment


                    #10
                    Hello minip,

                    Thank you for your note.

                    I see you have not added debugging prints in your strategy to understand why the strategy is not placing trades.

                    It is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

                    In the strategy add prints that print the values of every variable used in every condition that places an order along with the time of that bar. See the video in the forum link in my previous post that demonstrates how to use prints in the Strategy Builder to understand how your script is evaluating.

                    Please note that in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services in our support. This is so that we can maintain a high level of service for all of our clients as well as our partners.

                    Let us know if we may assist further.
                    Brandon H.NinjaTrader Customer Service

                    Comment


                      #11
                      thanks for the help, couldn't get this to work so I did all the calculations by hand the last think I am looking for is an entry signal so for example
                      vol above xyz and ema at xyz then draw a rectangle around entry signal and it also shows the past 100 entries. any help on getting this setup? Every time I try to add the drawing in the entry signal the trigger to buy seems to get ignored.

                      Comment


                        #12
                        Hello minip,

                        Thank you for your note.

                        To accomplish your goal, you would need to unlock the code of your strategy from the Strategy Builder by clicking the 'Unlock code' button.

                        Please see the code example below that demonstrates placing an entry order when our order entry conditions become true and drawing a rectangle around that entry order.

                        Code:
                        if ((VolumeUpDown1.UpVolume[0] > 350)
                          && (EMA1[0] > Close[1]))
                        {
                            EnterLong(Convert.ToInt32(DefaultQuantity), @"longEntryOrder");
                            Draw.Rectangle(this, @"MyCustomStrategy1 Rectangle_1 " + Convert.ToString(CurrentBars[0]), false, 2, (Low[0] + (-2 * TickSize)) , -2, (High[0] + (2 * TickSize)) , Brushes.CornflowerBlue, Brushes.CornflowerBlue, 0);
                        }
                        Also, see this help guide documentation for more information about Draw.Rectangle: https://ninjatrader.com/support/help..._rectangle.htm

                        Then you would be able to scroll back on the chart to view the rectangles where your past entries were placed.

                        Please let us know if we may assist further.

                        Brandon H.NinjaTrader Customer Service

                        Comment


                          #13
                          I did this and compiled and now its not showing up under strategies when I try to test it or add it to a chart, I understand it cant go back into the wizard once you open the code but you have to be able to test this or apply it to a chart.

                          Comment


                            #14
                            Hello minip,

                            Thank you for your note.

                            This likely means that there is an error in the OnStateChange() section of your code.

                            Please see the attached strategy example that demonstrates applying the above code sample to a strategy.

                            Let us know if we may assist further.
                            Attached Files
                            Brandon H.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by nutmame1, Today, 08:26 PM
                            0 responses
                            8 views
                            0 likes
                            Last Post nutmame1  
                            Started by dr0832, Today, 07:02 PM
                            0 responses
                            13 views
                            0 likes
                            Last Post dr0832
                            by dr0832
                             
                            Started by mlurskint8, Today, 05:27 PM
                            3 responses
                            19 views
                            0 likes
                            Last Post NinjaTrader_ShawnB  
                            Started by SteveTheCPA, Today, 04:54 PM
                            0 responses
                            10 views
                            0 likes
                            Last Post SteveTheCPA  
                            Started by Unsuitable, Today, 02:42 PM
                            2 responses
                            14 views
                            0 likes
                            Last Post Unsuitable  
                            Working...
                            X