can anyone help me . been confused in writing this formula.

trying to do formula to scan stock which today volume is greater than previous 30days

@defoxie, What have you tried? What is confusing you?

What code have you written (show us by posting it here - using code blocks </>) and what part is not working.

The point of this community is to help you LEARN how to write your own.

If you are not a programmer, then in painstaking detail, explain how you would figure it out by hand, and then we can help point you to the appropriate functions.

Also, with your recent Joining, and very little read time, it appears that you want someone else to do the work for you. Show us that is not really the case.

Lots of great (smarter than me) members on this forum helping lots of other users. Show us you deserve our help, but showing us what you are trying yourself.

Snoopy

this is the code, confused on the array . and i like to show only stock with current vol > highest vol in previous 30 days (not including today)

n=30;

highestvol=0;

for (i=1; i<=n; i++) {

vTmp() = Ref (V, -i);

if ( vTmp > Highestvol )

Highestv= Ref(V,-i);

}

AddColumn( vt, "highest vol" );

tried

highestvol = HHV(Volume,30-1);

but it will include today volume, since i need to exclude today vol

@defoxie it is difficult to know exactly what you are trying to achieve,

but based on your last post it seems that you could use the following

```
HighestVol = Ref(HHV(V,30),-1);
```

The above would give you the highest value of Volume over the past 30 periods preceding the current period (i.e current candle is not included in the calculation).

Hopefully that is what you are looking to achieve.

yes, this work for me.

is there a formula to format array into no decimal data

eg.

addcolumn ( prec(close,0),"close");

result show as 101.00

still come out 2 decimal as output

you could use something like this

```
AddColumn( C, "Close", 1.0, colorDefault, BckColor, width = 43 );
```

You could use the above to specify zero decimal places and Amibroker will do the rounding if so required.

You should replace BckColor above with colorDefault or define BckColor to be a color of your choice.

Hope this is of help.

yes. it works. thanks alot

You are welcome . Good luck with your trading.

@defoxie, when learning AFL, the array processing can be a challenge to wrap your head around. I tell people to think like using Excel. The array is a Row, and the formula you want can look at any cell ABOVE and to the LEFT of the cell you are currently in. When you get the formula correct, it is copied to the entire row and then it does the calculation.

Then the challenge is figuring out the code in AFL to do the calculation you want. That takes time reading the manual and learning the different functions that are available.

As you can see from @Ziza, his code does the highest volume in one line using the AFL functions.

Good Luck and Good Trading