Calling Programmers/Coders...

 

Not all mini accounts are created equal...

This same EA is running in two different accounts. Attached are the reports from each one. Also attached is the EA itself. I would like to make the account which is doing orders in the .75 range give orders in the 7.50 range. How can I make this happen.

Here is some of the code from the EA I think this is the part that could be changed? I'm not really a program coder, I'm just learning...please assist..

double LotSize()

{

double lotMM = MathCeil(AccountFreeMargin() * Risk / 1000) / 100;

if(AccountIsMicro==false) //normal account

{

if (lotMM < 0.1) lotMM = Lots;

if ((lotMM > 0.5) && (lotMM < 1)) lotMM=0.5;

if (lotMM > 1.0) lotMM = MathCeil(lotMM);

if (lotMM > 100) lotMM = 100;

}

else //micro account

{

if (lotMM < 0.01) lotMM = Lots;

if (lotMM > 1.0) lotMM = MathCeil(lotMM);

if (lotMM > 100) lotMM = 100;

}

return (lotMM);

p.s. someone tell me how to post large code in a insert window with a slider bar on the side. I've seen that done but don't know how to do it.

 

If it was me, I'd probably delete the whole function and put

lotMM=Lots;

Just not a fan of the whole money management thing since most of the time, our trades won't last more than a week anyway.

to post code, use

"[" "code" "] "

but without the quotations. Had to do it like that or it would think I wanted to use it.

 

it's not workin it tells me that I have exceeded the character limit. so the [] thing,...I must not be doing it right. could you explain it again more specifically?

this is what i'm doing...

[

//+------------------------------------------------------------------+

//| EMA_CROSS_2.mq4 |

//| Coders Guru |

//| https://www.mql5.com/en/forum |

//+------------------------------------------------------------------+

// ultima versiune cu micro lots! H1 si D1

#property copyright "Coders Guru"

#property link "https://www.forex-tsd.com"

//---- Trades limits

extern double

TakeProfit = 15,

TrailingStop = 20,

StopLoss = 20;

extern bool

UseStopLoss = false;

//---- EMAs paris

extern int

ShortEma = 2,

LongEma = 5;

//---- Crossing options

extern bool

immediate_trade = true, //Open trades immediately or wait for cross.

reversal = false, //Use the originally reversal crossing method or not

ConfirmedOnEntry = false;

//---- Money Management

extern double

Lots = 1;

extern bool

MM = true, //Use Money Management or not

AccountIsMicro = true; //Use Micro-Account or not

extern int

Risk = 10; //10%

extern int

MAGICMA = 20060301;

extern bool

Show_Settings = true;

//---- Global varaibles

static int

TimeFrame = 0;

datetime

CheckValueTime;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

if(Show_Settings) Print_Details();

else Comment("");

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

TimeFrame=Period(); //Prevent counting the cross while the user changing the timeframe

return(0);

}

bool isNewSumbol(string current_symbol)

{

//loop through all the opened order and compare the symbols

int total = OrdersTotal();

for(int cnt = 0 ; cnt < total ; cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

string selected_symbol = OrderSymbol();

if (current_symbol == selected_symbol)

return (False);

}

return (True);

}

int Crossed (double line1 , double line2)

{

static int last_direction = 0;

static int current_direction = 0;

if(TimeFrame!=Period())

{

TimeFrame=Period();

return (0);

}

if(line1>line2)current_direction = 1; //up

if(line1<line2)current_direction = 2; //down

if(immediate_trade==false)

{

if(last_direction == 0) //first use

{

last_direction = current_direction;

return(0);

}

}

if(current_direction != last_direction) //changed

{

last_direction = current_direction;

return (last_direction);

}

else

{

return (0); //not changed

}

}

//--- Bassed on Alex idea! More ideas are coming

double LotSize()

{

double lotMM = MathCeil(AccountFreeMargin() * Risk / 1000) / 100;

if(AccountIsMicro==false) //normal account

{

if (lotMM < 0.1) lotMM = Lots;

if ((lotMM > 0.5) && (lotMM < 1)) lotMM=0.5;

if (lotMM > 1.0) lotMM = MathCeil(lotMM);

if (lotMM > 100) lotMM = 100;

}

else //micro account

{

if (lotMM < 0.01) lotMM = Lots;

if (lotMM > 1.0) lotMM = MathCeil(lotMM);

if (lotMM > 100) lotMM = 100;

}

return (lotMM);

}

string BoolToStr ( bool value)

{

if(value) return ("True");

else return ("False");

}

void Print_Details()

{

string sComment = "";

string sp = "----------------------------------------\n";

string NL = "\n";

sComment = sp;

sComment = sComment + "TakeProfit=" + DoubleToStr(TakeProfit,0) + " | ";

sComment = sComment + "TrailingStop=" + DoubleToStr(TrailingStop,0) + " | ";

sComment = sComment + "StopLoss=" + DoubleToStr(StopLoss,0) + " | ";

sComment = sComment + "UseStopLoss=" + BoolToStr(UseStopLoss) + NL;

sComment = sComment + sp;

sComment = sComment + "immediate_trade=" + BoolToStr(immediate_trade) + " | ";

sComment = sComment + "reversal=" + BoolToStr(reversal) + NL;

sComment = sComment + sp;

sComment = sComment + "Lots=" + DoubleToStr(Lots,0) + " | ";

sComment = sComment + "MM=" + BoolToStr(MM) + " | ";

sComment = sComment + "Risk=" + DoubleToStr(Risk,0) + "%" + NL;

sComment = sComment + sp;

Comment(sComment);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

int cnt, ticket, total;

double SEma, LEma, SEmaLAST, LEmaLAST;

string comment = "";

if(reversal==true) comment = "EMA_CROSS_Counter-Trend";

if(reversal==false) comment = "EMA_CROSS_Trend-Following";

if(Bars<100)

{

Print("bars less than 100");

return(0);

}

if(TakeProfit<10)

{

Print("TakeProfit less than 10");

return(0); // check TakeProfit

}

static int isCrossed = 0;

if(ConfirmedOnEntry)

{

if(CheckValueTime==iTime(NULL,TimeFrame,0)) return(0); else CheckValueTime = iTime(NULL,TimeFrame,0);

SEma = iMA(NULL,0,ShortEma,0,MODE_EMA,PRICE_CLOSE,1);

LEma = iMA(NULL,0,LongEma ,0,MODE_EMA,PRICE_CLOSE,1);

SEmaLAST = iMA(NULL,0,ShortEma,0,MODE_EMA,PRICE_CLOSE,2);

LEmaLAST = iMA(NULL,0,LongEma ,0,MODE_EMA,PRICE_CLOSE,2);

if(SEmaLASTLEma) isCrossed = 1;

if(SEmaLAST>LEmaLAST && SEma<LEma) isCrossed = 2;

}

else

{

SEma = iMA(NULL,0,ShortEma,0,MODE_EMA,PRICE_CLOSE,0);

LEma = iMA(NULL,0,LongEma ,0,MODE_EMA,PRICE_CLOSE,0);

isCrossed = Crossed (LEma,SEma);

}

if(reversal==false)

{

if(isCrossed==1) isCrossed = 2;

else if(isCrossed==2) isCrossed = 1;

}

if(MM==true) Lots = LotSize(); //Adjust the lot size

total = OrdersTotal();

// TRAILING STOP

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

.....

]

 

Do you want money management? Or just fixed lots ?

 

Ahhhh

I think you should set AccountisMicro=false;

//

You need to actually type "code" and brackets, too. Sorry for the confusion.

.

 

I've uploaded a modification of his EA. This one uses fixed lots. No moneymanagement whatsoever. It appears to still backtest well. Whatever you want the lots to be, just enter it in the code where it says "LOts = " and it will be the same lots throughout and then when you want to change it, go in an change it same way again. Try it. It appears to me, though, that the money management in this EA is kind of important since it's like a hedging strategy so use this one at your own risk.

You could also just increase the risk % . It looks like you have it at 10 % . Increase to 40 % . Or something and see what that does. It should increase your lots.

 

i'm sorry the obvious has escaped me once again...

everything I wanted to fix isn't in fact broken I just didn't look at the bottom of the inputs window when attaching it to the chart... all i have to do is change the lot parameter when i use it and that handles it.

i didn't use the slider bar on the inputs window and didn't see all the additional parameters which i could change...that's WHY the program was built with the option!!!

I still havn't figured out how to do the post code in window thing either...

fyi I'm going live with this now using a small lot size to see if it performs as expected and if so I'll increase the lot size as I feel more confident with it.

sometimes I'm amazed by the size of my own skitomas.

 

I'm live on the demo with it. It booked a win already but I still have an open trade going.

Can someone explain how it works? Kind of complicated.

 

all I know is that it executes on the cross signal of the two moving averages.

the fact that it hedges with an opposing position which I bets on closing on the retracement is a hedging strategy. I am also running this in demo and have run numerous strategy tests on various settings. It appears to run as well in the 5m as the 15m TF. I think the key to making this really work is scale/stepping the opposing position with some kind of probability curve. If you put a 2period EMA and a 5period EMA on a chart and watch them cross that's what is driving the signal as I have it configured.

The other factor is the TP. According to my tests the 15TP gives the greatest net profit.

 

EMa crossed

my programming language before is different. Im trying to learn mql4 fast. but i find it a little adjustment.

EMA cross is a good start.

Thanks for the information guys. I ow this new knowledge to you.

 

Aragorn, in the editor where you write your posting, just mark the part that is code and then click on this symbol "#", it's the 3rd from the right, right above the space where you write.

Reason: