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

[amibroker] If or IIf or How?



PureBytes Links

Trading Reference Links

I wish to create an Array (Array XY) where the first "10" bars are 
the "Close" price of that bar and then the rest (from bar 11 on) are 
a formula that includes the previous bars value in that formula.

For example 

Bars 1-10 = Close
Bars 11 to Current Bar = (Close + Ref (Array XY, -1)) / 2

Please note that above is not the formula but an example to make it 
simpler.I have tried If and IIf Statements but no luck as yet.


I am trying to convert the below part of a TradeStation formula to 
afl.
"//
Input: Price(numericeseries), Period(numericsimple);

Vars: Mm (0);

If (currentbar <= period) then mm = Price;

If(currentbar > period) then mm = (mm[1] + price)/2;

ADP = mm;
End;
//"


I am at a loss, any direction would be great.
Crashoz


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

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