amisur
April 9, 2023, 11:33am
1
Is it possible to find out the Highest and Lowest volume for each particular month and plot a rolling chart based on the Difference i.e ( Highestvolume - Lowestvolume) for each month?
I learnt that HHV & LLV give values only for a particular range but not sure of how to get for a particular month.
For example:
For the month of January the highest volume was 100 and the lowest volume was 50. I want to plot a chart based on 50 (100-50)
Thank you
Tomasz
April 9, 2023, 1:08pm
2
MonthChange = Month() != Ref( Month(), -1 );
HighestVolInMonth = HighestSince( MonthChange, Volume );
LowestVolInMonth = LowestSince( MonthChange, Volume );
Or you could use Time frame functions.
3 Likes
amisur
April 9, 2023, 4:27pm
3
Thank you for the reply. I am having problem with plotting the chart. I don't understand why the chart is not smooth even though when there is only one ratio for each month. please guide.
MonthChange = Month() != Ref( Month(), -1 );
HighestVolInMonth = HighestSince( MonthChange, Volume );
LowestVolInMonth = LowestSince( MonthChange, Volume );
// Explore //
Filter = 1;
AddColumn( LowestVolInMonth, "lowest" );
AddColumn( HighestVolInMonth, "highest" );
AddColumn( HighestVolInMonth/LowestVolInMonth, "Ratio" );
Plot((HighestVolInMonth/LowestVolInMonth),"Ratio",colorAqua,styleLine);
This is the chart in excel for something similar
Chart in Amibroker
Tomasz
April 9, 2023, 6:02pm
4
Obviously the AFL code calculates on-going highest/lowest (updated daily as month progresses).
Your chart is not doing that. Your chart just shows ONE point per month at last day of month.
If you took data from LAST BAR of the month from LowestVolInMonth
and HighestVolInMonth
only you would get exactly that.
This was left as exercise FOR YOU TO DO YOURSELF.
2 Likes
amisur
April 10, 2023, 12:59am
5
Thank you. I tried to find the last day of the month and get the values. please correct me if anything can be improved to get a smooth line.
MthChg = Month() != Ref( Month(), -1 );
mthhigh = HighestSince( MthChg, Aux2 );
mthlow = LowestSince( MthChg, Aux2 );
mthratio = mthhigh / mthlow;
LastDayOfMonth = IIf(Month() != Ref(Month(), 1) , 1, 0);
mthratio2 = ValueWhen(LastDayOfMonth,mthratio);
// Explore //
Filter = 1;
AddColumn( mthlow, "lowest" );
AddColumn( mthhigh, "highest" );
AddColumn( mthratio, "Ratio" );
Plot(mthratio2,"Ratio",colorAqua,styleLine);
Tomasz
April 10, 2023, 10:11pm
6
1 Like
As a newbie and Non-programmer I tired but still can't figure out how to take data from LowestVolInMonth any help is much appreciated in this regard.
Thank you
Did you look at the docs? There is example in the guide how to do that:
https://www.amibroker.com/guide/afl/linearray.html
Also Google is your friend, ready to use solutions are easily searchable, why don't you make basic effort?
https://www.google.com/search?q=afl+linearray+plot
1 Like
system
Closed
August 10, 2023, 7:10am
9
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.