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

Mark entries and exits points on candle

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

    Mark entries and exits points on candle

    I am looking for a simple indicator that places a hash mark at a specified number of pips above and below each candle, i.e. 2 pips, to mark entry and initial stop points and a second hash to mark a profit target, i.e. 35 pips, above and below each candle. This is to make it faster and easier to place orders at the correct price without having to figure it out in a hurry. I have searched and I can't program, does anyone know of this or could you make it? Thank you.

    #2
    vegasfoster, unfortunately I'm not aware of coding existing for this already. Depending on how strongly you wish to have it available, a NinjaScript consultant could help -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi vegasfoster,

      We have coded the indicator for you as a training exercise. It plots bands above and below candles at the specified intervals. By default these are at 2 and 35 ticks above and below, but you can change these values as you see fit.

      Click here for help on importing this indicator.
      Attached Files
      Ryan M.NinjaTrader Customer Service

      Comment


        #4
        Thank you!!!

        Comment


          #5
          Trying and failing to modify

          So, I decided to try to add to your indicator. I would like to show 2 ema's and when the price crosses through both of them, create an audio and visual alert. I created a strategy to do this; however, you can't place orders manually when a strategy is loaded. I added the user defined variables (only took a couple hours to figure out I needed to do that) and added the "///SHORT AND LONG EMA", "// Condition set 1", and "// Condition set 2" sections.

          But I keep getting 2 errors I can't get rid of. On lines 40 and 41, I get error codes CS1502 and CS1503. I know it has to do with adding or deleting "[0]", but I don't understand the explanation and I have tried all three variations and I get the same error, i.e.,

          "Add(EMA(Close, ShortPeriod)[0]);"
          "Add(EMA(Close[0], ShortPeriod)[0]);"
          "Add(EMA(Close[0], ShortPeriod));"

          On lines 72 and 81, I get error codes CS0103, and have no idea how to fix it.

          Any help would be great, thanks.
          Attached Files

          Comment


            #6
            Hello,

            I am sorry, can you paste you your code rather than a screen shot of it so I can test it in my machine? Thanks.
            DenNinjaTrader Customer Service

            Comment


              #7
              Hi Vegasfoster,

              The way you use the Add method here isn't supported for version 6.5. You need Add to create additional plots, but you're using it in an attempt to add EMAs. I would take a look at some of the built in indicators to see how add is used to add plots(plots are placeholders for values), and then the calculations are "Set" in the OnBarUpdate() method.

              If you need to create additional plots for your indicator, the Wizard is a great tool for this.

              After going through the Indicator wizard, you can unlock the code and then set your plots according to what you want. You can still setup your conditions and the actions to take when the condition is true.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                How Convert Strategy to Indicator?

                Thanks for responding. I am trying to learn how to program, but immediately I just want to be able to create indicators to generate conditional alerts for use in the market analyzer, e.g. for a simple pincher alert you need a ppo to cross above the signal line below the zero line with adx greater than 40. The problem is that the indicator wizard doesn't allow me to do this (not that I can figure anyway). The strategy wizard does, but you can't create alerts using strategies. So I would like to convert strategies to indicators, so the indicator creates a 0 for false and 1 for true, instead of plotting a line or other output, so that I can create an alert in market analyzer. Is there an easy way to do that? Thanks again.

                Comment


                  #9
                  Hello Vegasfoster,

                  Strategies can be used for alerts as well. They are built into the wizard as one of the default actions.

                  You may be intersted in looking at the first NinjaScript tutorial that does exactly this.


                  The tutorial walks you through the wizard to ultimately setup this line of code:
                  Plot0.Set(Open[0] == Close[0] ? 1 : 0);

                  The code above plots a 1 if the open = close, otherwise a zero. You may be able to adjust this to your needs.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    That worked, thanks.

                    Comment


                      #11
                      Sorry to be a pest, seems to work fine, but the visual alerts in the market analyzer are frequently disappearing before I can see them. I want the alerts to trigger in real time, so is there a way to build in a delay for the visual to stay for 300 seconds or so? I don't see it in the market analyzer settings, can it be done in the indicator itself? Thanks again.

                      Comment


                        #12
                        Hi vegasfoster,

                        Not sure how you have it setup. If you setup alerts in the Market Analyzer window, it writes to the alert display. This window updates as new alert conditions are raised. Click File > New > Alerts to see this window.

                        If you setup color conditions on the market analyzer, then this will color when the condition is true in real time. If you are watching it switch back and forth fast then this is because the condition is changing back and forth fast.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          That works better, thanks.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by DawnTreader, 05-08-2024, 05:58 PM
                          13 responses
                          44 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by jpeep, 08-16-2020, 08:31 AM
                          15 responses
                          497 views
                          0 likes
                          Last Post notenufftime  
                          Started by ldanenberg, Yesterday, 03:19 PM
                          2 responses
                          12 views
                          0 likes
                          Last Post ldanenberg  
                          Started by joselube001, Today, 12:17 PM
                          2 responses
                          12 views
                          0 likes
                          Last Post joselube001  
                          Started by arangocj, Today, 12:37 PM
                          1 response
                          21 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Working...
                          X