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

[amibroker] Re: How to write this is the first buy signal in the past 6 bars



PureBytes Links

Trading Reference Links

Use the ExRemSpan function:

Buy = ExRemSpan(condition1, 6);

However, it depends on exactly what you want. This fixes what you
describe as the problem, but doesn't match your proposed solution.
Your problem indicates you want to ignore any more signals for the
next six bars after a signal, but your solution is looking for a
signal that is not preceded by any other signals for the previous bars.

If you do want the latter option, then I think your statement below
should work with a little correcting:

buy=condition1 and ref(condition1,-1)==0 and ref(condition1,-2)==0 and
and ref(condition1,-3)==0 and ref(condition1,-4)==0.

Unless Buy has already been set to condition1 before this, then you
can't test Buy within this statement. And secondly, you need the '=='
operator for comparison. Single '=' is an assignment operator.

GP


--- In amibroker@xxxxxxxxxxxxxxx, "Padhu" <ccie8340@xxx> wrote:
>
> Folks,
> 
> Say i have buy = condition1;
> Alert gets generated...Now few bars later again condition1 matches
and another alert gets generated.
> So i'd like add a filter that says Buy=condition1 and this is the
first Buy in the past six bars so that buy signals don't repeat every
other bar if the condition matches.
> 
> I tried something like this
> 
>  buy=condition1 and ref(buy,-1)=0 and and ref(buy,-2)=0 and and
ref(buy,-3)=0 and and ref(buy,-4)=0. 
> 
> But its not working.
> 
> How do I code this in AB 4.9?. Thanks.
> 
> cheers,Padhu
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
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/