Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.

Details:

Formula name: Visible Min and Max Value Demo
Author/Uploader: Jorgen Wallgren - jorgen.wallgren [at] gmail.com
Date/Time added: 2009-03-07 06:46:03
Origin: Inspiration from several codes I have seen, but are not able to pinpoint the authors.
Keywords: Visible Max Min Value
Level: basic
Flags: showemail,function

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.
Description:

Demo of 2 fuctions I wrote, which will find the Maximum and Minimum value in the visible horizontal chart area. Can be used for many different reasons and this is only an example. Inpiration came from several different codes I have seen, but can\'t at this moment find out who created them. Thanks anyway!!! I am new to AFL programming and this could probably be achieved in an easier way and if so, please let me know.

Formula:

_SECTION_BEGIN("Visible Max and Min Value Demo");
// Demo of 2 fuctions I wrote, which will find the Maximum and Minimum value in
the visible horizontal chart area.
// Can be used for many different reasons and this is only an example.
Inpiration came from several different codes
// I have seen, but can't at this moment find out who created them. Thanks
anyway!!!
// I an new to AFL programming and this could probably be achieved in an easier
way and if so, please let me know.

Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
ParamStyle("Style") | GetPriceStyle() ); 

function VisibleMaxValue(Value)
{
 BI							= BarIndex();
 FirstVisibleBarIndex	= Status("FirstvisiblebarIndex");
 FirstVisibleBar     	= FirstVisibleBarIndex == BI;
 HighestVisibleValue		= HighestSince(FirstVisibleBar, Value);
 LastVisibleBarIndex		= Status("LastvisiblebarIndex");
 BlankBars					= SelectedValue(LastVisibleBarIndex - BI);
 LastVisibleBar     		= LastVisibleBarIndex == BI + BlankBars;
 MaxValue 					= LastValue(ValueWhen(Lastvisiblebar, HighestVisibleValue));
 return MaxValue;
}

function VisibleMinValue(Value)
{
 BI							= BarIndex();
 FirstVisibleBarIndex	= Status("FirstvisiblebarIndex");
 FirstVisibleBar     	= FirstVisibleBarIndex == BI;
 LowestVisibleValue		= LowestSince(FirstVisibleBar, Value);
 LastVisibleBarIndex		= Status("LastvisiblebarIndex");
 BlankBars					= SelectedValue(LastVisibleBarIndex - BI);
 LastVisibleBar     		= LastVisibleBarIndex == BI + BlankBars;
 MinValue 					= LastValue(ValueWhen(Lastvisiblebar, LowestVisibleValue));
 return MinValue;
}

Plot(VisibleMaxValue(High), "", colorGreen, 0);
Plot(VisibleMinValue(Low), "", colorRed, 0);

_SECTION_END();

Comments:


About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM