MQL4 Learning - page 129

 

i already search for the same cases in this forum, but i can't find one that really close to it

thanks mladen,

i really appreciate of your help..

 
Michael Po:
i already search for the same cases in this forum, but i can't find one that really close to it

thanks mladen,

i really appreciate of your help..

Michael

Try out this version

Added a check if the last order closed is closed on the same day as current time in cases when target profit has been reached. If the day has been changed, then it will clean the variable that prveneted new orders opening (it should allow orders opening again)

Files:
 

mladen

many thanks for your help,

i had recently been tested the EA, and it works,

today the EA finally open a trade..

but now a new problem comes up,

just a few hours, when the EA open a trade, suddenly the ea close that trade,

in the experts tab, it says that the session target reached (not MaxProfit)

it looks like the profit on the few days before, has been counted for today, it not works separately for each day

maybe there is something to do with orderhistorytotal that count every profit trade on the day before..

so when a new day start, the EA will trade again until the session target reached, and so for the next day the cycle will be the same

 
mladen:
Michael

Try out this version

Added a check if the last order closed is closed on the same day as current time in cases when target profit has been reached. If the day has been changed, then it will clean the variable that prveneted new orders opening (it should allow orders opening again)

my bad, i restarted the EA and change the session target for today

it placed an order and doesn't close the trade suddenly, it will work until the session target reached, this is like exactly what i need from the added code

once again, thank you mladen,..

Best Regards and Happy Trading

 

Hi,

I am usind the maillink.dll in my expert advisor. So I have to put in my eMail-Adress an my eMail-password.

Is there a possibility to put in my password encrypted, so that nowbody with has access to my metatrader can't read my password.

There is not the opinion for me to put it into the mq4-Code, because "the other" person has also access to the mq4-Code.

 

hi guys ,

i'm happy to help you guys on coding .. looking forward ...

 
sunshineh:
Hi,

I am usind the maillink.dll in my expert advisor. So I have to put in my eMail-Adress an my eMail-password.

Is there a possibility to put in my password encrypted, so that nowbody with has access to my metatrader can't read my password.

There is not the opinion for me to put it into the mq4-Code, because "the other" person has also access to the mq4-Code.

You could do that only if you had a source for maillink.dll (and then you would hide your password with some encryption method). You can not do that in mql since it can be decompiled very easy

 

Thank you for your answer.

But is it possible, that I can hide the written password on the extern deklaration.

So I can write my password as String-variable into the settings and if other open the setting tap, they can only see

*******

So it isn't written in the code an nobody can read it in the variables?

 
sunshineh:
Thank you for your answer.

But is it possible, that I can hide the written password on the extern deklaration.

So I can write my password as String-variable into the settings and if other open the setting tap, they can only see

*******

So it isn't written in the code an nobody can read it in the variables?

But then you would need the password for the password ... and so on

 

Hi,

I tried to change your code from this page:

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

because I want to change the TenkanSen Indicator in that way, that it is on the german dax only calculating from 9-17:30.

But I think I made something wrong because this is the same tankensen and the same calculation only without the time between 9-17:30 is missing.

Can you see my error

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 PaleVioletRed

#property indicator_width1 2

#property indicator_level1 0

#property indicator_levelcolor DarkGray

extern double SmaPeriod = 1;

extern int Price = PRICE_CLOSE;

extern string StartFrom = "09:00";

extern string EndAt = "17:30";

double TenkanSen[];

double TenkanSen_TimeLimited[];

int init()

{

IndicatorBuffers(2);

SetIndexBuffer(0,TenkanSen_TimeLimited);

SetIndexBuffer(1,TenkanSen);

return(0);

}

int deinit() { return(0); }

int start()

{

int c,k,count,counted_bars=IndicatorCounted();

if(counted_bars < 0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i = limit; i>=0; i--)

{

string today = TimeToStr(Time,TIME_DATE);

datetime tfrom = StrToTime(today+" "+StartFrom);

datetime tto = StrToTime(today+" "+EndAt);

if (Time>=tfrom && Time<tto)

TenkanSen = iIchimoku(NULL,0, 9, 26, 52, MODE_TENKANSEN, i);

else { TenkanSen = EMPTY_VALUE; TenkanSen_TimeLimited = TenkanSen_TimeLimited; continue; }

//

TenkanSen_TimeLimited = 0; for (c=0,k=0; c<SmaPeriod && (i+k)<Bars; k++) if ( TenkanSen!=EMPTY_VALUE) { TenkanSen_TimeLimited += TenkanSen; c++; }

TenkanSen_TimeLimited /= (1.0*SmaPeriod);

}

return(0);
Reason: