Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Paint Bars custom indicator no longer working...

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

    Paint Bars custom indicator no longer working...

    NT Support Team,
    I coded a custom indicator (based on a similar indicator) that has worked for several months but today stopped working. I've tried re-compiling the code, reloading Ninjascript, etc. to no avail.

    The code is pretty simple and just marks bars that test the 21 EMA and end on/near their highs/lows. A portion of the code is below.

    Can you assist?

    Code:
    if ((Low[0] <= EMA(Close, 21)[0])
    && (Close[0] >= EMA(Close, 21)[0])
    && ((Close[0] - Open[0]) >= 1)
    && (High[0] - Close[0] <= 0.25)
    && (Low[0] < Low[1]))
    {BarBrush = UpBrush;}
    if ((High[0] >= EMA(Close, 21)[0])
    && (Close[0] <= EMA(Close, 21)[0])
    && ((Open[0] - Close[0]) >= 1)
    && (Close[0] < EMA(Close, 21)[0])
    && (Close[0] - Low[0] <= 0.25)
    && (High[0] > High[1]))
    {BarBrush = DownBrush;}​

    #2
    Attached is the indicator itself...
    Attached Files

    Comment


      #3
      Although this was still working perfectly fine yesterday, I did notice I had a redundant/duplicative line of code in the "down brush" parameters. I updated that and "re-coded" in a completely new indicator and it is still not working.

      No idea what changed or how to fix. Any help is greatly appreciated.

      Updated code (with redundancy removed) is below:
      if ((Low[0] <= EMA(Close, 21)[0])
      && (Close[0] >= EMA(Close, 21)[0])
      && ((Close[0] - Open[0]) >= 1)
      && (High[0] - Close[0] <= 0.25)
      && (Low[0] < Low[1]))
      {BarBrush = UpBrush;}
      if ((High[0] >= EMA(Close, 21)[0])
      && (Close[0] <= EMA(Close, 21)[0])
      && ((Open[0] - Close[0]) >= 1)
      && (Close[0] - Low[0] <= 0.25)
      && (High[0] > High[1]))
      {BarBrush = DownBrush;}​

      Comment


        #4
        Hello TradingForTheFutures,

        Thank you for your post.

        So I may accurately assist you, please answer all of the following questions:
        • What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)
        • Who are you connected to? This is displayed in green on the lower-left corner of the Control Center window.
        • Who is your broker?
        • What instrument symbol (and expiry if applicable) have you selected? For example, ES 03-22, AAPL, EURUSD, etc.
        • (For a chart) what interval is selected? For example, 5 minute, 1 day, 2000 volume, 4 Renko, etc.
        • Do you receive an error on the screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?

        I look forward to your reply.

        Comment


          #5
          Hello Emily,
          Please see below:
          1. 8.0.26.1 64-bit
          2. Ninjatrader Continuum
          3. Ninjatrader
          4. ES 06-23
          5. 2000 Tick
          6. There is no error.

          The indicator worked yesterday (and several months prior) and today will no longer work. Any ideas? Thanks

          Comment


            #6
            Emily,
            I also just tried updating to 8.1.1.3 64-bit. The indicator is still not working.

            Thanks

            Comment


              #7
              Hello TradingForTheFutures,

              Thank you for your reply.

              I suggest adding print statements to your script to better understand its behavior. This will print to the output window. For example, when each condition is true, you could print the CurrentBar index to the output window and review with your chart to verify whether the bar was painted as expected or not:

              Code:
              if ((Low[0] <= EMA(Close, 21)[0])
              && (Close[0] >= EMA(Close, 21)[0])
              && ((Close[0] - Open[0]) >= 1)
              && (High[0] - Close[0] <= 0.25)
              && (Low[0] < Low[1]))
              {
              BarBrush = UpBrush;
              Print("UpBrush on bar: " + CurrentBar);
              }
              if ((High[0] >= EMA(Close, 21)[0])
              && (Close[0] <= EMA(Close, 21)[0])
              && ((Open[0] - Close[0]) >= 1)
              && (Close[0] - Low[0] <= 0.25)
              && (High[0] > High[1]))
              {
              BarBrush = DownBrush;
              Print("DownBrush on bar: " + CurrentBar);
              }​​
              For more information about adding prints to debug your scripts:


              Please let us know if we may be of further assistance.

              Comment


                #8
                Originally posted by NinjaTrader_Emily View Post
                Hello TradingForTheFutures,

                Thank you for your reply.

                I suggest adding print statements to your script to better understand its behavior. This will print to the output window. For example, when each condition is true, you could print the CurrentBar index to the output window and review with your chart to verify whether the bar was painted as expected or not:

                Code:
                if ((Low[0] <= EMA(Close, 21)[0])
                && (Close[0] >= EMA(Close, 21)[0])
                && ((Close[0] - Open[0]) >= 1)
                && (High[0] - Close[0] <= 0.25)
                && (Low[0] < Low[1]))
                {
                BarBrush = UpBrush;
                Print("UpBrush on bar: " + CurrentBar);
                }
                if ((High[0] >= EMA(Close, 21)[0])
                && (Close[0] <= EMA(Close, 21)[0])
                && ((Open[0] - Close[0]) >= 1)
                && (Close[0] - Low[0] <= 0.25)
                && (High[0] > High[1]))
                {
                BarBrush = DownBrush;
                Print("DownBrush on bar: " + CurrentBar);
                }​​
                For more information about adding prints to debug your scripts:
                https://ninjatrader.com/support/foru...ing#post791121

                Please let us know if we may be of further assistance.
                Hey Emily,
                I modified the code to include these couple extra lines and it did not work. I have a similar indicator with slightly different parameters which does work (screenshot is below) but for some reason this specific one no longer works.

                I have attempted to take the code from the other custom indicator that paints bars and reformat it to the parameters that I have included here but it still does not work. I even re-built the indicator from scratch and it does not work.

                As mentioned, it literally worked yesterday but did not work at all today and is still not working correctly.

                Correctly painted bars example:
                Click image for larger version

Name:	image.png
Views:	172
Size:	6.3 KB
ID:	1246346

                With the custom indicator that should paint the bars, you can see that the bars are not painted:
                Click image for larger version

Name:	image.png
Views:	157
Size:	6.4 KB
ID:	1246347

                Comment


                  #9
                  I have taken the other custom paint bar indicator that works and modified the code (below) to remove the lines specified and the indicator no longer paints bars when I remove these. By removing these, it is essentially the same parameters as the indicator that is no longer working.

                  I cannot figure out why with less parameters that it completely stops working...

                  if ((Low[0] <= EMA(Close, 21)[0])
                  && (Close[0] > EMA(Close, 21)[0])
                  && (Close[0] >= (High[0] - 0.25))
                  && (Low[0] < Low[1])
                  && ((High[0]-5) <= Low[1]) --Removed
                  && (EMA(Close, 9)[0] > EMA(Close, 21)[0]) --Removed
                  && (EMA(Close, 21)[0] > EMA(Close, 50)[0]) --Removed
                  && (EMA(Close, 21)[0] > EMA(Close, 200)[0]) --Removed
                  && (EMA(Close, 50)[0] > EMA(Close, 200)[0])) --Removed
                  {BarBrush = UpBrush;}
                  if ((High[0] >= EMA(Close, 21)[0])
                  && (Close[0] < EMA(Close, 21)[0])
                  && (Close[0] <= (Low[0] + 0.25))
                  && (High[0] > High[1])
                  && ((High[0]-5) <= Low[1]) --Removed
                  && (EMA(Close, 9)[0] < EMA(Close, 21)[0]) --Removed
                  && (EMA(Close, 21)[0] < EMA(Close, 50)[0]) --Removed
                  && (EMA(Close, 21)[0] < EMA(Close, 200)[0]) --Removed
                  && (EMA(Close, 50)[0] < EMA(Close, 200)[0])) --Removed
                  {BarBrush = DownBrush;}​
                  Last edited by TradingForTheFutures; 04-14-2023, 05:57 PM.

                  Comment


                    #10
                    Update: I had a colleague try this indicator on his charts and it worked for him. The difference appears to be "Input Series." Mine keeps defaulting to "Close," whereas my colleague's correctly displays "ES 06-23 (2000 Tick)". Is there a way to keep this defaulted to the correct Input Series of "ES 06-23 (2000 Tick)?"

                    No matter what I do, it keeps defaulting to "Close" for me.

                    Thanks

                    Mine (Incorrect):
                    Click image for larger version

Name:	image.png
Views:	166
Size:	21.3 KB
ID:	1246354

                    His (Correct):
                    Click image for larger version

Name:	image.png
Views:	167
Size:	16.6 KB
ID:	1246355

                    Comment


                      #11
                      Hello TradingForTheFutures,

                      Thank you for your reply.

                      You mentioned, "No matter what I do, it keeps defaulting to "Close" for me." though I am not sure what you have tried so far. If you have not already, please try setting it to the desired setting, then in the bottom-right corner select "template > save > Save As Default" to save the properties to the default template. Then, test by opening a new chart and adding the indicator. Take note of what is selected for Data Series.

                      If you have already tried this and/or it does not resolve the behavior, I would like to review your diagnostic files for additional information. Please send me your log and trace files so that I may look into what occurred.

                      You can do this by going to the Control Center-> Help-> Email Support

                      Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.​ Please include "Attn Emily C" in the subject line along with a link to this forum thread in the body of the email.

                      I appreciate your patience.

                      Comment

                      Latest Posts

                      Collapse

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