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

Help with simple price based indicator from Larry Williams

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

    Help with simple price based indicator from Larry Williams

    Attended a webinar from Larry Williams and he gave out code for Tommy Gun entry. Could someone please help me with this, i am not a programmer. The attachment explains it and has formula. would be neat if arrow or colored bar identifies setup. thank you.
    Attached Files

    #2
    forrest,

    Hopefully a community member can help, however should you have limited time please check out one of our NinjaScript consultants.



    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by forrest View Post
      Attended a webinar from Larry Williams and he gave out code for Tommy Gun entry. Could someone please help me with this, i am not a programmer. The attachment explains it and has formula. would be neat if arrow or colored bar identifies setup. thank you.
      Looking for symmetry, are you sure that your condition2 should not be:

      TrueHigh - Close < TrueHigh.1 - Close.1 ?

      Comment


        #4
        yes you are right

        yes that is correct, and is a mistake in that slide. Thank you for catching that.

        Comment


          #5
          Originally posted by forrest View Post
          yes that is correct, and is a mistake in that slide. Thank you for catching that.
          Is it a long-only system, or what are the conditions for going short?

          Comment


            #6
            thanks Koganam

            I assume it is a long and short entry. Short entry would be the inverse so i think this would be it:

            close - true high > Close.1 - true high.1
            and

            true low - close < true low.1 - close.1

            and

            (close>close.1 AND Close.1> Close.2)

            Comment


              #7
              Originally posted by forrest View Post
              I assume it is a long and short entry. Short entry would be the inverse so i think this would be it:

              close - true high > Close.1 - true high.1
              and

              true low - close < true low.1 - close.1

              and

              (close>close.1 AND Close.1> Close.2)
              Hm. Maybe you should find out from the presenter what the short setup should be? The close will always be less than or equal to the TrueHigh, so that first condition will be handling negative numbers if used as written. While not a code breaker, it seems to be a logic breaker. Once that is settled, I may be able to post some short-side code.

              In the meantime, here is the code for what you wrote.
              Code:
                      protected override void Initialize()
                      {
                                      Overlay			= true;
              			DrawOnPricePanel	= false;
              			BarsRequired		= 3;
                      }
              Code:
                      protected override void OnBarUpdate()
                      {
              			if (CurrentBar < 2) return;
              			bool Cond1 = Close[0] - Math.Min(Close[1], Low[0]) > Close[1] - Math.Min(Close[2], Low[1]);
              //			bool Cond2 = Math.Max(Close[1], High[0]) - Close[0] < Math.Max(Close[2], High[1]) - Close[0];
              			bool Cond2 = Math.Max(Close[1], High[0]) - Close[0] < Math.Max(Close[2], High[1]) - Close[1];
              			bool Cond3 = Close[0] < Close[1];
              			bool Cond4 = Close[1] < Close[2];
              			
              			if (Cond1 && Cond2 && Cond3 && Cond4) DrawArrowUp("Long_" + CurrentBar.ToString(), false, 0, Low[0] - 10 * TickSize, Color.Green);
                      }

              Comment


                #8
                Thank you Koganam

                Thanks K, you are exactly right I am sorry was not thinking about the negative values. I corrected the below. I apologize. I understood the logic as comparing( in the case of a short) the upper wicks (sellers = true high less close) where as you want the current bar to have a larger value than the previous bar. AND the buyers shown on each bar being the lower wicks (close less true low). so you would want the current lower wick to have a value less than previous bar.

                corrected below:


                true high - close > true high.1 - close.1
                and

                close - true low < close.1 - true low.1

                and

                (close>close.1 AND Close.1> Close.2)


                I appreciate what you have done.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GLFX005, Today, 03:23 AM
                0 responses
                1 view
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                Started by XXtrader, Yesterday, 11:30 PM
                2 responses
                11 views
                0 likes
                Last Post XXtrader  
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                14 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                3 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Working...
                X