Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4






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
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-08-2008, 05:08 PM
Junior Member
 
Join Date: Nov 2006
Posts: 21
icepeak is on a distinguished road
Help with an EA

I put together an EA that seems to work quite well, when it works right. There is a glitch that I can't figure out. I use moving averages as a filter and sometimes it places a trade when it shouldn't according the the MAs. I think the problem is with the process the platform goes through when reading the code and not updating the values often enough.

I know that is vague and posting the file would make matters easier. I am not ready to give it out publicly, but am looking for somebody that may be willing to help me figure it out. PM me if you are interested.
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-08-2008, 05:28 PM
Member
 
Join Date: Apr 2007
Posts: 50
dunhill is on a distinguished road
is your strategy looking to the last closed bar

or is the ea reading the current tick iMA?
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-08-2008, 05:32 PM
Junior Member
 
Join Date: Nov 2006
Posts: 21
icepeak is on a distinguished road
It does check the last price so it should recalculate every tick. This is what I have for the iMA.

Code:
double RSI = iRSI(NULL, RSI_TF, RSI_PERIOD, PRICE_CLOSE, 0);
double MA5S = iMA(Symbol(),PERIOD_M5,MASlow,0,MODE_SMA, PRICE_CLOSE, 0);
double MA5F = iMA(Symbol(),PERIOD_M5,MAFast,0,MODE_SMA, PRICE_CLOSE, 0);
double MA1 = iMA(Symbol(),PERIOD_H4,MAPeriod,0, MODE_SMA, PRICE_CLOSE, 0);
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-08-2008, 05:47 PM
Member
 
Join Date: Apr 2007
Posts: 50
dunhill is on a distinguished road
so your ea is taking trade when it should not? or not yet?

sometimes current tick iMA crossed on a few tick and then back-off

could this be the cause of your ea's problems.
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-08-2008, 05:52 PM
Junior Member
 
Join Date: Nov 2006
Posts: 21
icepeak is on a distinguished road
It places a trade when it should not, but only after several hours. For example, last night on the EURUSD it went short when it should have been looking for buys. The MAs crossed over and instead of changing the direction for sell to buy, it continued looking for shorts.
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
  #6 (permalink)  
Old 12-08-2008, 06:01 PM
jimven's Avatar
Senior Member
 
Join Date: Mar 2007
Location: Upstate New York
Posts: 140
jimven is on a distinguished road
Quote:
Originally Posted by icepeak View Post
It places a trade when it should not, but only after several hours. For example, last night on the EURUSD it went short when it should have been looking for buys. The MAs crossed over and instead of changing the direction for sell to buy, it continued looking for shorts.
This could have something to do with how you're detecting the MA crossovers. For example, if you buy when the fast MA crosses up over the slow MA and sell when the fast MA crosses back down over the slow MA, and you don't filter it any more than that, you're going to get into trouble, especially if you're judging the result based on the most recent bar (shift = 0).

When the two MAs are really close together and then start crossing, they might cross both up and down repeatedly, giving you false trading signals, possibly in both directions in a short period of time.

You've got to program some kind of threshold to cross before you accept a cross up or a cross down so it doesn't whipsaw.
__________________
Success is more perspiration than inspiration . . .
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
  #7 (permalink)  
Old 12-08-2008, 06:09 PM
Member
 
Join Date: Apr 2007
Posts: 50
dunhill is on a distinguished road
icepeak, will you post a little more of your trade logic - at least just the part where conditions for long and sell are

then we'll see where the error could be
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
  #8 (permalink)  
Old 12-08-2008, 06:12 PM
Junior Member
 
Join Date: Nov 2006
Posts: 21
icepeak is on a distinguished road
Here it is

I'll attach the file. I think that will help out more and I really want to get this working right. It sometimes places trades several bars passed the cross.

I put it on a 5 min chart. The parameters are good for the EURUSD, USDCHF, and USDJPY. I set tighter parameters for the GBPUSD and USDCAD. It enters long if the 4 hr 100 sma is below the current price and the 100 sma on the 5 is above the 200 sma. The RSI must be less than 30. Reverse all that and the RSI must be greater than 70 to go short.

It exits the trade when the RSI hits 63 for a buy and 37 for a sell. It does add to the position if it is negative 30 pips and locks in profit at +40.

I am not a programmer so I just cut and pasted code from a few different EAs and made some adjustments so the code may be a little messy and I didn't add many comments because I didn't intend on giving it out. This particular file is set up for a mini account because I am trading live with it.
Attached Files
File Type: mq4 Viking_1.7mini.mq4 (8.9 KB, 26 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
  #9 (permalink)  
Old 12-08-2008, 06:53 PM
Member
 
Join Date: Apr 2007
Posts: 50
dunhill is on a distinguished road
Quote:
Originally Posted by icepeak View Post
It places a trade when it should not, but only after several hours. For example, last night on the EURUSD it went short when it should have been looking for buys. The MAs crossed over and instead of changing the direction for sell to buy, it continued looking for shorts.
can you check your lastnight's trade if it went short because it is adding a short position due to negative 30 pip
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
  #10 (permalink)  
Old 12-08-2008, 06:55 PM
Junior Member
 
Join Date: Nov 2006
Posts: 21
icepeak is on a distinguished road
Last nights trade

It wasn't. There were 12 candlesticks between closing positions of an earlier trade and placing a new trade on the eurusd and 14 between on the usdcad.
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

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


All times are GMT. The time now is 06:34 PM.



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