Mike, that is the winner.  [:p]   Thankyou so much.  I wish you well and
hope I can help out in some way.


--- In [email protected], "Mike" <sfclimb...@...> wrote:
Jolly,

  You can't override the range dates once you're already being executed.
  It's a chicken and egg thing. However, if you include conditional logic
  to only accept signals during specific periods, then you can run the
  backtest over the a timeframe that includes all periods and the code
  will prevent trading except during allowed periods.

  e.g. Trade only during 2003 and 2005, vertical bars over green squares
  will be accepted, others will be ignored.

  Dates = DateNum();
  ValidDates = (Dates >= 1030101 && Dates <= 1031231) || (Dates >=
1050101
  && Dates <= 1051231);

  MyBuySignal = Cross( MACD(), 0 );
  Buy = MyBuySignal AND ValidDates;

  MySellSignal = Cross( 0, MACD());
  Sell = MySellSignal AND ValidDates;

> DateColors = IIF(ValidDates, colorGreen, colorLightGrey);

  Plot(1, "", DateColors, styleArea | styleOwnScale | styleNoLabel);
  Plot(MyBuySignal, "Buy Signal", colorGreen, styleHistogram,
  styleOwnScale);
  Plot(MySellSignal, "Sell Signal", colorRed, styleHistogram,
  styleOwnScale);

  Title = NumToStr(DateTime(), formatDateTime) + ", " +
  EncodeColor(colorGreen) + "Buy Signal: " + MyBuySignal + ", " +
  EncodeColor(colorRed) + " Sell Signal: " + MySellSignal;

  Alternatively, have a look at BatMan in the Files section of this group
  and write a batch script to run your backtests over each of the desired
  periods.

Mike




Reply via email to