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 cmoran13, 04-16-2026, 01:02 PM
      0 responses
      37 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      23 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      152 views
      2 likes
      Last Post CaptainJack  
      Working...
      X