PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "Habibur Md. Rahman Planning Networks" <habib@xxx> wrote: > > Hi > > I want to detect the status of current day's price status, that is, this is the highest (or lowest) closing price of last nth day's closing price. What could be the afl to detect the value of n?
Greater = Close >= Ref(Close, -1); N = BarsSince(NOT Greater);
Plot(Close, "Close", colorDarkGrey, styleLine); Plot(N, "N", colorBlue, styleStaircase | styleOwnScale); > Another thing is, when working with loop, how I can break the loop based on array condition. For example, When the condition Ref(O,-i) > Ref(O,0) first occurs i want to break the loop and get the value of 'i'. Since 'If' doesn't work on array, then how to do it?
for (i = 0; i < BarCount; i++) { if (...my Condition...) { break; } }
// At this point, i holds the value at which your condition was true.
Although, you're probably better off using the ValueWhen function rather than looping. The need to actually do looping is a lot less common than first imagined.
Mike
__._,_.___
**** 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/
__,_._,___
|