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

Indicator with arrows

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

    #16
    Hello Chris,

    I would say that this is not drawing 100% of the time with this condition.

    Add a print to the action block of the condition, is this print appearing?

    If you have a print appearing from the action block of that one condition (without adding the print to any other action blocks), then you can demonstrate that the condition is evaluating as true.

    I'm expecting that any drawing objects that are appearing are coming from somewhere else.


    "if the current bar crosses below the Bollinger Band, and when the Stochastic K line is less than 20":
    Code:
    if (CrossBelow(Close, Bollinger(2, 14).Middle, 1) && Stochastics(7, 14, 3).K[0] < 20)
    {
    	// execute code
    }
    I do not know the results you are looking for. I cannot comment on how to better get your results, and I am not able to assist with logic. I can say that your condition is false because if you include no previous bars for a CrossBelow, then no cross can happen because a cross can only occur from previous bars to the current bar.
    Last edited by NinjaTrader_ChelseaB; 12-28-2017, 12:25 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Hey Chelsea,

      So I got the Print to work, and the Indicator is working correctly. A new problem though is that when price gets close to a Bollinger Band and stops just short, an arrow will now trigger if price reverses and pulls the Bullinger Band down, making contact with the tail. Since it does this, an arrow is produced after price has already crossed the Bollinger line instead of the moment price crosses a Band. Is there any way to fix this?

      Chris

      Comment


        #18
        Hello chrisca,

        Are you running the indicator with Calculate set to OnBarClose or OnPriceChange/OnEachTick?

        I look forward to you reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #19
          Hello Chris,

          Thank you for your note.

          What is the code of the condition set that is triggering as true that is causing the drawing object to be drawn?

          What further conditions would you like to add to this set?

          Are you wanting it to fully cross and only place the arrow after the bar has closed?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Hello Chelsea,

            So I managed to get the indicator to plot arrows at the correct bars when conditions are true. An couple of issues I am having though are:

            1) When price comes close to a Bollinger Band yet does't cross. Once price begins to pull back and leave a tail, the price pull back will cause the Bollinger Band to come into contact with the tail, thus generating an arrow. Is there a way to stop this from happening so that an arrow will ONLY generate if price crosses a Bollinger Band, and not if price pulls the Bollinger Band to the price tail. I'd like the arrow to indicate a buy/sell signal, and generating an arrow from pulling the band with price is generating false signals.

            2) If the conditions are true and an arrow is generated, the arrow will disappear if any condition becomes false. Once the conditions are true and an arrow id plotted, I would like it to stay plotted.

            Any help with either of these, primarily problem 1 would be helpful.
            Thank you,
            Chris

            Comment


              #21
              Hello chrisca,

              Thank you for your note.

              1. Can you provide the condition and action for the arrow that is drawn? Are you still using CrossBelow?
              2. This is due to the 'tag' string of your drawing objects. You need to use a unique id per each drawing object drawn. For example: "MyArrow" + CurrentBar.

              I look forward to your response.

              Comment


                #22
                Hi Patrick,

                1) Here is my logic for plotting an arrow:

                if ((Stochastics1.K[0] < NumberLow)
                && (CrossBelow(Low, Bollinger1.Lower, 1)))
                {
                Draw.ArrowUp(this, @"RedGreenLight Arrow up_1"+CurrentBar, false,
                0, (Low[0] + (-2 * TickSize)) , Brushes.Lime);
                }

                2) Thank you for that info. I will create a unique tag and let you know how that works.

                Thanks again,
                Chris

                Comment


                  #23
                  Does anyone have any ideas on how to fix this issue? This is the last main problem I have left to correct.

                  Thank you in advance,
                  Chris

                  Comment


                    #24
                    Hello chrisca,

                    Thank you for your patience.

                    The update strategy I have sent to your email details that a misplaced '}' was preventing the conditions from occurring. Please refer to that email and let me know if you have any questions.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Mizzouman1, Today, 07:35 AM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by Radano, 06-10-2021, 01:40 AM
                    20 responses
                    616 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by i019945nj, 12-14-2023, 06:41 AM
                    6 responses
                    67 views
                    0 likes
                    Last Post i019945nj  
                    Started by aa731, Today, 02:54 AM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by BarzTrading, Today, 07:25 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post BarzTrading  
                    Working...
                    X