Announcement

Collapse
No announcement yet.

Can Parabolic S&R be added to this EFS?

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

  • Can Parabolic S&R be added to this EFS?

    Oh....great ones that write in strange language.

    Can this EFS be modified to buy/sell the next open after a close above/below the Donchian Channel) with a protective/loss stop at the Parabolic S&R.

    I made an attempt but it was a disaster.

    Russ
    Attached Files

  • #2
    Will, I finally put something together. But for some reason there is missing some of the data points for the Parabolic. And the back tester doesn't like it. Because it crashs Esignal.

    Hopefully some kind soul can point out the error of my ways.

    Thanks,
    Russ
    Attached Files

    Comment


    • #3
      Russ
      First you don't need to offset forward the Donchian study when declaring it given that in the conditions for both Long and Short you are already checking if the Close is > (or <) than the prior corresponding Donchian band (see note following the first image)
      Secondly you need to add some further qualifying conditions for entering a Long or Short such as for example that the strategy is not already Long (or Short) and that the Low is greater than the Parabolic (for the Long entry) or the high is lower than the Parabolic (for Short entry).
      Once you do that you will also need to rearrange the commands to be executed moving them from "this will happen only the first time" to "this will happen everytime". This is because you will already have a qualifier by checking if the strategy is not already Long (or Short).
      Here is an example of how the Long entry would be along the lines suggested above



      (note: if you prefer to offset the Donchian study forward for visual purposes then simply change the condition to check if close() > vDonchian.getValue(DonchianStudy.UPPER) instead of ...UPPER,-1))

      Apply the relevant changes also in Set2.
      As to the exits you need to check if the strategy is Long (or Short) and then use the Low < prior Parabolic value (that is when the Parabolic flips) to trigger the exit. Here is an example of how the Long exit would be laid out



      Lastly open the efs with the Editor and add setDefaultPriceBarColor(Color.black) in preMain. Alternatively if you would rather do this using the Formula Wizard alone then add a condition (in your case it will be Set5 where 1==1 and the command to be executed is to paint the price bar in black. This needs to be always the last condition.
      Note that all these modifications assume that the efs is used only for backtesting and not for real time.
      Alex

      Comment


      • #4
        Alex,
        It worked. Your help will go along way in my understanding of how the Formula Wizard works. No doubt I have alot to learn.

        One more question: why would I want this to make a sound if it isn't to run in real time? Or can it be made to run in real time?

        Thanks You,
        Russ
        Attached Files

        Comment


        • #5
          Russ
          First of all you are most welcome and thank you for the compliment.
          Before I answer your questions there are a couple of changes that you need to make to the last efs you posted.
          The first one regards Set2 where you have
          low() < vParSAR.getValue(ParabolicStudy.STOP)
          which should instead be
          high() < vParSAR.getValue(ParabolicStudy.STOP)
          The second is that you omitted to add setDefaultPriceBarColor(Color.black) to preMain or as an alternative add a Set5 where the condition is 1 == 1 and the action is to paint the price bars in black everytime.

          why would I want this to make a sound if it isn't to run in real time?

          Actually you would not need it. I just omitted to remove it.

          Or can it be made to run in real time?

          Yes it can be made to run in real time and there would be a couple of ways of doing that the easiest solution being to just add setComputeOnClose() in preMain. The other solution accomplishes the same result but requires some extensive changes in the conditions.
          Alex

          Comment


          • #6
            Alex,
            I made the noted changes.

            I made the color bar changes in the EFS editor and saved it but I still had the Formula Wizard open and I hit the save button it might have save it over the changes in the EFS Editor. I am only guessing.

            Code writing is completely Greek to me. The Formula Wizard should be a big help.

            Russ
            Attached Files

            Comment


            • #7
              Russ
              There is still one error that needs to be fixed that I omitted to list in my prior message.
              In Set1 you have low() > vParSAR.getValue(ParabolicStudy.STOP, -1) which should instead be low() > vParSAR.getValue(ParabolicStudy.STOP) ie to check if the current low is greater than the current Parabolic
              As to code writing while the Formula Wizard is a great tool you will at some point and time want to be able to go beyond its capabilities so I would suggest that you perhaps go through some of the Help Guides that are available in the EFS KnowledgeBase which also include a complete guide to JavaScript 1.5 which is at the foundation of EFS.
              Alex

              Comment


              • #8
                Alex,
                I made the noted change. Also made a change to make the trigger bar cross the Donchian. I don't know if my change caused this or not (see the screen shot). I will keep fool'n with it to see if I can figure it out.

                As to code writing, this is just another step in the evolutionary process. I have learned a tremendous amount with this.

                Russ
                Attached Files

                Comment


                • #9
                  Alex,
                  I see what the problem is now. I didn't go back and add setDefaultPriceBarColor(Color.black) in the EFS editor.

                  My mistake.

                  Russ

                  Comment


                  • #10
                    Russ
                    Also check that you have setComputeOnClose() in preMain if you are running this in real time
                    Alex

                    Comment


                    • #11
                      Now I will try to add a trade qualifier to reduce the bad trades. Something like a MACD.

                      This should keep me busy for awhile.

                      Russ

                      Comment


                      • #12
                        Originally posted by Alexis C. Montenegro
                        Russ
                        Also check that you have setComputeOnClose() in preMain if you are running this in real time
                        Alex
                        Alex,

                        Changes are made and working great.

                        Sure is alot of twist and turns to this. If it was easy everybody and there brother-inlaw would be do'n it.

                        Thanks
                        Russ

                        Comment


                        • #13
                          Hello,
                          After much trial and error have concluded that the Donchian_Parabolic strategy that I had help in builing was not very profitable. So I tabled the D_P strategy for now and wrote a strategy using only the Parabolic and have found the correct time frame and parameters to be profitable.

                          Howvever, some of the lossers are pretty hefty (as much as 7 points). Tried to add a 1 point stop with the Formula Wizard but failed to figure it out.

                          I searched the KB and found the Strategy guild. Which was way over my head at this point.

                          Is there a way to do this with Formula Wizard?

                          Russ
                          Attached Files
                          Last edited by trader123; 07-29-2005, 10:54 PM.

                          Comment


                          • #14
                            Russ
                            It depends on the type of stop you are trying to apply. In general unless the stop is relatively simple (for example the Low of x bars ago or similar) you will not be able to implement it using only the Formula Wizard. You may want to consider using a second more responsive Parabolic as a stop or perhaps a short term moving average (for example a 3 period average of the Lows as a stop for long trades and of the Highs as a stop for short trades).
                            Alex

                            Comment


                            • #15
                              Russ
                              Before adding to your strategy you may want to refine it as you may find it could return different results.
                              First of all you need to consider that the Parabolic flips when its prior value is breached. This means that you don't necessarily need to wait for the Close to be above/below the Parabolic but you can set the strategy to enter a trade once prices breach the prior Parabolic's value.
                              In that case instead of using Strategy.CLOSE you would use Strategy.STOP and use the value of the Parabolic at the prior bar as the entry/exit price. See the following example of a Long entry



                              In this case I first check if the strategy is not already long. Then I check if the High of the prior bar is less or equal than the value of the Parabolic at the prior bar. This is to ensure that the Parabolic was in short mode at the prior bar. Then I check to see if the current High is greater than the Parabolic at the prior bar which will indicate that the Parabolic went Long. Lastly because I will be using the Parabolic as the entry price I check that the current Open is less or equal to the Parabolic at the prior bar to make sure that prices actually traded at that level (else the entry would not be realistic)
                              If all the above conditions return true the strategy then enters a Long trade at the value of the Parabolic of the prior bar.
                              In the second set (see image below) I have virtually all of the same conditions used in the first set except that if the Open of the current bar is higher than the value of the Parabolic at the prior bar the strategy enters a Long at the Open of the bar instead of at the Parabolic's price. This again ensures a realistic trade entry price.



                              For the exit trade I do the reverse. First I check that the strategy is Long. Then I check for the Low of the current bar to breach the Parabolic at the prior bar. Lastly I check that the Open of the current bar was greater or equal than the Parabolic at the prior bar again to ensure realistic entry/exits prices.
                              If these conditions all return true then I exit the Long at the value of the Parabolic on the prior bar (next image).



                              If instead the Open is below the value of the Parabolic at the prior bar I exit the trade at the Open.



                              All the above is for the Long side only. You would need to reverse the logic for the Short side.
                              As you can see there is quite a lot you can do with the Formula Wizard. Never the less you do need to have a clear understanding of the fundamental logic that is required and to do that the best way is to spend some time going through the EFS KnowledgeBase not by just looking at examples but by actually acquiring the basics of programming.
                              Hope this helps
                              Alex

                              Comment

                              Working...
                              X