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

Re: [amibroker] Re: Please Help



PureBytes Links

Trading Reference Links

Hi A & B, 

sent you Dingo's doc in another mail, there's an example going bar by bar there.

going to be out for work, maybe sb else will intervene meanwhile.

regards,
n.

See you
On 9/5/05, coba702002 <coba702002@xxxxxxxxx> wrote:
> Hi Neuro,
> 
> Thanks so much for your time and help.  Brian got his wife involved
> and I am a programmer but I don't totally know about the trading
> terminology and process.
> 
> We are coming close to the couple of days spent reading and re-
> reading the help document (Well.. one day for me) and are not that
> much closer to any understanding of what we need to do.  This is
> what we have so far:
> 
> SetCustomBacktestProc("");
> if(Status("action") == actionPortfolio) {
>         bo = GetBacktesterObject();
>         bo.PreProcess();
> 
> Now what?  Do we do a for-loop to loop through every bar in the
> backtest?
> 
> like:
> 
>         for (bc = 1; bc <= howEverManyBarsThereAreTotal; bc++) {
> 
> Then I need to "scan open position(s) to update the running
> MAE/MFE".  How do I know what open positions belong to that bar I am
> processing?  Are there properties of each bar that I can look at
> while in this loop (like the high, low, open, close and date time)
> to match up to the data in the open position object?
> 
>                 // some pseudo code involving GetFirstOpenPos() and
> GetNextOpenPos()
>                 // If the open position goes with the bar in
> question (2nd and beyond)
>                 // add to the MAE/MFE calculation
> 
> And then process that bar? like:
> 
>                 bo.ProcessTradeSignals(BarCount);
> 
> or would it be:
> 
>                 bo.ProcessTradeSignals(bc);
> 
> Then I need to scan the closed trades list and see if the trade exit
> date is at this bar (how can I tell?).
> 
>                 // some psuedo code involving GetFirstTrade() and
> GetNextTrade()
>                 // and an if statement
>                 // and trade.AddCustomMetric()
> 
>         }
>         bo.PostProcess();
> }
> 
> 
> We don't need to use the GetFirstSignal() and GetNextSignal()
> anywhere right?
> 
> Are the AFL Functions usable for example: llv, barsince -- and if
> so, in only certain objects?
> 
> Are there any other examples that we could look at -- we are so
> confused!
> 
> Thanks in advance for any help you can give us.
> 
> Adrienne & Brian
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, neurotic self <neuroticself@xxxx>
> wrote:
> > Brian,
> >
> > it's OK, not laughing (well, I was, but only because I was
> rewatching
> > Kill Bill 1).
> >
> > > NumTrades = 0;
> > you probably don't need this
> >
> > > for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade
> () )
> > you don't want to scan trades, but bars (look at the example in the
> > docs, you'll figure it out). At every bar you process signals at
> that
> > bar like you did here (wrong place)
> > > {
> >
> > but first  you have to scan open position(s) to update the running
> > MAE/MFE in some variable, probably via varget/varset, from the
> second
> > bar on, so a loop on open positions should be here, before
> processing
> > this bar's signals
> >
> > then do entry/exit for current bar
> > > bo.ProcessTradeSignals(BarCount);
> >
> > now you can scan all closed trades up to this bar
> > for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
> > {
> >
> > here you'll check if trade EXIT date is at this bar and if it is
> > you'll add the custom metric computed before for the trade's symbol
> >
> > }
> >
> > > NumTrades++;
> > no need for this either
> >
> > end of backtest...
> > > }
> >
> > and then you list all trades executed with your custom metrics
> >
> > > bo.ListTrades();
> > > }
> >
> > here you put your buy-sell-cover-short rules
> >
> > I'd suggest you to spend a couple of days or more on the doc/help,
> > think over it a lot (don't get offended, it took quite some time
> for
> > me also), try the examples, play with them. Break the problem in
> > smaller pieces like we did above, search the list for solutions to
> > these smaller problems and you will make it.
> >
> > Go figure: I spent the last couple of months learning to code my
> > system, and I'm not satisfied yet... patience and willpower...
> >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, neurotic self
> <neuroticself@xxxx>
> > > wrote:
> > > > Hi Brian,
> > > >
> > > > there may be a simpler solution, can't think of it right now.
> > > >
> > > > This definitely can be done in low level backtesting, eg:
> > > track/update
> > > > your personalized MAE/MFE at every bar in a set of variables
> > > > (varset/varget, one per symbol) from the  bar after entry and
> > > onwards,
> > > > and after invoking
> > > > bo.ProcessTradeSignals( bar );
> > > > you can scan all your trades (I wish TJ could give us a more
> > > efficient
> > > > way, like scanning from last closed trade and backwards...) and
> > > add a
> > > > custom metric to those that closed during the current bar,
> with the
> > > > proper value.
> > > >
> > > > Hope it's correct, let me know if this is clear and fits you
> > > >
> > > > neuro
> > > >
> > > > On 9/4/05, coba702002 <coba702002@xxxx> wrote:
> > > > > I am trying to figure out a way to NOT include (h-L)
> activity in
> > > the
> > > > > MAE/MFE calcs,since i enter on bar close and don't want the
> > > entry bar
> > > > > (H-L) to be part of the calc. Is there a way around this in
> the
> > > low
> > > > > level backtester custom metrics code. I have tried sooooo
> many
> > > things
> > > > > and cannot get anything to work, i have pulled most of my
> hair
> > > out so
> > > > > before i lose it all please help :))
> > > > >
> > > > > Trade drawdown (as well as MAE and MFE) is different because
> it
> > > > > *includes* intraday activity (H-L)
> > > > >
> > > > > thanks in advance
> > > > > Brian
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 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 other support material please check also:
> > > > > http://www.amibroker.com/support.html
> > > > >
> > > > >
> > > > > Yahoo! Groups Links
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Janeczko for President!
> > >
> > >
> > >
> > >
> > >
> > > 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 other support material please check also:
> > > http://www.amibroker.com/support.html
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Janeczko for President!
> 
> 
> 
> 
> 
> 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 other support material please check also:
> http://www.amibroker.com/support.html
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 


-- 
Janeczko for President!


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Help tsunami villages rebuild at GlobalGiving. The real work starts now.
http://us.click.yahoo.com/njNroD/KbOLAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 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/

<*> 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/