Enter trades on multiple conditions – help needed please

Forums ProRealTime English forum ProOrder support Enter trades on multiple conditions – help needed please

Viewing 5 posts - 1 through 5 (of 5 total)
  • #188218

    Hi all,

    apologies if this is a basic question that was answered before, but I am trying to create a strategy that enters long/short depending on Fib retracement crossings and MA and am struggling to find the right code.

    Basically, I am defining 20 conditions (10 for long, 10 for short). 1 and 11 are conditions that I always want to be met (c1 for long, c11 for short). For long entry, I want c1 AND either of c2-c10 met, for short c11 AND either of c12-20. I have tried everything from using OR, ELSIF or separate IF ENDIF statements but nothing works.

    Does anyone know how to write this?

    Thanks a lot in advance! 🙂

    #188220

    You would need to post your code else we all be guessing what / how you have coded.

    1 user thanked author for this post.
    #188221

    Absolutely, makes sense! I found my mistake myself, the answer is to include the AND statement in the condition definition itself before starting IF statement. At least it works for me now. Example below:

    // Conditions to enter long positions
    indicator1 = Average[100](close)
    c1 = (close > indicator1)
    // c2 as indicator2 AND c1
    indicator2 = (((DHigh(1) + DLow(1) + DClose(1))/3 – (DHigh(1)-DLow(1)))+((DHigh(1) + DLow(1) + DClose(1))/3 – (.618 * (DHigh(1)-DLow(1))))) /2
    c2 = (close CROSSES OVER indicator2 AND c1)

     

    #188228

    Make sure you test your strategy on Demo Account ONLY until you are happy it makes money on a regular basis / over 50 to 100 trades at least!

     

    #188231

    There you go (you may also add Not Onmarket + Trading hours and Days to General Conditionms):

    1 user thanked author for this post.
Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login