Defining last high and low when certain conditions were met to creat signals

i want to code for buy sell signals using following logic.
i want to know high and low of bar when v>(2xma(v,50 ))then use them to create buy and sell signals like sell=close <low(last low when v>(2xxma(v,50)) & buy=close>high(lasthigh when v>2*ma(v,50)).
please guide

Check out Valuewhen function.
https://www.amibroker.com/guide/afl/valuewhen.html

thanks for reply . i tried but its not peaking proper exact last high low all time
if u can code i know where i am at fault
thanking you

The forum does not work like that.
Please show what you tried.
And please show pictures.

@drpragnesh you should show your attempts and use properly formatted code tags.

Here is a simple effort at a solution.

Condition = Volume > 2*MA(V, 50);
H_Condition = ValueWhen(Condition, High);
L_Condition = ValueWhen(Condition, Low);

// Explore to illustrate my calculations //
Filter = Condition; 
AddColumn(High, "High");
AddColumn(Low, "Low");
AddColumn(Condition, "Condition");
AddColumn(H_Condition, "H_Condition");
AddColumn(L_Condition, "L_Condition");
AddColumn(V, "Volume");
AddColumn(2*MA(V, 50), "2*MA(V, 50)");
2 Likes