When you are new it is easier to find bugs when you use a logical flow in your program and then use the interpretation window to show results. I did this below.
// assign macd to a variable so you don't waste time calculating it multiple times.
// this also prevents errors ifyou change the parameters one but not all calculations
.
fMACD = MACD(50, 100);
Plot(fMacd, "\nMACD", colorYellow); // plot macd
Plot(0, "", colorbrightgreen); // plot 0 line
upMAcd = Cross(fMacd, 0); // define cross of macd up
dnMAcd = Cross(0, fMacd); // define cross of macd down
barsUp = BarsSince(upMacd); // find bars since cross up
barsDn = BarsSince(dnMacd); // find bars since cross down
hh = HHV(fMacd, barsUp); // hoighest since cross up
ll = LLV(fMacd, barsDn); // hoighest since cross up
// show results in interpretation window
printf(StrFormat("Bars since up = %g, \nbars since down = %g", barsup, barsdn));
printf(StrFormat("\n\nHighest since up = %g, \nLowest since down = %g", hh, ll));
Notice as you run your cursor over the chart the barssince and hh and ll change referenced to the position of hte cursor. If you need the latest value use lastvalue or leave your cursor at the right edge of the chart. This is really important if you are viewing the charts with live data opposed to EOD data.
Hope this helps,
Barry
__._,_.___
Posted by: razzbarry@imageview.us
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
.
__,_._,___
EmoticonEmoticon