Hi, actually not - at least I don't think.... to make it more precise, the 
problem is the following:

(1) I want a stop to be placed after n-days in a trade. I tried the following:

Buy = C > EMA(C, 10);
Buy = ExRem(Buy, Sell);
Sell = BarsSince(Buy) > 5 AND C < Ref(C, -BarsSince(Buy));      
Sell = ExRem(Sell,Buy);

So there is a stop loss at entry after 5 days, but it didn't work.

(2) Linked to the above is an exit strategy similar to the Bollinger Bandit. I 
want to have something along the lines:

Sell = C < EMA(C, Max(50 - DaysInTrade, 10))

Any ideas how to code this without loops?

Thanks
J



--- reinsley <[email protected]> schrieb am Sa, 7.11.2009:

> Von: reinsley <[email protected]>
> Betreff: Re: [amibroker] Help needed: time dependent stop
> An: [email protected]
> Datum: Samstag, 7. November 2009, 9:20
> 
> Are you looking for that ?
> 
> http://www.amibroker.com/guide/afl/afl_view.php?id=50
> 
> Best regards
> 
> jens_lueckhof a écrit :
> >  
> > 
> > Hi, I am struggeling implementing the following:
> > 
> > After x days of a trade I want to place a protective
> stop at the entry.
> > So if the trade hasn't been profitable, I close it.
> > 
> > I have tried with BarsSince(Buy) and ValueWhen( Buy,
> C, 1), but this 
> > doesn't work.
> > 
> > Anyone here who can give me a hand?
> > 
> > Many thanks
> > J
> > 
> > 
> 
> 
> 
> ------------------------------------
> 
> **** 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
> 
> 
>     [email protected]
> 
> 
> 


      

Reply via email to