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

No DrawDown

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

    No DrawDown

    I try to plot a diamond+sound when jWillimas2 cross above and below the 20 and 80 lines.

    The cross above works fine and plot the diamons and sound.
    The cross below is not ploting a thing.

    Please see attached and please if anyone can get it, please do.

    protectedoverridevoid OnBarUpdate()

    {
    if (CrossAbove(jWilliams2(8,14,0),22,1))


    {
    // play sound
    DrawDiamond("Diamond"+CurrentBar, 0, Low[0] - 3*TickSize, Color.Black);
    PlaySound(
    @"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav");
    }


    if (CrossBelow(jWilliams2(8,14,0),80,1))


    {
    // play sound
    DrawDiamond("Diamond"+CurrentBar, 0, High[0] + 3*TickSize, Color.Black);
    PlaySound(
    @"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav");
    }
    Attached Files

    #2
    Hello Tzachi,

    You are using the same tag for both drawing objects, so that should be the first item to change. Change one of the tags to "Diamond2"+CurrentBar, for example.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan,

      Thanks. I did the change of one of the diamonds to diamond2 but nothing changed re ploting the down side.

      Comment


        #4
        Did you compile the changes (Right click in editor > Compile) as well as reload NinjaScript (Right click on chart > Reload NinjaScript)?

        If you've done this but are still not seeing the diamond, a simple print statement can be used to verify the condition is evaluating true. Check the print statement through the Tools > output window.

        if (CrossBelow(jWilliams2(8,14,0),80,1))
        {
        // play sound
        Print("DownSide Triggered");
        DrawDiamond("Diamond2"+CurrentBar, 0, High[0] + 3*TickSize, Color.Black);
        PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav");
        }
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Any idea what can makes the "above" to plot but not the "below"?

          Comment


            #6
            Ryan,

            Any other input to resolve this problem?

            Comment


              #7
              Sorry - didn't reply because there was no feedback on my last suggestions. You compiled and reloaded, added print statement? Were you able to get confirmation that the condition returned true?
              Last edited by NinjaTrader_RyanM1; 01-19-2011, 03:10 PM.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Can anyone help me find out what the problem with CrossDown plot as I posted on post #1?

                Still cannot get it to plot the down diamond.

                (print commend did not show anything on the output window)

                Comment


                  #9
                  Tzachi,

                  If the print statement didn't appear, then likely you have no bars that meet the condition. For the crossbelow condition to be true, the value of the indicator must be above 80 and then cross below it.

                  To debug this, print the value of the indicator to verify it's what you expect. Please see here for help using the debugging tools:
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by helpwanted, Today, 03:06 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post helpwanted  
                  Started by Brevo, Today, 01:45 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post Brevo
                  by Brevo
                   
                  Started by aussugardefender, Today, 01:07 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post aussugardefender  
                  Started by pvincent, 06-23-2022, 12:53 PM
                  14 responses
                  242 views
                  0 likes
                  Last Post Nyman
                  by Nyman
                   
                  Started by TraderG23, 12-08-2023, 07:56 AM
                  9 responses
                  384 views
                  1 like
                  Last Post Gavini
                  by Gavini
                   
                  Working...
                  X