Anyone have any ideas?
a good qustion me too i want to learn ea programmation
please check....
i dont know how to start, but if i make some EA from indicator like AMA or another, i would use iCustom....
extern int shift=1;
//indicator setting
int periodAMA=9;
int nfast=2;
int nslow=30;
double G=2.0;
double dK=2.0
//define some signal
#define SIGNALBUY 1
#define SIGNALSELL 2
.
.
int Order;
//indicator
double AMAUpNow = iCustom(Symbol(),0,"AMA",periodAMA,nfast,nslow,G,dK,1,shift);
double AMAUpPrev = iCustom(Symbol(),0,"AMA",periodAMA,nfast,nslow,G,dK,1,shift+1);
double AMADnNow = iCustom(Symbol(),0,"AMA",periodAMA,nfast,nslow,G,dK,2,shift);
double AMADnPrev = iCustom(Symbol(),0,"AMA",periodAMA,nfast,nslow,G,dK,2,shift+1);
if(AMAUpPrev==0 && AMAUpNow !=0 && AMADnNow==0)
Order=SIGNALBUY;
if(AMAUpNow == 0 && AMADnPrev==0 && AMADnNow!=0)
Order=SIGNALSELL;
i hope this help u, but sorry i write this with notepad, so i don't know that any sintax was wrong....
sorry for my bad english, but if anyone here speak indonesian that would help
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How would I go about creating an EA using the AMA(Kaufman) that enters positions on the bar after a colored ball appears? Do I need to put the AMA logic into the EA or should I be using global variables? I have a bit of programming knowledge, however in my tests using a global variable the EA only trades in one direction.
The logic in the indicator that I think identifies whether a ball appears or not is :
if ((MathAbs(ddK)) > (dK*Point) && (ddK > 0)) kAMAupsig[pos]=AMA; else kAMAupsig[pos]=0;
if ((MathAbs(ddK)) > (dK*Point) && (ddK < 0)) kAMAdownsig[pos]=AMA; else kAMAdownsig[pos]=0;
So what I did was put " datetime AMASig = GlobalVariableSet(string "AMASig", double ddK);" into the indicator to pull out the ddK. Then, in the EA I put:
if ((MathAbs(ddK)) > (dK*Point) && (ddK > 0))sig=1;
if ((MathAbs(ddK)) > (dK*Point) && (ddK < 0)) sig=2;
Where sig 1 is a buy and sig 2 is a sell, however the problem I described above persists. The EA only trades in one direction.
Thanks for any help!
Pictures and indicator attached.