Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-02-2006, 07:22 PM
zeroz zeroz is offline
Member
 
Join Date: Jan 2006
Location: NYC
Posts: 32
zeroz is on a distinguished road
Question about programming AMA logic into an EA

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.
Attached Images
File Type: jpg AMA.JPG (214.4 KB, 81 views)
Attached Files
File Type: mq4 AMA.mq4 (3.4 KB, 25 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-05-2006, 12:30 AM
zeroz zeroz is offline
Member
 
Join Date: Jan 2006
Location: NYC
Posts: 32
zeroz is on a distinguished road
Anyone have any ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-05-2006, 12:51 AM
forexerrr forexerrr is offline
Junior Member
 
Join Date: Nov 2006
Posts: 5
forexerrr is on a distinguished road
a good qustion me too i want to learn ea programmation
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-05-2006, 01:40 AM
andee's Avatar
andee andee is offline
Junior Member
 
Join Date: Mar 2006
Posts: 19
andee is on a distinguished road
please check....

i dont know how to start, but if i make some EA from indicator like AMA or another, i would use iCustom....

PHP Code:
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==&& AMAUpNow !=&& AMADnNow==0)
Order=SIGNALBUY;

if(
AMAUpNow == && AMADnPrev==&& 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

Last edited by andee : 12-05-2006 at 01:43 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-09-2006, 08:13 PM
zeroz zeroz is offline
Member
 
Join Date: Jan 2006
Location: NYC
Posts: 32
zeroz is on a distinguished road
Ah, yea. I didn't see that I could use the independent buffers through the iCustom function. Using the global var was a bit convoluted. Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Question... omelette General Discussion 6 12-12-2006 02:29 AM
Programming question using Close[] knili Metatrader 4 7 08-31-2006 07:35 PM
Indicator Programming Question cubesteak Indicators - Metatrader 4 5 08-05-2006 09:25 AM
a question on mt4 programming huaxia009 Metatrader 4 3 05-31-2006 03:10 AM


All times are GMT. The time now is 10:30 PM.