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

Re: explore: sell after x days



PureBytes Links

Trading Reference Links

BUY=YOUR CONDITION;
SELL=REF(BUY,-5);

The first relation gives BUY=1 when YOUR CONDITION is true
and BUY=0 when YOUR CONDITION is not true.
The second relation gives a SELL=1 if a BUY occurred 5 days ago
and SELL=0 any other day.

Example:

buy=cross(stochd(),50);
sell=ref(buy,-5);

Dimitris Tsokakis
--- In amibroker@xxxx, aksjer46@xxxx wrote:
> Hi all, just got Amibroker and I'm playing around with backtesting.
> There's probably a simple answer to this, but I can't find out how 
to 
> sell after 5 days. Have tried this: 
> 
> sell=iif(hold(0,5),0,1);
> 
> but it doesn't work. I have also changed sell delay to 5 in 
Settings 
> but the stocks are sold the same day they get bought.