Explore ROC since beginning of historical database

How can I use in a exploration the beginning value of the total history, if I use explorer range 1recent bar to get the start price.
I use following 9999= should be the first day of the data historic. But this is not working.

MOM = ROC(Close,9999);
MaxEQ9999 = hhv( EQ,9999 );
DD9999 = 100 * ( Eq - MaxEQ9999 ) / MaxEQ9999;
DD9999 = LLV(DD9999,9999);
Ratio = MOM/DD9999;

Thanks for the function or hint

How to create your own exploration

As for total period use BarCount-1

period = BarCount-1;

Filter = Status("lastbarinrange");
// or
//Filter = 1;

// Output only at last row of result list
AddColumn( ROC(C, period), "ROC of total history", 1.2);

// or for output in all rows of result list e.g. if Filter = 1
//AddColumn( LastValue(ROC(C, period)), "ROC of total history", 1.2);

thanks. And another question to get the first price of the history.

period = barcount-1;
Startprice = ValueWhen(period,Close);

this is not correct or would is here the correct value. Thanks.

First argument of ValueWhen has to be condition (returning true (1) or false (0));

fbr = Status( "firstbarinrange" );
Startprice = ValueWhen(fbr,Close);

Unfortunally I get the close today instead of the beginning Startprice of the history if the explore range is 1 recent bars.
For my exploration I need this range 1 recent bars. Is there a possibilty
to get the startprice of the history if the range is 1 recent bars?

Listen, I am using AmiBroker for I do not know how many years already.
I am advanced user. You clearly are still beginner (BTW, being beginner is a state that may change to "not being beginner (anymore)").

But in general... a beginner trying to be smarter than an advanced more experienced guy is not a good idea.

Things I post do work in 99% of cases and are valid.
You are not much detailed so I am not much detailed too.
I just responded to your last post not using proper true/false condition within ValueWhen function's 1st argument and have posted valid correct code. Nothing more nothing less.

Another hint... look at my code in my 2nd post. I have clearly used (uncommented)

Filter = Status( "lastbarinrange" );

Now pretty please do yourself a favour and set Range to All quotes but not to 1 recent bars to make use of Status("firstbarinrange") (and upper Filter) and to get first bar of overall history but still outputting just last row.

Multiple roads lead to Rome! This is especially true for software such as AmiBroker.

Startprice = Ref(C, -(BarCount-1));

But again if you use Flter -> lastbarinrange and tool bar's Range -> All quotes and my previous post's code then you will get same value and single row output.

BTW, your original post got solved already.


sorry for the efforts. I am trying to get better.:sleeping:

@Munichtrader be aware if you have turned on "Pad & Align" that

period = BarCount-1;

will be a BarCount that refers to your Pad & Align reference symbol and not your currently selected symbol.


good hint. Thanks for your comments like always.:smiley: