Announcement

Collapse
No announcement yet.

New study problems

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

  • New study problems

    I tried to create a new study that creates a trades every time the 10 SMA is less than the prior SMA (for a sale).

    It does change colors but I guess I've got something wrong in the formula.

    Actually, I'd like the trade to occur when there has been 2 consecutive lower readings (on a sell).

    Any suggestions would be appreciated.

    Bruce
    Attached Files

  • #2
    Actually, I just realized it doesn't change colors (had 2 studies running).

    Bruce

    Comment


    • #3
      I've played with it some more and got it to change colors but the rest of it doesn't work, any suggestions would be appeciated.

      Bruce

      (study has new name)
      Attached Files

      Comment


      • #4
        Bruce
        In Set 3 and Set4 you are checking if the average at the prior bar is greater (or lesser) than the same average at the prior bar. Neither condition will ever be true
        Alex

        Comment


        • #5
          I did what you suggested and I think I've figured it out. Is there a way to add a condition that would require 2 lower readings before a short was executed?

          example: 10000, 9999, 9998 and not just a look back of two reading like 10000, xxxx, 9998

          bruce
          Attached Files

          Comment


          • #6
            Bruce
            Yes you can do that. Check that the current value of the average is lower than the value of the average at the prior bar AND that the value of the average at the prior bar is lower than that of two bars ago
            Alex

            Comment


            • #7
              I've added times to the study and it seems to work great BUT the 1st trade of the day seems off.....it looks like it enters regardless if there is a signal or not.


              bruce

              P.S. chart to follow
              Attached Files

              Comment


              • #8
                here is a chart
                Attached Files

                Comment


                • #9
                  Bruce
                  You may need to provide further details such as the symbol, interval, time zone you are in because it is not clear what you are referring to
                  Alex

                  Comment


                  • #10
                    Its the 6B #F 5min and 24 hour data. The trading hours are from 520-1300 PST. If you look at the light grey window the 1st bar on the left is 520 and it set off a trade at that time. It seems if a trade is signaled prior to 520 it enters the trade at 520.....also, if you notice there is a bar color change also at 5:20. One other thing, it used to print the bar color change backward one bar but it doesn't seem to do it now (I checked to see if it was set right).

                    Sorry for all the questions, but I'm stuck.

                    Bruce

                    Comment


                    • #11
                      Bruce
                      As far as I can see it is triggering the trades correctly. Your conditions are
                      IF the time is equal OR greater than 5:20 AND the current value of the moving average is greater than the prior value of the average AND the current value of the average is greater than the value of the average two bars back then go Long
                      which is what it did both yesterday morning and the day before on the 5:20 bar since all the conditions were true.
                      Alex

                      Comment


                      • #12
                        I see what you are saying. My intent of the system was to go short after the SMA turned down by 2 readings (the 1st time it had 2 lower readings)......which it does during RTH but on the 1st trade of the day it does it later based upon the 520 time. With that said, is there any way to avoid the 1st trade of the day (I think that would solve my problem).

                        Bruce

                        Comment


                        • #13
                          Bruce
                          In that case you would need to add a further qualifier ie that the value of the average two bars ago was greater (or lower for the long side) than that of the average three bars ago. This would identify a change in direction. I would also remove the = from (getHour()*100)+getMinute >= 520
                          Beyond this you may have to use the Editor as you may need to add user defined global variables to use as flags which cannot be added with the Formula Wizard
                          Alex

                          Comment


                          • #14
                            Alex:

                            Its now exactly how I want it and it even shows a profit when I back test it.

                            Thanks again.

                            Bruce

                            P.S. completed study for anyone who wants to try it.
                            Attached Files

                            Comment

                            Working...
                            X