Announcement

Collapse
No announcement yet.

EFS and Backtest Help

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

  • EFS and Backtest Help

    Hi,

    I wrote a little volatility breakout program for the S&P. I have the following questions:

    1) The program runs on a 10 minute chart (sp z3=2,10) but one of the inputs it needs is the ATR of a daily chart. How can this be done? I wrote the following little work-around, but it is obviously just an average range and not quite as accurate.

    rnghi = 0;
    rnglo = 0;
    sumrng=0;
    for (i=0; i < 31 ; i++) {
    rnghi = high(-i,1,"sp #f=2,d");
    rnglo = low(-i,1,"sp #f=2,d");
    sumrng += rnghi - rnglo;
    }
    avgrng= sumrng / 30


    2) How can I backtest more than 7 days? I set up the time template for 30 days, but it makes no difference. The sample btEMA.efs file works as expected, so I know the time template is set up correctly. What things should I look for in my program that would cause this problem?

    3) How do I set point values for futures? In my 7-day test it shows a gain of 7.69, which is of course, impossible in the S&P. Even ignoring the improper figures for now, how do I tell the backtester that the S&P is woth $250. per point?

    That is enough questions for now. Many many questions have been answered by doing a search on thes forums. What a great resource! I am grateful for any help that any of you can provide.

    Jamie

  • #2
    Check this out...

    Check out this thread.. It discusses how to use data from not chart and apply it to another..

    I have done something like this using ATR and it worked fine. So you should be able to follow this example to resolve your issues.

    Triple Screen Thread

    Brad
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      HI Brad,

      Thanks for the link. There is some excellent code there. I have downloaded much of it for future use. However for my current situation it is way more than I need. It would be much simpler to rewrite the ATR study as a function that accepts the elements of my array as input. Apparently that's what I'll have to do. No big deal.

      Any ideas on questions 2 or 3?

      Thanks,

      Jamie

      Comment


      • #4
        Correction...

        Jamie,

        It would be much simpler to rewrite the ATR study as a function that accepts the elements of my array as input.
        I thought so too - until I tried it. The ATR code it a bit more complex than one thinks. Plus, I was trying to use the DAILY ATR (6:30 ~ 13:15 PST) and apply those values to pre-market data.

        The solution in the thread is actually an easy and precise way to accomplish this task. I'm sure you'll save yourself a bunch of time if you simply try it.

        2. Sure you can backtest more than 7 days. I think the limit currently is 60 days. Simply create/update your time-template to retrieve data for 60 days. Then start the backtester code and let it go.

        3. In the Backtest screen, there is a field for "Default Lot Size". This is the amount of contracts/shares to trade. For futures, you would enter 250 - for the S&P. For the e-Mini - enter 50 per contract. For stocks, enter the number of shares.

        If you need more help, let me know.
        Attached Files
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment


        • #5
          Hi Brad,

          Thanks a lot for the tip on lot size. Should have been obvious I guess.

          I am still not having any luck getting more than 7 days worth of backtesting. Might be something wrong with my code.

          I rewrote my average range algorithm as a function for average true range and designed it to accept length and symbol as inputs. It was easy to write and seems to work just fine. Am I missing something?


          function MYATR(Length,Sym) {

          if (Length == null || Length < 3) Length = 14;
          if (Sym == null) Sym = getSymbol();
          rnghi = 0;
          rnglo = 0;
          rngcl = 0;
          todRng = 0;
          sumrng=0;
          truHi = 0;
          truLo = 0;
          myATR = 0;

          for (i=0; i < Length; i++) {
          rnghi = high(-i,1,Sym);
          rnglo = low(-i,1,Sym);
          rngcl = close(-i-1,1,Sym);
          todRng = rnghi - rnglo;
          truHi = Math.abs(rnghi - rngcl);
          truLo = Math.abs(rnglo - rngcl);
          truRng = Math.max(todRng,truHi);
          truRng = Math.max(truRng,truLo);
          sumrng += truRng;
          }
          myATR = (sumrng/Length).toFixed(2);
          return myATR
          }


          I call it from a 10 minute chart with a statement like this:

          var test = MYATR(30,"SP #f=2,D");

          If I omit the symbol it gives me the ATR of the 10 minute chart.

          This is a challenging transition from Easy Language. I like the added capabilities, but I dislike having to write even the simplest things from scratch. Who would have thought I'd need to write my own Standard Deviation function? LOL

          Take care,

          Jamie

          Comment

          Working...
          X