Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


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
  #11 (permalink)  
Old 02-23-2008, 11:33 AM
Junior Member
 
Join Date: Apr 2007
Location: Malaysia
Posts: 24
azam575 is on a distinguished road
Code Block for MM for EA

Ok....like to share code block for MM

Code:
extern string     MM_Parameters    = " MoneyManagement by L.Williams ";
extern bool       MM               =   true; // ΜΜ Switch
extern double     MaxRisk          =    0.04; // Risk Factor
extern double     LossMax          =       0; // Maximum Loss by 1 Lot

<------------------------------------------------------

double MoneyManagement()
{
   double lot_min =MarketInfo(Symbol(),MODE_MINLOT);
   double lot_max =MarketInfo(Symbol(),MODE_MAXLOT);
   double lot_step=MarketInfo(Symbol(),MODE_LOTSTEP);
   double contract=MarketInfo(Symbol(),MODE_LOTSIZE);
   double vol;
//--- check data
   if(lot_min<0 || lot_max<=0.0 || lot_step<=0.0) 
   {
   Print("CalculateVolume: invalid MarketInfo() results [",lot_min,",",lot_max,",",lot_step,"]");
   return(0);
   }
   if(AccountLeverage()<=0)
   {
   Print("CalculateVolume: invalid AccountLeverage() [",AccountLeverage(),"]");
   return(0);
   }
//--- basic formula
   if ( MM )
   {
   vol=NormalizeDouble(AccountFreeMargin()*MaxRisk*AccountLeverage()/contract,2);
   Print("Margin=",AccountFreeMargin()," r=",MaxRisk," lev=",AccountLeverage()," cont=",contract);
   }
   else
   vol=Lots;
//--- check min, max and step
   vol=NormalizeDouble(vol/lot_step,0)*lot_step;
   if(vol<lot_min) vol=lot_min;
   if(vol>lot_max) vol=lot_max;
//---
   return(vol);
}   

<------------------------------------------

then use it like example below

OrderSend(Symbol(),OP_SELL,MoneyManagement(),Bid,3,SL,TP,KOMEN,MAGICNO,0,Red);
Hope u all understand
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 02-24-2008, 04:59 PM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Smile Testing Buy Or Sell Right At Close Of Current Bar

This is a great little test to see whether the current bar meets or exceeds your buy or sell condition on the current bar right near the close of the current bar.

Without this test the condition may have been met earlier in the current bar and is already reversing in the wrong direction by the close of the current bar. To wait for the next bar may result in a rapid gap up or down in the desired direction leaving you behind in the dust or rapid gapping up or down in the undesired direction!

Dave

Have a Blessed Day in the Lord!

Last edited by Dave137; 02-28-2008 at 04:21 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 02-28-2008, 04:36 AM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Smile

Found this .zip on the forum - A bunch of custom .wav files for custom sounds to include in your ea. Open the zip and view!

Dave
Attached Files
File Type: zip sounds-wav files.zip (817.2 KB, 25 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 02-29-2008, 05:53 AM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Smile

View buffer values of indicator buffers easily!

Ctrl-D

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 02-29-2008, 06:43 PM
Senior Member
 
Join Date: Jan 2007
Location: not so remote
Posts: 2,242
fxbs is on a distinguished road
Hi, Dave!
very god idea - and as Omelette mentioned - different cases- different solutions - we also need to add link to whole indi where problem was solved in certain way
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 03-04-2008, 03:04 PM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Red face

I would have to think about that - Very limited time on my hands, and I am still struggling to find or create a ea system that works reliably. I used the Best ea's recently listed on this forum along with my own creation ea and both got beat up last night in demo trading.

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 03-27-2008, 04:52 AM
MANSTIR's Avatar
Senior Member
 
Join Date: Nov 2007
Posts: 143
MANSTIR is on a distinguished road
if ((todayGap>=10) && isTradingTime) Order = SIGNAL_BUY;
if ((todayGap<=10) && isTradingTime) Order = SIGNAL_SELL;

whats todayGap>=10?
whats todayGap<=10?
whats &&?
whats isTradingTime?

can u tell me the meaning of this code?

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 03-27-2008, 08:50 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 723
wolfe is on a distinguished road
Quote:
Originally Posted by MANSTIR View Post
if ((todayGap>=10) && isTradingTime) Order = SIGNAL_BUY;
if ((todayGap<=10) && isTradingTime) Order = SIGNAL_SELL;

whats todayGap>=10?
whats todayGap<=10?
whats &&?
whats isTradingTime?

can u tell me the meaning of this code?

thanks
todayGap has got to be defined somewhere else in the code, find that and it will tell you what it means.

>=10 (greater than or equal to 10)
<=10 (less than or equal to 10)

&& (simply means and)

if ((todayGap<=10) && isTradingTime) Order = SIGNAL_SELL;

This if statement simply says that if todayGap is less than or equal to 10 and isTradingTime(if time falls within set trading time parameters) then Order = SIGNAL_SELL.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 03-29-2008, 12:24 PM
MANSTIR's Avatar
Senior Member
 
Join Date: Nov 2007
Posts: 143
MANSTIR is on a distinguished road
thanks so much my friends... many hours need to learn this language...

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
Something interesting please post here newdigital Indicators - Metatrader 4 774 12-02-2008 03:06 AM
Can someone please post HMA_v2.mq4 please? increase General Discussion 4 09-19-2007 08:33 AM
hello, I'm new here and this's my first post StrawberryCheezeCake General Discussion 1 03-31-2007 01:02 AM
Post on a Forum fulfab Metatrader 4 0 11-12-2006 02:06 PM


All times are GMT. The time now is 12:23 PM.



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