Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

question about code

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

    question about code

    OK, this is gonna be painful because I dont know a THING about programming.
    It's likely a pointless exercise but here goes:

    A while ago a kind stranger online adapted an indicator for me to make it paly a sound when 2 dots were drawn.
    This was in ninjatrader6.5

    This (his updated) indicator doesn't work in NT7
    However, there is an NT7 version of the indicator that I have, but obviously without the updates that were made for me (audio alerts)

    I have tried to copy the area that he coded and put it into the plain NT76 version but it wont compile.
    Either im doing it wrong, or the 'logic' has changed in NT7 and the command required is different?

    This is the part that I think he added for me:

    if ((HighestBar(diff, MoMoPeriod) == 0 && HighestBar(High, BarHiLo) <= BarLookback) || (LowestBar(diff, MoMoPeriod) == 0 && LowestBar(Low, BarHiLo) <= BarLookback))
    {
    DrawDot("Up Dot" + CurrentBar, 0, Difference, Color.Lime);
    if (lastDot == CurrentBar-1)
    {
    Print(DateTime.Now+" "+CurrentBar+" "+lastDot+" alert2");
    PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Alert2.wav");
    }
    lastDot = CurrentBar;

    would this logic work in NT7 or is there a small change that needs to be made??

    #2
    I think with a slight change it should continue to work for you -

    Code:
    if ((HighestBar(diff, MoMoPeriod) == 0 && HighestBar(High, BarHiLo) <= BarLookback) || (LowestBar(diff, MoMoPeriod) == 0 && LowestBar(Low, BarHiLo) <= BarLookback))
    {
    DrawDot("Up Dot" + CurrentBar, true, 0, Difference, Color.Lime);
    if (lastDot == CurrentBar-1)
    {
    Print(DateTime.Now+" "+CurrentBar+" "+lastDot+" alert2");
    PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert2.wav");
    }
    lastDot = CurrentBar;

    Comment


      #3
      You're a star Bertrand.
      Seems to be working.

      Spent ages trying to work it out, and it was all down to the word 'true'!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      605 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      351 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      560 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      561 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X