Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > 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
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-28-2007, 09:49 AM
Junior Member
 
Join Date: Jan 2007
Posts: 5
traderdavid is on a distinguished road
Improving trading systems...

Hi, just thought id add a note on how you can improve your trading systems...
I think it's best to put the OrderClose and OrderSend functions in a critical section - ie. lock them when they are being executed as, in general, they can take longer to execute.

Here's how to add a critical section to your code; it's mutual exclusion:

PHP Code:
bool is_locked false;

void lock(){
   
is_locked true;
}

void unlock(){
   
is_locked false;
}

bool isLocked(){
   return (
is_locked);

Then to use it, just do the following:

PHP Code:

if(isLocked() != true){
   
lock();
   
OrderSend(....);
   
unlock();

Many of you will find that this improves backtesting results. And it's good practice for critical sections, especially for live trade. Hope it helps!

TraderDavid.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-28-2007, 09:51 AM
Junior Member
 
Join Date: Jan 2007
Posts: 5
traderdavid is on a distinguished road
btw...

btw... you can use the locks on any section you think is critical - not just ordersend, etc.

any section which should execute atomicly should be locked executed, then unlocked - to ensure it executes as a whole before being interfered with again.

traderdavid.
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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
D'Alembert-Based Trading Systems WNW Suggestions for Trading Systems 40 11-21-2007 04:02 PM
DayImpuls indicators (for Zigzag Trading Systems) newdigital Indicators - Metatrader 4 12 10-07-2007 09:41 AM
Systems Combination Trading System (SCTM) - Lesser whipsaw dit Suggestions for Trading Systems 29 02-16-2007 05:19 AM
RD Systems newdigital Manual trading systems 0 12-05-2005 02:52 PM


All times are GMT. The time now is 04:51 AM.



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