Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Suggestions for Trading Systems


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 05-02-2006, 08:44 AM
Member
 
Join Date: Dec 2005
Posts: 52
hoosain is on a distinguished road
Trade Once Only - Coding Help needed

Hi, I have an EA that is working quite well. The problem is that in a fast moving market (based on 30min EUR/USD chart) it will open and close two or more trades in the 30min period. What happens is that quite often it will lose on the second or third trade. What I want it to do is to only trade ONCE on a 30min bar. Once a trade has been entered it MUST NOT trade again for at least the next 30mins to an hour. Any help appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-02-2006, 12:34 PM
Junior Member
 
Join Date: Apr 2006
Posts: 16
chinplant is on a distinguished road
You can avoid duplicating orders by using Time[0] which returns value of current bar's open time.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-02-2006, 12:42 PM
firedave's Avatar
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
Like chinplant suggest, you could use this trick :

Code:
datetime
         CheckTime;


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
{
   return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
{
   return(0);
}


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
{

//----------------------- CHECK FOR NEW BAR
   if(CheckTime!=iTime(NULL,TimeFrame,0))
   {
      CheckTime = iTime(NULL,TimeFrame,0);

//----------------------- YOUR ENTRY AND EXIT CONDITION

   }

//----------------------- YOUR TRAILING STOP FUNCTION

}
Hope this help
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-02-2006, 01:41 PM
Member
 
Join Date: Dec 2005
Posts: 52
hoosain is on a distinguished road
Many thanks guys. much appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-02-2006, 01:46 PM
Junior Member
 
Join Date: Dec 2005
Posts: 9
akiruis is on a distinguished road
Or as simply as:

...

if(CheckTime!=Time[0])
CheckTime = Time[0];

...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-02-2006, 02:01 PM
firedave's Avatar
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
Quote:
Originally Posted by akiruis
Or as simply as:

...

if(CheckTime!=Time[0])
CheckTime = Time[0];

...
Yes, that's also could do the trick
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl 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 On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Very basic coding help needed camisa Questions 1 05-08-2006 05:36 PM
Coding Needed nnjeim Metatrader 4 1 03-15-2006 05:18 AM
Help coding a cam indicator needed. DanielTyrkiel Suggestions for Trading Systems 5 11-29-2005 12:48 PM


All times are GMT. The time now is 09:35 AM.



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