Announcement

Collapse
No announcement yet.

30-day WMA for backtesting

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

  • 30-day WMA for backtesting

    hi guys, i am very new to this. can anyone tell me what i have to do if i want to backtest a very simple 30-period WMA system, where you go long if the period ends above, and short if the period ends below. thanks in advance for any help...
    amnon

  • #2
    amnon
    In the Back Testing folder of Formulas you should have a formula called btEMA.efs that can easily be modified to do what you want. Open it with the Editor (Tools-> EFS-> Editor...) and replace
    if(study == null) study = ema(10);
    with
    if(study == null) study = wma(30);
    Save the study with a different name so as not to overwrite the original then apply it to a chart and run the Back Tester.
    If you are unfamiliar with how to write formulas for back testing and/or how to use the Strategy Analyzer you may want to review the various tutorials that are available in the EFS KnowledgeBase in the Help Guides and Tutorials folder
    Alex

    Comment


    • #3
      alex, thanks for your help. i have the btema.efs, but it does not have the line you say. it has these line:
      var study = new MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL);

      function preMain() {
      setPriceStudy(true);
      }

      function main() {
      var v = study.getValue(MAStudy.MA);

      if(v == null)
      return;


      if(close() >= v) {
      if(!Strategy.isLong()) {
      Strategy.doLong("Crossing Up", Strategy.CLOSE, Strategy.THISBAR);
      }

      } else {
      if(!Strategy.isShort()) {
      Strategy.doShort("Crossing Down", Strategy.CLOSE, Strategy.THISBAR);
      }
      }

      if(Strategy.isLong()) {
      setBarBgColor(Color.green);
      } else if(Strategy.isShort()) {
      // setBarBgColor(Color.red);
      }


      return v;
      }

      where should i make the changes?

      thanks,
      amnon

      Comment


      • #4
        amnon
        In that script replace
        var study = new MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL);
        with
        var study = new MAStudy(30, 0, "Close", MAStudy.WEIGHTED);
        What version and build of eSignal are you running (see under Help-> About)?
        Alex

        Comment


        • #5
          7.91, i am updating it to the latest version.

          Comment


          • #6
            amnon
            That is what I was going to suggest next. Once you upgrade eSignal to 8.0 (build 782) you should have the most recent version of btEMA.efs which includes the line I indicated in my first reply.
            Alex

            Comment

            Working...
            X