Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar Low vs EMA

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

    Bar Low vs EMA

    I have an issue with indicator showing bars not at the right position vs 21 EMA.
    Here is a piece of code:
    Code:
                    && (((Low[0] < (EMA(21)[0])) && ((high1 > ema1)
    Just to let you know it happened yesterday at around 9:36 Eastern Time on ES futures contract.

    Indicator supposed to show only bars which are below 21 EMA for short (red circle) but the bar's low (red circle) is clearly at 21 EMA where it supposed to be below 21 EMA.
    Could you please help me and let me know how should I correct the code?


    Attached Files

    #2
    Hello Ludwik,

    Thank you for your note.

    It's pretty difficult to tell whether that Low price is actually below the EMA price. The first thing I would suggest would be to print the values of Low[0] and EMA(21)[0] along with the Time[0] value for each bar to confirm whether the low of that bar was below or not.

    This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

    https://ninjatrader.com/support/foru...ns-not-working

    If you run into issues like we saw here, the above information will allow you to print out all values used in the condition in question that may be evaluating differently. With the printout information you can assess what is different between the two.

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    182 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    335 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    259 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    358 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    188 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X