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

RSqueeze signal

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

    RSqueeze signal

    Dear Cservice,

    I'm still struggling with the RSqueeze. I found the following plots for the indicator.
    Add(new Plot(_alertcolor, PlotStyle.Dot, "Squeeze"));
    Add(new Plot(_normalcolor, PlotStyle.Dot, "SqueezeOn"));
    Add(new Plot(_pmup, PlotStyle.Bar, "PMomentumUp"));
    Add(new Plot(_pmdown, PlotStyle.Bar, "PMomentumDown"));
    Add(new Plot(_nmup, PlotStyle.Bar, "NMomentumUp"));
    Add(new Plot(_nmdown, PlotStyle.Bar, "NMomentumDown"));

    However, when I use the CounterTrend mode I see different plots of wich I can't seem to find the plotname. In the picture you see 3 types of positive momentum en 3 types of negative momentum. Yet I only see the ones mentioned above. I want to know the name of the yellow plot in negative and positive momentum. I saw that red dots might influence the bars. But I still see the yellow plot with and without the red.dot squeeze alert.

    Can you please help me?
    Attached Files

    #2
    Hello Robert87,

    If you are only wanting to identify a marker by its color, you can look in the Indicators window and look for the colors that are set.

    Attached is a screenshot to demonstrate.

    Just a heads up, with the file that you have supplied, the colors are different. There is no beige or yellow color by default. If you are not setting this color yourself in the parameters, then likely you have a template that is setting this color.
    Because of this, I am not able to identify the color relation as you are not using the default colors (that I can see).

    Another screenshot is attached to show the default colors I am seeing on the chart.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply. I forgot to mention I'm using the CounterTrend mode. It is really hard to define the name of the 3rd color for the code. It looks like PMomentumUp can be negative, just as NMomentumDown can be positive.

      Comment


        #4
        Hello Robert87,

        Are you still attempting to identify which plot is which?

        Where you not able to find this information from the Indicators window?

        From what I can see, all of the plots in this script can be negative.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes, I''m still trying. When I use pmomentum up, it also entries on what should be NmomentumDown. I''m not able to give a specific buy and exit zone. So the system makes long trades while the momentum is clearly negative.

          Comment


            #6
            Hello Robert87,

            Just to clarify, you are actually creating a NinjaScript Strategy and you are calling the RSqueeze indicator, is this correct?

            You are using the value of one of the plots of this indicator in a condition that places an order, is this correct?

            Are you printing the value of the plot along with the time before you attempt to use the value in a condition?

            What is showing in the prints in the output window?

            Please post any debugging prints to your next post.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Im using the code
              RSqueeze(SqueezeStyle.CounterTrend).PMomentumUp[1] > 0 + a crossing = enter long
              I don't get why system trades on negative momentum beneith 0. It should go long only on green bars. That Is the idea.

              The code works, but iT does not do what I want.

              In the pictures you will find the zones in which it should trade long and short, triggered by a crossing. I have not started working on the short trades yet, untill I get things working on the short side. So for now it should trade on the dark green NMomentunUp and not on the Dark Red NmomentupUp.

              I've used the code mentioned above, and yet it trades even on NMomentumDown for some reason. In the second picture you will find the trades I'm trying to rule out.
              Attached Files
              Last edited by Robert87; 10-17-2015, 04:36 AM.

              Comment


                #8
                Hello Robert87,

                Thank you for the clarification.

                So you are looking for the previous bar of the PMomentumUp to be greater than 0, is this correct?
                (This would mean that the order would only be submitted when the bar after the PMomentumUp is greater than 0)

                Add a print to your code outside of any conditions:
                Print(string.Format("{0} | PMomentumUp[0]: {1}", Time[0], RSqueeze(SqueezeStyle.CounterTrend).PMomentumUp[0]));

                Compile and then re-run the script.

                Then pick a bar where you are expecting an order to be submitted and let us know the time of that bar.

                Last post the output from the output window so that we can see what the value of PMomentumUp is for that bar and for the previous bar.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Chelsea,

                  Sorry for the late response.

                  18-6-2015
                  25-9-2015

                  Thanks!
                  Attached Files

                  Comment


                    #10
                    Hi Robert87,

                    In your output I am seeing prints with an extra piece of information I am not recognizing.

                    7-4-2015 12:00:00 | PMomentumUp[0]: 3754,12

                    I have tested on my end using a 1 hour ES 12-15 chart using the same print and my prints appear as:
                    7/5/2015 5:00:00 PM | PMomentumUp[0]: 2041
                    7/5/2015 6:00:00 PM | PMomentumUp[0]: 2041.75
                    7/5/2015 7:00:00 PM | PMomentumUp[0]: 2043.75

                    There is no comma and second number in the output from my test.
                    May I have an export of the script you are using to make this print?

                    To export your script do the following:
                    1. Click File -> Utilities -> Export NinjaScript
                    2. Enter a unique name for the file in the value for 'File name:'
                    3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
                    4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


                    By default your exported file will be in the following location:
                    • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


                    Below is a link to the help guide on Exporting NinjaScripts.
                    http://www.ninjatrader.com/support/h...nt7/export.htm

                    Attached, is the test script I am using to test this print.

                    That said, it appears you have this on a 60 minute chart and assuming that the first number before the comma in your output is the PMomentumUp value, all of these prints are above 0.

                    If all of these prints are above 0, then it would place a trade on every bar.

                    Likely there is a switch. If criteria 1 is met, then the PMomentumUp is set, if criteria 1 is not met and criteria 2 is met then PMomentumDown is set. (Lines 240, 241, 256, 271, 280, 288, 300, these are all switches that will set one or the other (likely not both but I'm not sure).

                    When something is not set, the close price is returned (and thus the value is above 0).

                    You may add in a bool series to the script that lets you know which of these is set (true for up, false for down).
                    http://ninjatrader.com/support/helpG...ries_class.htm

                    You may also try checking if the PMomentumUp is equal to the close price. If it is, ignore that bar. (This would mean that if the PMomentumUp was by chance actually the close price, this may cause unwanted behavior)




                    What condition are you using to place the order?

                    if (RSqueeze(SqueezeStyle.CounterTrend).PMomentumUp[0] > 0)
                    {
                    EnterLong();
                    }

                    Is is something like this?

                    NinjaTrader has an Entries Per Direction setting that will only allow the set number of orders in the same position. Has your test

                    What are you referring to when you have + a crossing? Is this a variable that you have in your code?
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Dear Chelsea,

                      My NT has issues exporting, so I've attached the script in word.

                      The trigger should be the crossing, and the momentum should be the filter. However it's not filtering. It still enters when NMometumDown. The strange thing is that PMomentumDown < 0 is rising postive momentum. So I think the indicator is weighting the 4 momentums. I can't seem to find out how to call it and turn it into a code. Hope get my strange story.

                      It might be the HeikenAshi that has changed the log.
                      Attached Files
                      Last edited by Robert87; 10-22-2015, 08:58 AM.

                      Comment


                        #12
                        Hello Robert87,

                        If you are unable to export your strategy, is this because you are getting errors?

                        What errors are you getting? (These will appear in the Log tab of the Control Center)


                        I'm wanting an export so that I know that the actual code you are testing is the actual code that I have. (In other words there hasn't been a compile in the meantime as your script will not compile if there are errors)

                        The print in the code, will not make this output in the output window. Is this a different script that is printing to the log instead of to the output window? (Tools -> Output Window)


                        As I mentioned, this script likely does not set PMomentumUp below 0. From a look at the code it looks like PMomentumUp will never be below 0. If this is what your condition is looking for, it isn't to work.

                        I have suggested using a bool series to know if the PMomentumUp is being set or if the PMomentumDown is being set. Was this suggestion not able to accomplish your goal?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          It is the actual code and I'm able to compile. However when I try to export it says something like the namespace RSqueeze isn't found. Wich is strange as I didn't call it anything near that. (error CS0246).

                          I'm looking for positive moment from < 0. But not the Dark red kind, but the green kind. Only when it's darkgreen < 0 + crossing = enter long.

                          On the upside I need negative momentum down > 0, but not the green kind. I need the Dark red kind to enter short.

                          I've tried setting up a bool serie, but the code didn't work.

                          Comment


                            #14
                            Hello Robert87,

                            This raises some confusion.

                            Is the line using RSqueeze.Utilities; in the using statements of your script?
                            Are you calling RSqueeze(SqueezeStyle.CounterTrend).PMomentumUp[0] in your script?

                            If so, then you are definitely referencing the RSqueeze namespace. Are you meaning to call the RSQueeze indicator or were you looking for a different indicator?

                            The error is letting you know you need to add any files that are referenced to the script. Specifically, I think you need to also add the RSqueeze indicator to your export.

                            When you are mentioning colors, this doesn't help to specify what you are looking for. By default, the colors you are using are not set in the indicator. Instead of specifying colors, please specify the specific plot or plots.

                            If you are looking for a crossabove, then you need to use crossabove in your code. What series on the left are you looking to cross above and what are you looking for this to cross above?
                            Below is a link to the help guide on CrossAbove().
                            http://ninjatrader.com/support/helpG...crossabove.htm

                            For example:
                            if (CrossAbove(SMA(14), Close, 1))
                            {
                            // execute code
                            }

                            This would trigger anytime the sma with a period of 14 crosses above the close price.

                            What code did you add for the bool series? Is this giving you an error? What is the error message?

                            Did you follow the example in the help guide? (The example in the help guide is a working example and if copied exactly will work)

                            For example:

                            In #region Variables
                            private BoolSeries direction;

                            In Initialize():
                            direction = new BoolSeries(this);

                            In OnBarUpdate():
                            if (/* conditions to set the up plot */)
                            {
                            direction.Set(true);
                            }
                            if (/* conditions to set the down plot */)
                            {
                            direction.Set(false);
                            }

                            Then if this were a public series, you would be able to tell if the up plot or the down plot was the plot that was set.
                            Chelsea B.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by rocketman7, Today, 02:12 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post rocketman7  
                            Started by dustydbayer, Today, 01:59 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post dustydbayer  
                            Started by inanazsocial, Today, 01:15 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post inanazsocial  
                            Started by trilliantrader, 04-18-2024, 08:16 AM
                            5 responses
                            22 views
                            0 likes
                            Last Post trilliantrader  
                            Started by Davidtowleii, Today, 12:15 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post Davidtowleii  
                            Working...
                            X