Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Newbie needs help

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

    #16
    Alright got it! Thank you for your patience.

    Now the next step was to use the 15min 5ma along with my enterLong strategy.

    I was able to code this but there seems to be an issue.
    For the 5-minute chart conditioins i need to have the last 2 candles plus the current 5-minute candle low to be >= the 5-minute sma.

    For the 15-minute chart condition, I need to have at least the current candle low to be >= the 15-minute 5ma.

    However, it will only trigger the long if all the 15-minute candle lows are >= the 15-minute sma within the whole condition of the 5-minute.

    I need it to trigger as long as the current 15-minute low >= the 15-sma regardless if the previous 15-minute low is not greater than the previous 15-minute sma while it is still calculating the 5-minute condition.

    This may sound confusing so I added some images. Hope this helps.
    Attached Files

    Comment


      #17
      Hello dorony,

      You are still using Low rather than Lows to specify the bar index. Please see my post here You should either use BarsInProgress to control...
      Support for the development of custom automated trading strategies using NinjaScript.


      With multi series scripts you need to explicitly refer to a series using lows/closes/highs or use Bars in progress.

      Please read through the following link,


      Please let us know if you need further assistance.
      Alan P.NinjaTrader Customer Service

      Comment


        #18
        Hmm..

        Even if the code is based on the 5minute chart which is the primary chart?

        Comment


          #19
          Hello Dorony,

          Correct.

          Low[0] is going to be the low of whichever bars series is called in OnBarUpdate, so without using Lows[0][0] to specify which index or using BarsInProgress to restrict a block from running from other series, you script will not work as expected.

          Please see the following three links where this is explained in detail.







          Please let us know if you need further assistance.
          Alan P.NinjaTrader Customer Service

          Comment


            #20
            Hey Alan,

            I am having issues comprehending this.

            Is it possible for you to correct my code so that I can see how it should look. I learn faster and better when I have the actual code available and get to see how it should look .

            When i swtich it to Lows[0][0] and Lows[0][1] and so on, it begins to give me a "double" error.

            Are you allowed to help me fix the code or not?

            Comment


              #21
              Hello dorony,

              Thank you for your response.

              Please attach your code to your response. Please also provide an example of the code when it gives you the "double" error.

              You can export your strategy by going to Tools > Export > NinjaScript Add On > Add > select your strategy > OK > Export > name the file 'NTsupport' > Save.

              The file will be located under Documents\NinjaTrader 8\bin\Custom\ExportNinjaScript. Please attach the file to your response.

              I look forward to your response.

              Comment


                #22
                Hey Alan,

                I provided two files.

                One without the Lows or Highs

                and one with Lows and Highs (plural)... For some reason when I added them back today, I didn't get the error that I usually get about the double, but decided to provide you with both since they both don't work as they should.

                Looking forward to seeing it work and how so that I can learn and move forward.

                I think maybe because I didn't index the SMA5 as SMA5[0][1] and so. I only indexed in plural the Lows or Highs.
                Attached Files
                Last edited by dorony; 02-02-2018, 12:49 PM.

                Comment


                  #23
                  Hello dorony,

                  Thank you for your response.

                  I am not seeing the issue here. The condition seems to be setup properly in the strategy you provided that uses the Lows and Highs properly.

                  Please let me know if you have any questions.

                  Comment


                    #24
                    Hey Alan,

                    Thanks. But its not working properly.

                    For the trade to execute, it must require that all the 15-minute candles are holding above the 15-min 5sma within the process of the 5-minute code.

                    For example, let's say that at 10:10 through 10:20 the 5-minute code is active but the 15-minute min candle at 10:10 is not holding the 5sma but then on the new 15-minute candle at 10:15 the 15-minute 5ma is holding it will not trigger a long. That's because it is looking for both 15-minute candles to be true.

                    When in fact I only need the 15-minute 5sma to be greater or equal for the last 5-minute candle confirmation. Not all three candles.

                    Does this make sense. Please look at the 2 images I sent previously and let me know if you need more clarification on this.

                    Once again, thank you for helping.

                    Comment


                      #25
                      Hello dorony,

                      Thank you for your response.

                      I am advising to you that this strategy is working on my end. Please see my video at the following link for a demonstration: https://patrickh-ninjatrader.tinytak...QwNl83MTExNTY1

                      Comment


                        #26
                        Thank you for creating the video and putting in immense effort.

                        You may be right but I keep getting stumped on why this example isn't showing an entry.

                        I added a video myself to show you where I think an entry should have been but wasnt.

                        The example you gave me, had multiple 15-minute candles supporting the 5ma within the 5min series.

                        However, the video I provided, only the last 15minute candle supported the 5ma but within the 5min series. The previous 15-minute candle didn't hold and I think that is why it didn't trigger a an entry.

                        Should I maybe explain my strategy in logic form instead of code so you can get a better idea of what I am looking for?

                        Video: http://tinypic.com/r/2gxebzd/9

                        Let me know if the video doesn't work for you.

                        Patrick, I really appreciate you helping me on this.

                        Comment


                          #27
                          Hello dorony,

                          Thank you for your response.

                          Please describe in detail with words rather than code what you wish to achieve.

                          Comment


                            #28
                            Will do...

                            What I am looking for:

                            I need TWO consecutive 5-minute candle lows to be greater or equal to the 5-minute 5sma.

                            Then I need the THIRD consecutive 5-minute candle low to be greater or equal to the 5-minute 5sma.

                            I want to enter a long when the Third consecutive 5-minute candle breaks above the Previous (second) 5-minute candle's high.

                            BUT I only want to enter long if the current 15-minute candle low is greater than or equal to the 15-minute 5sma. Meaning that the 15-minute candle that is currently developing with the Third 5-minute consecutive candle.

                            It doesn't matter if the 15-minute candle isn't supporting the 15-minute 5sma within the first two consecutive 5-minute candles it. All that matters is if the third candle trigger and the current 15-minute price is greater or equal to the 15-minute 5sma happen together.

                            Let me know if this makes sense or you need me to rephrase.

                            Comment


                              #29
                              Hello dorony,

                              Thank you for your response.

                              What you have written here is what the NewPracticefromscratch with the Lows and Highs is already doing.

                              Are you seeing the entry as one bar late and that is where you concern is arising?

                              I look forward to your response.

                              Comment


                                #30
                                I think you are right and the 15-minute is showing good.

                                Yea, I was wondering, how do I get it to take the break of the high price of the current candle instead of waiting for the new candle to open?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                661 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                375 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                110 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                574 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                580 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X