Not logged in
Viewing 8 posts - 1 through 8 (of 8 total)

Forums>AlgoWizard / EA Wizard>Strategy Samples>Convergence of different conditions – EA Wizard

  • #269131 |
    Customer
    4 Posts

    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

    #269152
    tomas262
    Administrator
    1823 Posts

    Hello,

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

    #269159
    Customer
    4 Posts

    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.

    #269266
    tomas262
    Administrator
    1823 Posts

    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)

    #269292
    Customer
    4 Posts

    Could you make an example in EA Wizard please?

    I fear I didn’t undertand well.

    #269306
    tomas262
    Administrator
    1823 Posts

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

    #269307
    Customer
    4 Posts

    Older please, I need a custom indicator to use.

    #269382
    tomas262
    Administrator
    1823 Posts

    You can check the example attached

    Attachments:
    You must be logged in to view attached files.
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.