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 (1) Thread Tools Display Modes
  #261 (permalink)  
Old 06-15-2007, 07:55 PM
TimeFreedom's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 484
TimeFreedom is on a distinguished road
Money Mangement - Ryan Jones Fixed Ratio Code

The current Fixed Ratio code works just fine, but I would like to consolidate the following code currently it is coded to add 20 lots.

PHP Code:
void FixedRatioMM()

{
if (
MM == True)
{
if (
AccountEquity() >= InitialCapital && AccountEquity() < (InitialCapital+(1*Delta))) {MMLots=1*Lots;}
if (
AccountEquity() > (InitialCapital + (1*Delta)) && AccountEquity() < (InitialCapital+(3*Delta))) {MMLots=2*Lots;}
if (
AccountEquity() > (InitialCapital + (3*Delta)) && AccountEquity() < (InitialCapital+(6*Delta))) {MMLots=3*Lots;}
if (
AccountEquity() > (InitialCapital + (6*Delta)) && AccountEquity() < (InitialCapital+(10*Delta))) {MMLots=4*Lots;}
if (
AccountEquity() > (InitialCapital + (10*Delta)) && AccountEquity() < (InitialCapital+(15*Delta))) {MMLots=5*Lots;}
if (
AccountEquity() > (InitialCapital + (15*Delta)) && AccountEquity() < (InitialCapital+(21*Delta))) {MMLots=6*Lots;}
if (
AccountEquity() > (InitialCapital + (21*Delta)) && AccountEquity() < (InitialCapital+(28*Delta))) {MMLots=7*Lots;}
if (
AccountEquity() > (InitialCapital + (28*Delta)) && AccountEquity() < (InitialCapital+(36*Delta))) {MMLots=8*Lots;}
if (
AccountEquity() > (InitialCapital + (36*Delta)) && AccountEquity() < (InitialCapital+(45*Delta))) {MMLots=9*Lots;}
if (
AccountEquity() > (InitialCapital + (45*Delta)) && AccountEquity() < (InitialCapital+(55*Delta))) {MMLots=10*Lots;}
if (
AccountEquity() > (InitialCapital + (55*Delta)) && AccountEquity() < (InitialCapital+(66*Delta))) {MMLots=11*Lots;}
if (
AccountEquity() > (InitialCapital + (66*Delta)) && AccountEquity() < (InitialCapital+(78*Delta))) {MMLots=12*Lots;}
if (
AccountEquity() > (InitialCapital + (78*Delta)) && AccountEquity() < (InitialCapital+(91*Delta))) {MMLots=13*Lots;}
if (
AccountEquity() > (InitialCapital + (91*Delta)) && AccountEquity() < (InitialCapital+(105*Delta))) {MMLots=14*Lots;}
if (
AccountEquity() > (InitialCapital + (105*Delta)) && AccountEquity() < (InitialCapital+(125*Delta))) {MMLots=15*Lots;}
if (
AccountEquity() > (InitialCapital + (125*Delta)) && AccountEquity() < (InitialCapital+(141*Delta))) {MMLots=16*Lots;}
if (
AccountEquity() > (InitialCapital + (141*Delta)) && AccountEquity() < (InitialCapital+(158*Delta))) {MMLots=17*Lots;}
if (
AccountEquity() > (InitialCapital + (158*Delta)) && AccountEquity() < (InitialCapital+(176*Delta))) {MMLots=18*Lots;}
if (
AccountEquity() > (InitialCapital + (176*Delta)) && AccountEquity() < (InitialCapital+(195*Delta))) {MMLots=19*Lots;}
if (
AccountEquity() > (InitialCapital + (195*Delta)) && AccountEquity() < (InitialCapital+(215*Delta))) {MMLots=20*Lots;}
}
else 
MMLots Lots;

TimeFreedom
__________________
"Believe none of what you hear and half of what you see."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #262 (permalink)  
Old 06-21-2007, 08:59 PM
Member
 
Join Date: Mar 2007
Posts: 38
Blog Entries: 1
blueocean is on a distinguished road
Ryan Jones

Hello there,
I paid almost 2500 dollars for his EA, which sucks. I would have been better to give that money to a worthy charity.When I wrote to him, he said it works for him. full of B*** S***, if he sold lets say 100 EAs, his move is most certainly in bullish mode.

blueocean
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #263 (permalink)  
Old 06-21-2007, 09:34 PM
mladen's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 332
mladen is on a distinguished road
Not quite the same

PHP Code:
   if (MM == True
   {
      
int i,n=0;
      if (
AccountEquity() >= InitialCapital)
         {
            for (
i=1;i<=20;i++)
               {
                  
+= i;
                  if (
AccountEquity() < (InitialCapital+(n*Delta)))
                     {
                         
MMLots=i*Lots
                         break;
                     }
               }
         }                     
   } 
   else 
MMLots Lots
You have ">=" only on first if

Last edited by mladen; 06-21-2007 at 10:03 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #264 (permalink)  
Old 07-04-2007, 04:20 AM
kjhfdgjfhdghdf's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 679
kjhfdgjfhdghdf is on a distinguished road
What is code to put stop to break even?

Does anyone know how I can add some code to my ea to have stop set to break even or even have context when adding to however many I want?
extern double BreakEven = 0;

Theres that bit but what code do I actually put?
__________________
http://en.wikipedia.org/wiki/Probability
In a deterministic universe, based on Newtonian concepts, there is no probability if all conditions are known.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #265 (permalink)  
Old 07-05-2007, 01:37 PM
kjhfdgjfhdghdf's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 679
kjhfdgjfhdghdf is on a distinguished road
Angry

IS THERE SOMEWAY TO PUT A BREAK EVEN STOP LOSS!!!!!
__________________
http://en.wikipedia.org/wiki/Probability
In a deterministic universe, based on Newtonian concepts, there is no probability if all conditions are known.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #266 (permalink)  
Old 07-05-2007, 01:46 PM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 439
ryanklefas is on a distinguished road
Quote:
IS THERE SOMEWAY TO PUT A BREAK EVEN STOP LOSS!!!!!
Dang. Chill out. Here is code I use for most of my EAs, simplified for your request.

Code:
void breakEvenManager() 
{

   for(int cnt=0;cnt<OrdersTotal();cnt++)
   {
   OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

      if (BreakEven>0 )
      {
         if (OrderType()==OP_BUY)
         {
            if (Bid-OrderOpenPrice()>=Point*BreakEven)
            {
               if (OrderStopLoss()<OrderOpenPrice()  || OrderStopLoss()==0)
                  OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice() ,OrderTakeProfit(),0,Green); 
            }
         }
         else if (OrderType()==OP_SELL)
         {
            if (OrderOpenPrice()-Ask>=Point*BreakEven)
            {
               if (OrderStopLoss()>OrderOpenPrice() || OrderStopLoss()==0)
                  OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice() ,OrderTakeProfit(),0,Red); 
            }
         }
      }
   }


}
__________________
"Don't work harder, work smarter." -- my Java professor

Coder for Hire:
http://www.firecell-fx.com

Last edited by ryanklefas; 07-05-2007 at 01:52 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #267 (permalink)  
Old 07-05-2007, 04:56 PM
kjhfdgjfhdghdf's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 679
kjhfdgjfhdghdf is on a distinguished road
Thanks, but that doesnt fit with the extern breakeven thing.
I put it in says, Function "breakEvenManager" is not referenced and will be removed.
__________________
http://en.wikipedia.org/wiki/Probability
In a deterministic universe, based on Newtonian concepts, there is no probability if all conditions are known.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #268 (permalink)  
Old 07-05-2007, 05:25 PM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 439
ryanklefas is on a distinguished road
Quote:
Originally Posted by kjhfdgjfhdghdf View Post
Thanks, but that doesnt fit with the extern breakeven thing.
I put it in says, Function "breakEvenManager" is not referenced and will be removed.
You have to call the module at some point in your code.
__________________
"Don't work harder, work smarter." -- my Java professor

Coder for Hire:
http://www.firecell-fx.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #269 (permalink)  
Old 07-07-2007, 05:37 AM
Junior Member
 
Join Date: Jun 2006
Location: Egypt
Posts: 17
zidan66 is on a distinguished road
i need help in simpel code

hi all
i neeed some one can help in simpel code that reverse the order when it lost and open same order if it won, and the first order will opened manually , set any takeprofit and stopand

thanx for help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #270 (permalink)  
Old 07-08-2007, 03:27 AM
Junior Member
 
Join Date: Jun 2006
Location: Egypt
Posts: 17
zidan66 is on a distinguished road
mmmmmmm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
Posted By For Type Date
Need an experienced programmer? - Page 2 Post #0 Refback 09-24-2008 07:24 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


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



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