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 giulyko00, 04-24-2024, 12:03 PM
                9 responses
                43 views
                0 likes
                Last Post giulyko00  
                Started by memonic, Yesterday, 01:23 PM
                2 responses
                25 views
                0 likes
                Last Post memonic
                by memonic
                 
                Started by merc410, Today, 03:41 AM
                2 responses
                16 views
                0 likes
                Last Post merc410
                by merc410
                 
                Started by sugalt, 04-30-2024, 04:02 AM
                2 responses
                13 views
                0 likes
                Last Post sugalt
                by sugalt
                 
                Started by Ndakotan1313, 03-14-2024, 05:02 PM
                2 responses
                64 views
                0 likes
                Last Post blaise_code  
                Working...
                X