Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
Find Out More Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Percentage Price Change Between Selected Dates for Amibroker (AFL)

Rating:
3 / 5 (Votes 5)
Tags:
ambroker, price change

Select the first date on the chart using F12, then the last date with Shift+F12. You will see the percentage change in the price and the number of days between the two selected dates on your chart (top right). You can change the value used to Open, Close, etc.

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN( "F12" );
// Works out the percentage change between the selected days
// and displays the change and days on the chart.
//F12 (Start) and Shift-F12 (End). Clear Ctrl-F12
Price = ParamField( "Price", 0 );
Start = BeginValue( BarIndex() );
End = EndValue( BarIndex() );
Days = End - Start;
ValStart = BeginValue( Price );
ValEnd = EndValue( Price );
Diff = ValEnd - ValStart;
Pct = ( Diff / ValStart ) * 100;
GfxSetBkColor( colorBlueGrey );
GfxTextOut( "Pct: " + NumToStr( Pct, 3 ) + "%", 1200 , 20 );
GfxTextOut( "Days: " + Days, 1200 , 40 );
_SECTION_END();

9 comments

1. SADAI

Good.thanks

2. moccha

Very Clever

3. cometh

Awesome, needed something like this
Cheers

4. hotaro3

thank you for your god indicator, although it is also capable for using in other timeframes for example 1h, 4h, 15 Min, etc. with slightly changing it is usefull in forex

_SECTION_BEGIN( "F12" );
// Works out the percentage change between the selected days
// and displays the change and days on the chart.
//F12 (Start) and Shift-F12 (End). Clear Ctrl-F12
Price = ParamField( "Price", 0 );
Start = BeginValue( BarIndex() );
End = EndValue( BarIndex() );
Periods = End - Start;
ValStart = BeginValue( Price );
ValEnd = EndValue( Price );
Diff = ValEnd - ValStart;
Pct = ( Diff / ValStart ) * 100;
GfxSetBkColor( colorWhite );
GfxTextOut( "Pct: " + NumToStr( Pct, 3 ) + "%", 1000 , 20 );
GfxTextOut( "Periods: " + Periods, 1000 , 40 );
_SECTION_END();
5. xyzxyz

Not Worked
Please Fixed

6. administrator

The formula works fine. You probably have an old version of Amibroker that doesn’t support Gfx functions.

7. xyzxyz

Can not select by pressing F12, in my Dell by F12 it increases the brightness. i am using AmiBroker 6.20.1

8. xyzxyz

Thanks for Reply

9. administrator

You can also select two points on the chart by double clicking on the chart in one spot then double clicking in another spot.

Leave Comment

Please login here to leave a comment.

Back