PureBytes Links
Trading Reference Links
|
Use StaticVarSet and StaticVarGet.
Regards,
GP
--- In amibroker@xxxxxxxxxxxxxxx, "davemabe2000" <davemabe@xxx> wrote:
>
> Thanks, GP.
>
> I just tested various ways of using VarSetText and VarGetText, but it
> looks like those variables aren't available within the custom backtest
> loop - they were all blank when I tried to retrieve them from in there.
>
> Is there another way to do it without using the low-level interface?
> Perhaps I could write them all to a csv file and then read from the
> csv file from within the custom backtest loop. Can anyone think of a
> better way?
>
> --- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@> wrote:
> >
> > Two possibilties I can think of are to either use dynamic variables to
> > save the reason values for each sell signal, and then read those
> > variables in the custom backtester, or implement the stop algorithm in
> > the custom backtester. That would require using the low-level
> > interface though.
> >
> > If you use dynamic variables, you'll need to use the date as part of
> > the variable name, as bar numbers will be different in the custom
> > backtester. For example, as you set the Sell array indication, and
> > assuming you have used "dt = DateTime()" somewhere, add:
> >
> > VarSet("Ex"+Name()+DateTimeToStr(dt[i]), <your reason code>);
> >
> > Then in the custom backtester, something like:
> >
> > reason = VarGet("Ex"+trade.Symbol+DateTimeToStr(trade.ExitDateTime));
> > trade.AddCustomMetric("Exit Reason", reason);
> >
> > I haven't tried this, so can't guarantee it will work, and you may
> > need to play around with exact dates depending on your trade delays,
> > as the exit date may not match the Sell signal date. Also not sure if
> > you can use ordinary dynamic variables or you have to use static ones.
> > If you can't get it to work, add _TRACE statements and use DebugView
> > to see exactly what dates you're getting in both places.
> >
> > Regards,
> > GP
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "davemabe2000" <davemabe@> wrote:
> > >
> > > I'm implementing my own stops via the loop as described in the
"Coding
> > > your own custom stop types" section of this page:
> > >
> > > http://www.amibroker.com/guide/h_backtest.html
> > >
> > > I'd like to add a column to the backtest report for "Reason For
Exit"
> > > depending on which branch of my custom exit strategy was invoked.
> > > I've seen the examples in the help file for "Adding custom backtest
> > > metrics". The problem is that there is no way to determine what
> > > happened in my custom stop loop using anything in the Trade object
> > > from the backtester.
> > >
> > > http://www.amibroker.com/guide/a_custombacktest.html
> > >
> > > Is there some way I can store information from within my stop loop
> > > that can be easily retrieved from within the loop in the backtest
> > > section of code that loops through the closed trades so my custom
> > > metric can be added?
> > >
> >
>
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/
|