RSI Divergence |
Post Reply |
Author | ||||||||||
etrader
Regular Joined: 18 Dec 2004 Posts: 63 |
Post Options
Quote Reply
Topic: RSI Divergence Posted: 12 Aug 2005 at 12:43pm |
|||||||||
I would appreciate if you could help with this conversion from Metastock to bullscript Tim. I thought i could work it out, but got stuck.RSI Divergence{RSI(9) DIVERGENCE BUY:} cheers etrader Edited by etrader |
||||||||||
Tim Allen
BullCharts Staff Joined: 10 Sep 2004 Location: Australia Posts: 53 |
Post Options Quote Reply Posted: 15 Aug 2005 at 10:35am | |||||||||
Before I get too far in, what BullScript did you come up with, and what did it do that you didn't expect?
|
||||||||||
etrader
Regular Joined: 18 Dec 2004 Posts: 63 |
Post Options Quote Reply Posted: 15 Aug 2005 at 8:52pm | |||||||||
I did try and copy and paste but got this error initially. I am not a programmer so am trying to understand the IF's and buts. I tried this also below which returned no errors, but not sure what the 0 is at the end. I would have expected maybe more returns ?? I understand what divergence is, and that we are looking for a higher RSI value after 19 bars and a lower close after 19 bars [and the opposite for the LLV], but the problem I have is my programming iliteracy I guess, and how to make this totally effective with markers etc. {RSI(9) DIVERGENCE BUY:} IF (rsi(close,9) >= HHV(RSI(close,9),19) AND CLOSE < HHV(CLOSE,19),1,0) ORIF (CLOSE <= LLV(CLOSE,19) AND RSI(9) > LLV(RSI(close,9),19), 1,0); |
||||||||||
Tim Allen
BullCharts Staff Joined: 10 Sep 2004 Location: Australia Posts: 53 |
Post Options Quote Reply Posted: 16 Aug 2005 at 4:05pm | |||||||||
The simple solution is: put a semi-colon after the first expression, like this:
That's the same as the first half of what I got, so you're doing alright there. However, when I add that indicator to a chart of, say, BHP or TLS, I get a steady, unwavering line at 0, indicating that this particular signal never went off. When I look at a big, complicated expression like this, I can't imagine how it works all in my head at the same time, so I'm going to break it up into smaller components and see how those work.
Hmm... this indicator fires signals all over the place, so something's going on there. However, since all I can see is blue, I'm not sure which bits are which expression. Let's add some colours to the indicator so we can tell the lines apart:
Hmm.. all blue, no red. I think there must be something wrong with the first expression, although it looks simple enough... Looking in the Script Helper (tick 'Show script helper' at the bottom of the indicator window), I see that the RSI function is supposed to take two parameters - an expression and a period. Let's change the first expression to include CLOSE:
Ah, now we've got a dancing blue line and a dancing red line. If I combine both of those back into cond3:
...then I get a line that spikes only occasionally, which is more like what I expected an indicator to do. So let's put the BUY and SELL signals back together, with everything we've learned:
I don't know if that's exactly the output you were expecting, but it certainly seems a lot more informative than it did to start with.
Markers are really simple, once you've got an indicator that does more or less what you want (as we have here). For details, see the Attribute Reference in the BullScript Help, but to start you off here's the same formula as above, but with attributes added to turn the lines into markers:
|
||||||||||
etrader
Regular Joined: 18 Dec 2004 Posts: 63 |
Post Options Quote Reply Posted: 17 Aug 2005 at 12:09am | |||||||||
Wow !! you have exceled Tim, I really appreciate the time and effort you have put in to explain things, and this will definately help me and others I am sure, to work through some practical Bullscript. I'll study this and no doubt will gain some useful knowledge for future reference. cheers etrader. |
||||||||||
Post Reply |
Forum Jump | Forum Permissions 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 |