Count with condition

Hello! I'm new to AFL
I've read a lot of articles and as a beginner, it's still hard for me to understand everything.
I ran into a small problem, could you help me.
How can I create a variable that will count the number of conditions.

Filter = 1;

count = 0;
IIf(Buy, count ++, count + 0);

AddColumn(count, "Buy Count", 1.1, colorGreen);

my backtest report shows that the purchase condition was met 3 times
so there should be 3 in count
1

but the code i'm trying to do shows me only 1
2

I want to do this in order to display only what matches my condition in the report.
for example : AddColumn(count >= 3, "Buy Count", 1.1, colorGreen);

Use Cum() function

AddColumn( Cum( Buy ), "Cumulative Buys" );

thanks for the answer. I tried to do as you said. and this is what i got

target_profit = 83;
//----------------------------------------------------------------------------------------------------
Buy =  Close <= Second_down;
Sell = 0;
//----------------------------------------------------------------------------------------------------
Short = 0;
Cover = 0;
//----------------------------------------------------------------------------------------------------
profit_stop = ApplyStop( stopTypeProfit, stopModePercent, Param("profit", target_profit, 1, 100, 1), True );
//----------------------------------------------------------------------------------------------------
Filter = 1;
AddColumn( Cum( Buy ), "Cumulative Buys" );

backtest have 3 count
1

this my explore
2
3
where did i make a mistake?

Exploration is not equal to backtest.

You get raw signals in your exploration.

Read about differences here:

1 Like

Not correct as usual.
Why are you newbies always make false claims stated as facts?
If you don't know then say so but please stop stating incorrect things.

You can add whatever column you want to backtest result list (or additional info to backtest report).

This is just one example

https://www.amibroker.com/guide/a_custombacktest.html

1 Like

in which of my posts did I make a false statement?!
I was just asking a question, not stating

Well, it is not really a clear question.
Questions are like

"Does it mean that...?"
"Am I right that...?"

Yours is "it turns out that I can't do this or that..." so it is rather more of a statement than question.

1 Like

If I seemed rude to you, then I want to apologize. I do not know English, I write through Google translator, and it is possible that he translates something incorrectly. Well, as someone who doesn't know English, it's very difficult for me to delve into AFL
but I know that I can still do it.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.