Thanks, but that's not it. Should have mentioned that I had tried
that. Same problem persists.


--- In [email protected], "Steve Davis" <_sda...@...> wrote:
>
> The include file is being written after it has already been included.
> Try moving the include statement after the fclose.
> 
> -Steve
> 
> --- In [email protected], "ozzyapeman" <zoopfree@> wrote:
> >
> > Hello, hoping someone can help with this issue. When I use an optimize
> > statement with #include and fputs, the optimization variable keeps
> > getting shifted.
> > 
> > For example, please consider the two basic MA crossover systems below.
> > They should both give identical results whether one does a backtest or
> > an optimization. The backtests do appear identical. However, the
Include
> > version gives wonky results in optimization. Instead of 'a'
starting at
> > value 1. It starts at 5 but says in the optimization report that it is
> > 1. I know it's probably something simple that I am overlooking, but
> > can't seem to figure this one out:
> > 
> > 
> >
>
//----------------------------------------------------------------------\
> > --
> > // TRADE SYSTEM #1:    SIMPLE CROSS BASIC
> >
>
//----------------------------------------------------------------------\
> > --
> > 
> > FastMALength = Optimize("FastMALength",      1,     1,    5,     1);
> > 
> > SlowMALength = 20;
> > 
> > FastMA       =    MA( C, FastMALength );
> > SlowMA       =    MA( C, SlowMALength );
> > Buy          = Cross( FastMA, SlowMA  );
> > Sell         = Cross( SlowMA, FastMA  );
> > 
> > 
> > 
> > 
> >
>
//----------------------------------------------------------------------\
> > --
> > // TRADE SYSTEM #2:   SIMPLE CROSS USING INCLUDE AND FPUTS
> >
>
//----------------------------------------------------------------------\
> > --
> > 
> > a = Optimize( "a", 1, 1, 5, 1 );
> > 
> > #pragma nocache
> > #include "c:\\TestAFL.afl";
> > 
> > fh = fopen( "c:\\TestAFL.afl", "w");
> > fputs("FastMALength = ", fh);
> > fputs(NumToStr(a, 1.0, 0 ),fh);
> > fclose( fh );
> > 
> > SlowMALength = 20;
> > 
> > FastMA       =    MA( C, FastMALength );
> > SlowMA       =    MA( C, SlowMALength );
> > Buy          = Cross( FastMA, SlowMA  );
> > Sell         = Cross( SlowMA, FastMA  );
> >
>


Reply via email to