# Convergence of different conditions – EA Wizard

7 replies

3 years ago #269131

Hi,

How can I code a rule that triggers a buy/sell signal multiple conditions?

For example, I want to go long when close>EMA(20), rsi >30 and CCI>0. I don’t know in which order the 3 conditions will happens, I want that every time 3 conditions happens(for the first time) it will triggers signal. I ask for EA wizard because I need custom indicators.

I hope my request is clear.

Thanks

3 years ago #269152

Hello,

do you mean these conditions must be valid for the same bar / candle (at the same time)?

3 years ago #269159

I try to explain better:

if I have only 2 conditions it’d be easy:  ema20>ema50 and cci crosses over 0 OR cci>0 and ema20 crosses above ema50.

But what if I have 3 or more conditions? I am not looking for all 3 happening at the same candle, I want the FIRST TIME the 3 conditions happen.

For example firt we have the cross of ema20 above ema50, then 2 candle after cci goes over 0 and some candle after rsi goes above 30.

I am no expert in mql coding, but in easylanguage or prorealcode I would assign 1 to each positive condition, and their sum would be assigned a variable, f.e. buycond.

Buycond=3 when all conditions are met. If buycond=3 and buycond[1]<3 (previous candle, so this is first time all conds are met) it will trigger order.

I hope it is more clear now.

3 years ago #269266

Hello,

yes, you are right. You can do it the same way in AlgoWizard. Setup 2 different tabs describing first 2 conditions and assign cond1 = 1 if the condition 1 is valid and cond2 = 1 if the condition 2 is valid

Finally setup a tab for the 3rd condition. If its valid AND cond1 + cond2 = 2 you can execute a trade and set cond1 & cond2 to 0 (zero)

3 years ago #269292

Could you make an example in EA Wizard please?

I fear I didn’t undertand well.

3 years ago #269306

Sure, do you work in the older EA Wizard or AlgoWizard? (the new version)

3 years ago #269307

Older please, I need a custom indicator to use.

3 years ago #269382

You can check the example attached

Viewing 7 replies - 1 through 7 (of 7 total)