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

[amibroker] help for indicator and IIF issue



PureBytes Links

Trading Reference Links

I've got a very simple indicator but can't get proper afl code.

I want to plot an indicator equal to MA(C, 50) on day1 - let's say 20
$. For the following 2 days it has to be the same - 20$.
On day 4 it is equal to MA(C, 50) again - let's say 30$ - and remain 
at 30$ for the following 2 days again.
Its shape would then be similar to a staircase.

In short the indicator should be equal to MA(C, 50) every four days 
and be the same for the remaining 3 days.

I tried to code it as follow but it doesn't work due to the IIF logic:

MyIndicator = IIf(BarsSince(MA(C, 50) != Ref(MA(C, 50), -1)) > 3, MA
(C, 50), Ref(Ma(C, 50), -1));

Anyone can help?

regards,

paolo



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

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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/