This can't be correct. There are many examples, but looking at ticker SOVO in the attached image. The chart has 3 daily bars. barindex() has a value of 2. Yet a 200 day moving average has a value calculated of 0.20185.
What on earth have I done within Amibroker to create this situation?
Filter = 1;
AddColumn(BarIndex(),"Number of Bars",1.0);
AddColumn(MA(C,200),"MA200");
If I use the same code as OP on a ticker which has less than 200 bars, I get Null. Only after 200 bars do I start getting the MA values. It, a 200 period moving average, also plots Null until it reaches the first 200 bars. This appears to be different behaviour from the OP who is getting MA values from the 1st, 2nd, 3rd bars and I assume would also plot values from the 1st, 2nd, 3rd bars
I am still using version v6.38.0 of AmiBroker. Is this different behaviour with the newer version? I am not using Pad and Align either.
Of course it isn't right.Downgrade to version 6.38.
IF there are not enough bars in the data a single value of MA at the very last bar for incomplete period due to changes done between recent versions. This change was done in 6.39 after users requested such change but it will be reverted.
If you use "Range": "All quotes" then you will see that you always get NULLS for all bars except the last one.
No your interpretation is incorrect. The original poster is NOT getting values for ANYTHING but the LAST BAR. The image may be misleading because he is displaying BarIndex() but at the same time he is using "Range" : "1 recent bar". So it is LAST BAR displayed, not anything else.
The change done in 6.39 will be reverted in 6.40.1