Forex



Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register More recent 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 04-01-2008, 02:54 AM
Member
 
Join Date: Nov 2006
Posts: 36
winias is on a distinguished road
EA building 101 question Need Help please!

Hi there -
I have a simple problem and figured this was the bast place to turn to for some helpful advice. I have a very simple ea I put together from the following website:

Expert Advisor Builder for MetaTrader 4

I'm not a programmer, and thought this was the best place to put my ideas to work (instead of posting my brain online here ). The ea works, no doubt about that, and has been giving me some good entries.

My problem comes when it opens a trade, and the buy or sell signal is continued on the next bar, it closes the current buy and starts a new one, creating multiple trades (usually losses) over and over again in a short time span. How do I allow it to only trade once, until the close buy signal is generated?

To my willing experts out there, thank you in advance!
S.
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 04-01-2008, 03:04 AM
Senior Member
 
Join Date: Oct 2007
Posts: 230
Dave137 is on a distinguished road
Wink

TRADE ONLY ONCE ON BAR



Up at the top where you declare your variables put


static bool ITradedOnThisBar;


then where you send your order put


if(Your Critera && ITradedOnThisBar!=Bars)
{
ticket=OrderSend(Symbol(),OP_BUY,... );
ITradedOnThisBar = Bars;
}


Doing This will keep you from opening a trade on the same bar that you already opened a trade on, but more importantly you want to keep it from closing on the same bar so I would also add this code where you close your trade, for example:

if(Your Criteria && ITradedOnThisBar != Bars)
{
OrderClose(OrderTicket(),... ); // close position
}

This is probably the most simple way to do what you are trying to do.


This works if you can find the places to add these statements.
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 04-01-2008, 03:13 AM
Senior Member
 
Join Date: Oct 2007
Posts: 230
Dave137 is on a distinguished road
Smile

Another possibility that is causing your problem is the close of buy and sell statement setting are set and activating very close to your opening buy and sell entry statement setting....Such as buy open at RSI > 60 and Closing the RSI positions < 50. If the RSI is ranging up and down because of price volatility you will be entering and exiting quite frequently. Check how the program statements work by studying the enter and exit points on the graph by expanding the bars and see how they correspond to your in and out logic of your program.
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 04-01-2008, 04:26 AM
Member
 
Join Date: Nov 2006
Posts: 36
winias is on a distinguished road
Thank you!

Thank you Dave! It seems the close buy logic was holding the issue, but I'm certain your other respose will serve me well down the line. I didnt rationalize too well how the code wouldn't do as I wished it to right off the bat. I'm pretty impressed with this little website otherwise; its allowed me to put my mental garbage to good use . After I fixed this problem my results shot up to an 85% win rate; not bad for a first attempt. Keep you posted and I appreciate, very much, the reply.
S.
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


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
Building EA indicator MA profeta Suggestions for Trading Systems 1 03-07-2007 12:47 AM
Part-Time Wealth Building System-Weekly james2ko Expert Advisors - Metatrader 4 5 01-30-2007 11:07 PM
EA question yaniv_av Expert Advisors - Metatrader 4 1 11-14-2006 01:10 PM


All times are GMT. The time now is 09:41 PM.



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