Is possible?
You can check this yourself?
Use either Print or Comment() or the debugger or the strategy tester in visualmode.
if(iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 10, 6, 5, 0, 1, 0, 6, 1+i) < iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 10, 6, 5, 0, 1, 0, 7, 1+i)
&& iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 10, 6, 5, 0, 1, 0, 6, 2+i) > iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 10, 6, 5, 0, 1, 0, 7, 2+i) //MACD_Lnx_v1 crosses below MACD_Lnx_v1
&& iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 2, 6, 3, 0, 1, 0, 7, 1+i) > 0
&& iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 2, 6, 3, 0, 1, 0, 7, 2+i) < 0
&& iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 10, 6, 5, 0, 1, 0, 6, 2+i) > iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 10, 6, 5, 0, 1, 0, 7, 2+i) //MACD_Lnx_v1 crosses below MACD_Lnx_v1
&& iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 2, 6, 3, 0, 1, 0, 7, 1+i) > 0
&& iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", 2, 6, 3, 0, 1, 0, 7, 2+i) < 0
- Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code.
- Detailed explanation of iCustom - MQL4 forum Make your code readable and drop useless comment
#define BUF6 6 // A description name for buffer # 6 #define BUF7 7 // A description name for buffer # 7 double Lnx(int L, int M, int S, int B, int i){ return iCustom(NULL, PERIOD_CURRENT, "MACD_Lnx_v1", L, M, S, 0, 1, 0, B, i); } double LnxSlow(int B,int i){ return Lnx(10, 6, 7, B, i); } double LnxFast(int B,int i){ return Lnx( 2, 6, 3, B, i); } : double slow6cur = LnxSlow(BUF6, i+1); // use descriptive variable names. double slow7cur = LnxSlow(BUF7, i+1); double slow6pre = LnxSlow(BUF6, i+2); double slow7pre = LnxSlow(BUF7, i+2); double fast7cur = LnxFast(BUF7, i+1); double fast7pre = LnxFast(BUF7, i+2); if(slow6cur < slow7cur && slow6pre > slow7pre //MACD_Lnx_v1 crosses below MACD_Lnx_v1 && fast7cur > 0 && fast7pre < 0
- Your if says the two different periods must cross on the same bar. Unlikely. More likely you want both to agree.
bool isSlowRising = slow6cur < slow7cur; bool isFastRising = fast7cur > 0; bool isSignal = isSlowRising && isFastRising; bool wasSlowRising = slow6pre < slow7pre; bool wasFastRising = fast7pre > 0; bool wasSignal = wasSlowRising && wasFastRising; bool signal = isSignal && !wasSignal;
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I would rather that the MACD 10 6 5 a cross-time need to wait for the MACD 2 6 3 then gives me the signal.
How could I do? Unfortunately I am a neophyte.
Thank you