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

[amibroker] Re: Exploration



PureBytes Links

Trading Reference Links

Hi,

Despite being easier, copying the code would be the least desirable option, since it becomes a maintenance issue. Any future changes will need to be propagated to multiple locations.

Using #include_once allows you to have a "single point of truth". As your code evolves, this will likely become more and more of an issue for you.

To limit your exploration output to a single bar while still running over an extended period, you can play with the Filter statement. For example;

Bar = BarIndex();
Filter = Bar == LastValue(Bar);

The above will only print output for the last bar of each symbol. However, it does not attempt to verify that it will be the same bar for each symbol (e.g. if YYY had no data for today but ZZZ did, then you would have two different dates for the output). You can run with the idea and try to tune it to output for all the same date. Or, if you only work with symbols that you know have regular trading volume, then this could be good enough.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "lucianomt" <lucianomt@xxx> wrote:
>
> 
> Thanks, I actually copied the code in the exploration AFL. 
> 
> My code uses a FOR statement to fill in the Buy and Sell signals. When I run the exploration for one symbol, it displays all the trading days. I want the exploration to show only the last bar, so that I can add other symbols and there will be one line per symbol.
> 
> How can I just show the latest bar but still run the strategy for the previous bars?
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> >
> > You can either add the exploration code to the existing strategy code, or #include_once the strategy file into a new exploration file.
> > 
> > http://www.amibroker.com/guide/afl/afl_view.php?name=%23include_once
> > 
> > One way to determine whether or not you are in a position is to use the Flip function.
> > 
> > http://www.amibroker.com/guide/afl/afl_view.php?id=51
> > 
> > Example;
> > 
> > Buy = ...
> > Sell = ...
> > Short = ...
> > Cover = ...
> > 
> > AmLong = Flip(Buy, Sell);
> > AmShort = Flip(Short, Cover);
> > 
> > // Output "L" when long, "S" when short, "F" when flat.
> > Filter = 1;
> > AddColumn(IIf(AmLong, Asc("L"), IIf(AmShort, Asc("S"), Asc("F"))), "Position", formatChar);
> > 
> > Mike
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "lucianomt" <lucianomt@> wrote:
> > >
> > > I want to use the Exploration function to screen a watch list for Buy/Sell signals generated by a strategy I already have. The Exploration list should show the symbols and whether I am long, short or flat that symbol according to the strategy.
> > > 
> > > Do I have to replicate the strategy code on the exploration code or can I just refer to that strategy?  If so, how?
> > >
> >
>




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

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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/