I have read http://zorro-trader.com/manual/en/advisor.htm and http://zorro-trader.com/manual/en/tutorial_pre.htm (Workshop7). I have been working under the assumption that the models built by adviseLong and adviseShort were independent. I tested this assumption and found it is not the case. I get very different results depending on whether I call adviseLong followed by adviseShort, or the other way around.

Code:
#define LONG_FIRST

function run() {
  if (is(INITRUN)) {
    BarPeriod = 80;
    BarOffset = 40;
    LookBack = 245;
    NumWFOCycles = 6;
    StartDate = 20130601;
    EndDate = 20131230;
    set(NFA + TICKS + RULES + TESTNOW + PLOTNOW + LOGFILE);
    TradesPerBar = 2;
    Weekend = 1;
    Hedge = 4;
  }

  vars ol = series((priceOpen(0) - priceLow(0)) / PIP);

  var v00 = APO(ol, 4, 7, MAType_WMA);
  var v01 = APO(ol, 148, 245, MAType_TRIMA);
  polyfit(0, ol, 24, 2, 1);
  var v02 = polynom(0, -1);

  TakeProfit = 3 * ATR(100);
  Stop = 3 * ATR(100);

  int al;
  int as;
#ifdef LONG_FIRST
  al = adviseLong(PERCEPTRON, 0, v00, v01, v02);
  if (al > 0) {
    enterLong();
  }
  as = adviseShort();
  if (as > 0) {
    enterShort();
  }
#else
  as = adviseShort(PERCEPTRON, 0, v00, v01, v02);
  if (as > 0) {
    enterShort();
  }
  al = adviseLong();
  if (al > 0) {
    enterLong();
  }
#endif

  plot("al", al, LINE + NEW , BLUE);
  plot("as", as, LINE, RED);
}



[Train] with #define LONG_FIRST
==> Annual loss -28325p
[Train] without #define LONG_FIRST
==> Annual +42% +9366p

I attached the Performance Chart as long_then_short.png and short_then_long.png, respectively.

Additional observations.
Whichever model is first will have little variation and will always have the values -100 or 100. Whichever model is second will have reasonable variation and the values vary depending on cycle. I observed +/- 48, 55, and 53. See red/blue chart in the attached images.

I expected it to not matter which one is called first, since the outcome of only the very next enterLong/enterShort forms the prediction with which to train the model.
Quote:
Prediction Value to be trained for prediction by the current Signal combination. Either a positive value for suggesting a trade, or a negative value for advising against a trade, or 0 for using the result of the next trade for prediction. This parameter is only used in the training run and has no meaning in test or trade mode.


Can you please shed some light on this?

Attached Files
long_then_short.png (12 downloads)
short_then_long.png (11 downloads)