Rank: Member
Groups: Registered, Registered Users Joined: 6/18/2009(UTC) Posts: 15
|
Hello,
Could you please assist me with writng a custom indicator that will plot swing lines, with the following rules – I’ve asked this same question on different forums with no success, so hopefully someone will be able to assist:
- Swing lines connect either Highs or Lows of individual bars - never Open or Close.
- If the next bar has a higher high and a higher low (or the same low) when compared to the previous bar, then the swing line goes up connecting the high of the next bar.
- If the next bar has a lower high (or same high) and a lower low when compared to the previous bar, then the swing line goes down connecting the low of the next bar.
- If the next bar is an inside bar (lower high and higher low than the previous bar), ignore it and don’t plot a line on it at all – wait for the next bar.
- If the next br is an outside bar (higher high and lower low), plot a swing line on the high of an outside bar if the following bar (one after the outside bar) has a lower low than the outside bar, OR plot a swing line on the low of an outside bar if the following bar (one after the outside bar) has a higher high than the outside bar.
When I purchased Metastock, I was told that anything could be coded in MS: indicators, back testing systems etc. I hope that to be true.
Thanks
Damien
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
Here is how I interpreted the first 3 conditions:
a1:=If((H>Ref(H,-1))*(L>=Ref(L,-1))=1,H,PREV); a2:=If((H<=Ref(H,-1))*(L<Ref(L,-1))=1,L,PREV); a3:=If((H<Ref(H,-1))*(L>Ref(L,-1))=1,(H+L)/2,PREV); (a1+a2+a3)/3; C
Plot in separate window.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.