Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-02-2006, 08:22 PM
Member
 
Join Date: Jan 2006
Location: NY
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, 135 views)
Attached Files
File Type: mq4 AMA.mq4 (3.4 KB, 38 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 12-05-2006, 01:30 AM
Member
 
Join Date: Jan 2006
Location: NY
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 12-05-2006, 01:51 AM
Junior Member
 
Join Date: Nov 2006
Posts: 3
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 12-05-2006, 02:40 AM
andee's Avatar
Member
 
Join Date: Mar 2006
Posts: 45
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 02:43 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 12-09-2006, 09:13 PM
Member
 
Join Date: Jan 2006
Location: NY
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
icustom ama


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

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


All times are GMT. The time now is 03:56 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.