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

[amibroker] Re: waitperiod



PureBytes Links

Trading Reference Links

The key to your timing constraint is BarsSince
http://www.amibroker.com/guide/afl/afl_view.php?id=23

The solution for removing redundant signals is ExRem
http://www.amibroker.com/guide/afl/afl_view.php?name=exrem

I believe that the following will do what you want (assuming condition B as being a simple higher close than the day before):

MA1 = MA(Close, 5);
MA2 = MA(Close, 25);

CrossUp = Cross(MA1, MA2);
CrossDn = Cross(MA2, MA1);
BarsSinceUp = BarsSince(CrossUp);
BarsSinceDn = BarsSince(CrossDn);

InRange = BarsSinceUp < BarsSinceDn AND BarsSinceUp < 10;
ConditionB = Close > Ref(Close, -1);

Candidate = InRange AND ConditionB;
Buy = ExRem(Candidate, CrossDn);

Plot(MA1, "MA1", colorRed);
Plot(MA2, "MA2", colorBlue);
Plot(Close, "Price", colorDarkGrey);
Plot(BarsSinceUp * InRange, "Range", colorYellow, styleStaircase);
PlotShapes(shapeSmallCircle * Candidate, colorOrange, 0, Close, 0);
PlotShapes(shapeUpArrow * Buy, colorGreen, 0, Close, -10);

Mike

--- In amibroker@xxxxxxxxxxxxxxx, zeek ing <zeeking57@xxx> wrote:
>
> hello all,
> 
> here is an interesting question. one of my triggers is a moving average
> crossover. Once the crossover occurs i have another condition. and buy is
> created if condition B is met. I want to give the second condition only 10
> bars to be completed after the moving average crossover occurs in order for
> the signal to be valid.
> 
> Anyone know how I can set up such a timer?
> 
> Also, once i exit a long i want the timer to expire inorder not to
> enter multiple trades after one signal .
> 
> thanks in advance
> zeek
>




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

**** 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/