Re: [amibroker] Help Request with LLV and HHV (Coding Newbie question)

 

BarsSince() counts the number of bars SINCE the expression was true.  So if the expression is true NOW then it won't count the bars.  It's kind of like you have the think in reverse.  Bottom line if you make DN_MAXD  Up_MAXD and make Up_MAXD DN_MAXD then it will probably work.

Like this:

UP_MAXD = BarsSince(Cross(0, MACD(50,100)));

DN_MAXD = BarsSince(Cross(MACD(50,100), 0 ));


On 2/27/2016 1:28 PM, mdcoulter@gmail.com [amibroker] wrote:
 

Greetings All! 

I am hoping for some help in figuring out where my coding is incorrect (simple rookie mistake, I would think).  The code below is designed to find/filter for ONLY the LOWEST LOW or the HIGHEST HIGH of the 50-100 MACD SINCE it most recently crossed Above or Below the Zero Line. 

The problem is that it often returns cases where the MACD is NOT at it's lowest or highest since crossing the Zero Line.  I've attached on example of the problem...

Any ideas??  Thanks a million in advance...

All the best,

Mark Coulter

 

///Calculate # of Bars Since MACD 50-100 Crossed ABOVE (UP) or BELOW (DN) 0///

DN_MAXD = BarsSince(Cross(0, MACD(50,100)));       ///Bars SINCE MACD50-100 Crossed BELOW 0///

UP_MAXD = BarsSince(Cross(MACD(50,100), 0 ));       ///Bars SINCE MACD50-100 Crossed ABOVE 0///

 

///Insure that MACD 50-100 is at it's HIGHEST/LOWEST Value since Crossing the ZERO Line///

MAXDUP = HHV(MACD(50, 100), UP_MAXD);

MAXDDN = LLV(MACD(50, 100), DN_MAXD);



__._,_.___

Posted by: Alan <alan@thenorthams.us>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Check out the automatic photo album with 2 photo(s) from this topic.
LLV error sample 1.jpg Explore MACD crosspver.PNG

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


.

__,_._,___


EmoticonEmoticon