Coding multiple strategy according to RSI level
Why are you declaring x to numbers inside the if else conditions.
if ((X=1)&&((RSIX<RSIU1)&&(RSIX>RSID1))) X=0; if ((X=0)&&(((RSIX>RSIU1)&&(RSIX<RSIU2))||((RSIX<RSID1)&&(RSIX>RSID2)))) X=1; if ((X=1)&&(RSIX>RSIU2)) X=2; if ((X=1)&&(RSIX<RSID2)) X=-2; if ((X=-2)&&(RSIX>RSIU1)) X=1; if ((X=2)&&(RSIX<RSID1)) X=1
Shouldn't they be like this
if ((X==1) && ((RSIX<RSIU1)&&(RSIX>RSID1))) X=0; if ((X==0) && (((RSIX>RSIU1)&&(RSIX<RSIU2))||((RSIX<RSID1)&&(RSIX>RSID2)))) X=1; if ((X==1) && (RSIX>RSIU2)) X=2; if ((X==1) && (RSIX<RSID2)) X=-2; if ((X==-2) && (RSIX>RSIU1)) X=1; if ((X==2) && (RSIX<RSID1)) X=1
ceaser234:
Why are you declaring x to numbers inside the if else conditions.
Shouldn't they be like this
Thanks, it looks so obvious I couldn't see it by myself.
I'm sure it will work fine now, I will implement the changes.
Bests,
Andrea
pipokito:
Wishes you Best :D
Thanks, it looks so obvious I couldn't see it by myself.
I'm sure it will work fine now, I will implement the changes.
Bests,
Andrea
Dear all,
I'm building a multiple strategy based on the RSI levels:
Between 30 and 70 use a certain strategy: Strategy N°0
Between 70 and 85 or 30 and 15 I use strategy N°1
And between 0 and 15 or 85 and 100 I use strategy N°2 (Although in order to move back to another strategy from srategy N°2 the RSI level has to reach the opposite RSI limit)
I have tried to code this with the following MQL4 code but it didn't work. The value of X was stuck to 1 or 2 or -2 and 1 depending on the order of my instructions.
The idea was then to say if X = ... then use strategy N°...
Can someone enlight me or advise me on a simpler way to translate these instructions in MQL4
Thanks!
Andrea