How to code? - page 27

 

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.

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

 

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

 

Not quite the same

if (MM == True)

{

int i,n=0;

if (AccountEquity() >= InitialCapital)

{

for (i=1;i<=20;i++)

{

n += i;

if (AccountEquity() < (InitialCapital+(n*Delta)))

{

MMLots=i*Lots;

break;

}

}

}

}

else MMLots = Lots;

You have ">=" only on first if

 

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?

 

IS THERE SOMEWAY TO PUT A BREAK EVEN STOP LOSS!!!!!

 
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.

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);

}

}

}

}

}
 

Thanks, but that doesnt fit with the extern breakeven thing.

I put it in says, Function "breakEvenManager" is not referenced and will be removed.

 
kjhfdgjfhdghdf:
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.

 

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

 

mmmmmmm

Reason: