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

[amibroker] Need help getting started on a concept



PureBytes Links

Trading Reference Links

I need help getting started on a variation of a Donchian style stop. Instead of a n-day lowest low/highest high,  I am trying to use the n-th lower low/higher high. To complicate things I would like to make this level a trailing stop based on new highs/lows.
 
So for example, if I am long and n=5, the initial stop would calculated from the entry bar as the 1st low and look back each bar to find the 2nd low and so on until the 5th lower low. It could be 5 bars back, it could be 25 bars back. Assuming a long position and the market makes a new high, the stop is recalculated. The stop may not change, if this new high bar's low is equal to the entry bar low and there are no occurences of a lower low in between entry bar and the new high bar.
Concievably it could calculate even lower if you had an outside bar that say dropped down to the 4th low but then reversed and made a new high. In that case, counting back 5 lower lows could take you back further than the intial stop which you probably would not want to do, but who knows, that could also be tested.
So I see two main parts here that I do not know how to code, 1.) calculating the initial nth lower low and 2.) making it a trailing stop.
 
Any help, anything just to get me started will be greatly appreciated.
 
Thanks in advance,
James


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. __._,_.___

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




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

__,_._,___