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

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



PureBytes Links

Trading Reference Links

Thanks guys. Looks like "LastValue" was the culprit. Commenting out that line eliminated the future warning.

Now examining the offending line, it seems that it does not really look into the future, as far as the trading formula is concerned. It just helps to set the date range for the backtester so that all my plotshapes start and end with the backtester range (otherwise the plots start *before* the back test date).

Commenting out the below line, eliminates the future error, without changing backtester results. So leaving the line in, should not be a problem. Guess it's just a peculiar effect of having LastValue in  one's code.


if(Status("action")>2) start = Max( tradeDelay, LastValue( ValueWhen( Status("firstbarinrange"), BarIndex() ) ) );
else start = tradedelay;


// Barcount Loop
for (i = start; i < BarCount; i++)


--- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@xxx> wrote:
>
> A couple of ways to see if it is really referencing the future:
>
> 1. Performance that looks like the holy grail and quite robust to
> parameter changes.
> 2. While watching real time buy/sell/short/cover signals (Bar Replay)
> -- it sometimes takes back the last signal.
>
> Some formulas look into the future to get patterns, but do not trade
> on the future data.
>
> Some formulas can reference the future in indirect ways that are hard
> to spot, but if 2. is happening, just trace the code when it takes
> back a trade to find the culprit.
>
> Best regards,
> Dennis
>
>
> On Sep 24, 2008, at 11:08 PM, ozzyapeman wrote:
>
> > 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 functio ns 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); &nbs
> > p; // 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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___