Hi,

Aside from your SelectedValue problem, you will sometimes find that charting 
looks into the future and will thus not translate easily into a clean backtest.

The Tsokakis example you gave is one such instance. The script uses PeakBars 
and TroughBars, both of which are forward looking and thus not suitable for 
backtesting without modification.

Before dealing with the SelectedValue issue, you would first have to add code 
to delay the recognition of the peaks and troughs until they would actually 
have been knowable under live conditions. See 
http://www.amibroker.com/members/library/detail.php?id=353 as an example of how 
to do this.

Once you've got logic that is not forward looking, the answer to your original 
question is that the code must be continuous, rather than rely on user 
intervention (i.e. remove SelectedValue entirely).

Mike

--- In [email protected], "jhnlmn" <jhn...@...> wrote:
>
> I was exploring various trading strategies and custom indicators on the Web
> and saw several interesting examples in the AmiBroker library and this forum,
> in particular "Head & Shoulders Pattern" and "Historical Trendlines and 
> Breakouts"
> at http://finance.groups.yahoo.com/group/amibroker/message/50689
> 
> But the problem is that these scripts use either SelectedValue or LastValue 
> functions,
> which restrict script execution to a single point only (either to the 
> selected bar
> or to the last bar). As the result, these scripts cannot be used for 
> backtesting
> or as an indicator (because a good indicator should display a value for each 
> bar, not only for a single one).
> 
> I see that Dimitris Tsokakis wrote "Move the cursor [to the left or to the 
> right] to see the formation
> changes.". But this is not a workable solution! It will take years for me to 
> manually move custor
> over thousands of stocks in the database! I need some automated way to 
> backtest these scripts.
> Basically, I need to make a loop and assign either the SelectedValue or 
> LastValue programmatically,
> then invoke the script as a function. But these values appear to be read only.
> For example, SelectedValue = 123; generate an error.
> 
> Any suggestions?
> 
> Thank you
> John
>


Reply via email to