Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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;
    BertrandNinjaTrader Customer Service

    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 RookieTrader, Today, 09:37 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by kulwinder73, Today, 10:31 AM
      0 responses
      5 views
      0 likes
      Last Post kulwinder73  
      Started by terofs, Yesterday, 04:18 PM
      1 response
      23 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by CommonWhale, Today, 09:55 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by Gerik, Today, 09:40 AM
      2 responses
      7 views
      0 likes
      Last Post Gerik
      by Gerik
       
      Working...
      X