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

[amibroker] calculating tomorrow's value of SAR



PureBytes Links

Trading Reference Links

Hello,

I need to calculate future value for SAR, Ref(SAR,1) works good until last bar, and the last bar is most important for me because I want to use it in the system which relies on tomorrow's open price. In short, I would like to imlement this formula in AmiBroker:

SAR next day = SAR today + AccelerationFactor( highest high reached yesterday - SAR today)  // got this formula here

This is what I have so far:

// SAR today
AF = 0.02;
tSAR = SAR(AF,0.2);

// This is number of bars after last "swap" of trend
barSAR = Min(BarsSince(Cross(tSAR,H)),BarsSince(Cross(L,tSAR)))+1;

// And finally here is my attempt to calculate next day SAR,
// but results are not always the same as AmiBroker SAR ;(
// I guess I have to skip acceleration in some cases, but
// don't know how to implement this in AB...
nSAR = tSAR + AF * barSAR * (LLV(L,barSAR) - tSAR);

Could you help me with this ?

Best regards,
Tomek
__._,_.___

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

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___