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

[amibroker] Re: Help with one line of code.



PureBytes Links

Trading Reference Links

Interesting workarounds.

I tested... 
> Equity(1); // To remove redundant signals
> Sell = ref(Buy,-10);

and 'Equity(1)' didn't appear to remove redundant(old) signals.
'Sell = ref(Buy,-10)" still came back true from an old Buy signal.

That is to say, there is a more recent buy signal that we're trying to
 count 10 days from....the most recent buy signal that "barsSince(Buy)
>= 10"  would use if it worked as expected.

Any help greatly appreciated.
Andy

--- In amibroker@xxxxxxxxxxxxxxx, "psytek2" <psytek@xxx> wrote:
>
> 
> Try adding to your system:
> 
> Equity(1); // To remove redundant signals
> Sell = ref(Buy,-10);
> 
> or
> 
> Equity(1);
> Sell = BarsSince(Buy) >= 10;
> 
> best regards,
> herman
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "conchoriverwater" 
> <conchoriverwater@> wrote:
> >
> > When I am doing a back test, I want to trigger the sell at exactly 
> > 10 bars after the buy. 
> > When I use the following code, there is a problem.
> > 
> > G = BarsSince(Buy); 
> > Sell=IIf(G==10,1,0);
> > 
> > The bar count starts again every time a buy condition is hit.
> > If a buy is hit two bars in a row, it doesn't work.
> > 
> > Is there a better way to do this?
> > 
> > Please keep it simple. I cut and paste a lot of code and only 
> > understand the simple stuff.
> > 
> > Thanks
> > 
> > James
> >
>



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.9/573 - Release Date: 12/5/2006 4:07 PM