Nufty:
Hi
New to coding but not new to FX or EAs !!
I am wanting to try an ea that works like discribed - I feel my logic is right, but its not taking the right trades - basically it ignores the SMA indicator, and every bar is printing in the journal that their is a buy and a sell signal
This is your problem, it's a question of {} braces
if ((Open[2] < SMA && Close[2] > SMA)) MAFIB="true"; // if the test is true just set MAFIB = "true" { // the code in braces will always happen Print ("SMA says BUY"); }
Also, don't use strings here, use bool . . .
string MAFIB="false";string MAFIS="false"; // instead do this bool MAFIB = false, MAFIS = false;
then this code changes . . .
if ((Open[3] < Close[3] ) && (Open[2] < Close[2] ) && (Open[1] < Close[1]) && (Close[1] < Bid) && MAFIB ) // && MAFIB is the same as && MAFIB == true
Thanks RaptorUK
I will add this and see how it runs
Cheers
Nufty

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
Hi
New to coding but not new to FX or EAs !!
I am wanting to try an ea that works like discribed - I feel my logic is right, but its not taking the right trades - basically it ignores the SMA indicator, and every bar is printing in the journal that their is a buy and a sell signal
Which should be impossible
Can someone suggest a better way to code this for a newbie like me??
THANKS
Appreciate the help
Nufty