Welcome to the MQL4 course - page 11

 

many thanks Guru

i am quite nude in this field. i'm trying to program the following EA with great difficulty: can anyone help direct me.

on H1 timeframe, if MA13 (moving average set to 13) goes above (crosses) MA120

and

stochastic 120 > 50 and

sto 15 > 60

then buy

if MA 13 goes below MA120 and

sto 120 >50

and sto 15 <20

then sell

with the parameters changeable

 

MT4 tutorial

HI Coders Guru,

I'm not at this stage interested in developing EAs, scripts, indicators etc, I just need to know what the various options/settings are on MT4 e.g. how to change bear & bull colours on candle charts globally not just for individual charts. Will your tutorial tell me things like that, or will it over the top for a FOREX newbie like myself?

Cheers,

Mike

 
blott203:
HI Coders Guru,

I'm not at this stage interested in developing EAs, scripts, indicators etc, I just need to know what the various options/settings are on MT4 e.g. how to change bear & bull colours on candle charts globally not just for individual charts. Will your tutorial tell me things like that, or will it over the top for a FOREX newbie like myself?

Cheers,

Mike

You can also read https://www.mql5.com/en/forum/178427

And another interesting thread: https://www.mql5.com/en/forum/178313

 

New styles of Money Management...

Here is what i use on my ea

extern bool UseMM = True;

extern bool Micro = True;

extern double Lots = 0.01;

extern double Risk = 0.1;

extern double MinLots = 0.01;

extern double MaxLots = 100.0;

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

//| calculate optimal lot size |

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

double LotsOptimized()

{

//----

double lot = Lots;

int orders = HistoryTotal(); // history orders total

int losses = 0; // number of losses orders without a break

if(UseMM){

if(!Micro){

lot = NormalizeDouble((Risk*AccountFreeMargin())/1000,1);

if(lot>MaxLots){lot=MaxLots;}

else if(lot<MinLots){lot=MinLots;}

}

else{

lot = NormalizeDouble((Risk*AccountFreeMargin())/1000,2);

if(lot>MaxLots){lot=MaxLots;}

else if(lot<MinLots){lot=MinLots;}

}

return(lot);

}

else{

return(Lots);

}

}

here is some of others best of MM

extern double Lots = 0.01;

extern double DecreaseFactor = 0.3;

extern int Leverage = 200;

double LotsOptimized()

{

double lot=Lots;

int orders=HistoryTotal(); // history orders total

int losses=0; // number of losses orders without a break

//---- select lot size

lot=NormalizeDouble(Risk*AccountFreeMargin()* AccountLeverage()/100000.0,1);

//---- calcuulate number of losses orders without a break

if(DecreaseFactor>0)

{

for(int i=orders-1;i>=0;i--)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)

{ Print("Error in history!"); break; }

if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;

//----

if(OrderProfit()>0) break;

if(OrderProfit()<0) losses++;

}

if(losses>1) lot=NormalizeDouble(lot+lot*losses*DecreaseFactor,1);

}

//---- return lot size

if(lot<0.01) lot=0.01;

return(lot);

}

Can someone suggest to me how to combine both coding into one ...?

your help, hope me win on my eas...

1st order open sell/buy loss,

then

2nd open order sell/buy increase double (2x) from previous lots...to cover loss from 1st order... hope it may win...

main things is i want to recover every losses i made by increasing the lot after each losses...

thank you...

regards,

MANSTIR

 

3 Questions if someone can help me

how to add multiple TP's Levels ??

how to set an EA to email me whenever a trade is placed by it ??

how to hide or lock all the codes so no one can modify it ???

Thanks for any Help

 

wonderfully nice guy, Codeguru

i could not find the thread containing the ffg lessons: 1,2,5,6,11 and 14. pls direct me to wher to get them. Tnxs alot

 
tomywa:
i could not find the thread containing the ffg lessons: 1,2,5,6,11 and 14. pls direct me to wher to get them. Tnxs alot

Everything is there but if you need help:

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

 
jhp2025:
Welll thanking you much Mr Coders Guru,

I'm an old guy but I like to learn something that is maybe useful to me and/or my kids.

Anyway, is there any update and/or development and/or suggestion since you release EMA_CROSS_2.mq4 which is quiet good for me but I saw that still we can further develop it so it can reduce the MODIFY function into more positive order closing one.

Again, thanks a lot,

John

hi

i have wrote an ema cross over as well but have some problems with it

i have wonder if you can look at it or can i look at your system. we can work together to improve it

john

 

Hello all,

Would a coding expert kindly explain:

when code should be written within the function init() ?

when code should be written within the function deinit() ?

I have been looking for the answer to these questions on the internet but I got nothing that explains it in clear practical application terms.

examples would help...

Thanks in advance.

 
pgd:
Hello all,

Would a coding expert kindly explain:

when code should be written within the function init() ?

when code should be written within the function deinit() ?

I have been looking for the answer to these questions on the internet but I got nothing that explains it in clear practical application terms.

examples would help...

Thanks in advance.

Take a read to this: https://www.mql5.com/en/forum/178427