[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Does my code really look into the future?!?



PureBytes Links

Trading Reference Links

If you don't need 10000 bares of future data, why do you specify that  
you do?
Try:
SetBarsRequired(10000, 0);

BR,
Dennis

On Sep 25, 2008, at 4:12 PM, ozzyapeman wrote:

> Thanks, Tomasz. Another question for you (or anyone)- what about
> "setbarsrequired"? I find that even with a simple MA crossover test
> system that makes use of a barcount loop, I need to do this in order
> to ensure that my plots do not vanish/re-appear as I scroll across the
> screen:
>
> SetBarsRequired(10000, 10000);
> // Ensures that the charts include all bars AND NOT just those on  
> screen.
>
> Of course, I get the future warning when I add the above to my
> backtester settings, but I am sure my trading system itself does NOT
> depend on future quotes. Can one add the above statement without it
> necessarily creating a future leak as far backtesting results are
> concerned?
>
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx>  
> wrote:
>>
>> Yes, because LastValue DOES look into the future and it actually
> looks ALL bars into the future.
>> The user's guide of course says about that
> http://www.amibroker.com/f?lastvalue
>> "Caveat: since this function fills an entire data array with the
> last value of another array, it allows a formula to look into the
> future. "
>>
>> LastValue must never be used in trading system.
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>>  ----- Original Message -----
>>  From: Grover Yowell
>>  To: amibroker@xxxxxxxxxxxxxxx
>>  Sent: Thursday, September 25, 2008 5:30 AM
>>  Subject: RE: [amibroker] Does my code really look into the future?!?
>>
>>
>>  Ozzy,
>>
>>
>>
>>  I have found that Code Check will report looking into the future
> if you have a "lastvalue()"  in your code, and I see that you do.  You
> can take the simplest code such as buying on the MACD as in TJ's
> system example and put in a last value on something or other and
> bang!, the system reports a future leak.  Don't know why, but it does.
>>
>>
>>
>>    You can also get a reported future leak with a trace statement,
> something as innocent as _trace("Hello world");
>>
>>
>>
>>  Hope this helps.
>>
>>
>>
>>  Grover Yowell
>>
>>
>>
>>  From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
> On Behalf Of ozzyapeman
>>  Sent: Wednesday, September 24, 2008 8:08 PM
>>  To: amibroker@xxxxxxxxxxxxxxx
>>  Subject: [amibroker] Does my code really look into the future?!?
>>
>>
>>
>>  I clicked on "Code Check & Profile" in the AFL editor and it gives
> me the warning that my code references future quotes, "40 past and ALL
> future quotes are needed to calculate the formula correctly." Hoping
> anyone can chime in here with reasons why that might be happening.
>>
>>  Is there any other way to test if I have a "Future Leak" other
> than relying on the Code Check tool?
>>
>>  I have gone through my FOREX trading system with a fine tooth comb
> and can't find any place where it references the future. It makes use
> of several moving averages that only reference the current Close, and
> back through the lasts 40 Closes. I test my current Close against the
> MAs, as well as against static profit and stop targets.
>>
>>  I am wondering if my backtester settings are somehow setting off
> the Code Check warning.  Would any of the following backtester
> settings set off a false warning of this sort? What else might trigger
> the 'Future Leak' alarm? I don't use any fancy functions like ZIG,
> just plan old MAs...
>>
>>
>>  SetOption("AccountMargin", 100);                               //
> Account margin, 100 = no margin
>>  SetOption("ActivateStopsImmediately", False);     // Intraday  
>> stops ?
>>  SetOption("AllowPositionShrinking", False);           // Take
> partial trades if equity available ?
>>  SetOption("AllowSameBarExit", True);                      // Allow
> same bar exit for profit stops
>>  SetOption("CommissionAmount", 3.00);                 // Commission
> amount
>>  SetOption("CommissionMode", 3);                              // 3
> = $ per share/contract
>>  SetOption("FuturesMode", 1);
> // = use MarginDeposit and PointValue in calculations
>>  SetOption("InitialEquity", 100000);                          //
> Initial equity $
>>  SetOption("InterestRate",0);
>   // Set interest rate earned for free cash, zero to evaluate system
>>  SetOption("MaxOpenPositions", maxPairsTraded * maxContractsPerPair);
>>  SetOption("MinPosValue", 0);
> // Min position Value to make trade worthwhile, 0 = no limit
>>  SetOption("MinShares", 1);
>      // Min number shares
>>  SetOption("PriceBoundChecking", False );                // Price
> to stay in bar range ?
>>  SetOption("ReverseSignalForcesExit", False);
>>  SetOption("UsePrevBarEquityForPosSizing", True );
>                // Use last known bar for position sizing ?
>>  SetTradeDelays(tradeDelay, tradeDelay, tradeDelay, tradeDelay);
>>  SetPositionSize(1, spsShares);
>>  quoteCurrency     = StrRight(Name(), 3);           // eg. EURJPY
> gives JPY.
>>
>>  if (maxContractsPerPair > 1)
>>    SetBacktestMode(backtestRegularRawMulti);
>>
>>  tradedelay = 0;
>>
>>
>>  // Make sure backtester only starts computing at the start of our
> testing date range, not the start of the symbol database
>>
>>  if(Status("action")>2) start = Max( tradeDelay, LastValue(
> ValueWhen( Status("firstbarinrange"), BarIndex() ) ) );
>>  else start = tradedelay;
>>
>>  // Barcount Loop
>>  for (start = 1; i < BarCount; i++)
>>  {
>>
>>  // Trade system using MAs goes here.
>>
>
>
>
> ------------------------------------
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
>
>
>


------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/