I want to generate a trade signal as soon as 3 conditions chronologically become true.
e.g.
as soon as cond1=true (at least) once within the last 10 bars and
as soon as cond1=true AND cond2 become true (at least) once within the last 10 bars and
as soon as cond1=true AND cond2 become true (at least) once within the last 10 bars
then buy ..
in other words: first cond1 and then cond2 and then cond3 becomes true within the last 10 bars!
Below is my try which compiles but does not do what I need.
Thanks.
Code: Select all
cond1 = (countif( cond.a or cond.b or cond.c ,10)>= 1);
cond2 = (countif( cond.d or cond.e or cond.f ,10)>= 1);
cond3 = (countif( cond.g or cond.h or cond.i ,10)>= 1);
if MRO( cond1=true, 10,1) >0 and MRO( cond1=true, 10,1) <=10 then
if MRO( cond2=true, 10,1) >0 and MRO( cond2=true, 10,1) <=10 then
if MRO( cond3=true, 10,1) =1 and MRO( cond3=true, 10,1) <=10 then
if MRO( cond1=true, 10,1)> MRO( cond2=true, 10,1) then
if MRO( cond2=true, 10,1)> MRO( cond3=true, 10,1) then
buy next bar at market;