Coding help - page 337

 
alpha24:
Hi Mladen Sir,

After long time I am requesting you Please code Bollinger Band on MA. Same as MA on MA indicator. in separate window. Moving Average is not necessary to visualize in indicator window. BB with Decimal deviation (0.01), EMA or SMA form. Will you please make as usual?

Thanks in advance

alpha24

You do not need a new indicator for that

Use any ma that is in separate window already, and then just drag the bollinger bands to that sub-window and choose previous indicator data as a price field

 
mladen:
alpha24

You do not need a new indicator for that

Use any ma ...

Yes sir, but problem is there is no option for deviation in decimals and another is if I tried to use more indicators in same window there is confusion in previous data and first data. So please

 

Hi,

I am not shure, if the maillink.dll is working with build > 600.

I tried the maillink.dll with gmx and googlemail and I am always getting "-2"

from the MailInit(string,int,string,string); function back :-(

I also tried the xpMail.dll from codersguru is crashing my metatrader account, does anybody knows another possiblity to send a mail from one EA to two different mail-adresses?!?

 
sunshineh:
Hi,

I am not shure, if the maillink.dll is working with build > 600.

I tried the maillink.dll with gmx and googlemail and I am always getting "-2"

from the MailInit(string,int,string,string); function back :-(

I also tried the xpMail.dll from codersguru is crashing my metatrader account, does anybody knows another possiblity to send a mail from one EA to two different mail-adresses?!?

The string parts are the problem.

Old metatrader 4 used ANSI strings. They have changed that to unicode strings. Unicode strings are using 2 bytes per character, while ANSI uses just 1 byte per character. That is why you are having problems - dlls are getting strings that are unreadable to them

 

Please correct indicator you need to put the arrow in place of squares.

Files:
.........png  141 kb
.......png  30 kb
tro_bias_ez.ex4  12 kb
 
DMNIK:
Please correct indicator you need to put the arrow in place of squares.

DMNIK

The ex4 file can not be edited and altered

 

Thanks for the clear explanation!

Than it should work, if I change every string to unicode, before I call the functions from the dll?

Are there already functions for changing ANSI to unicode and unicode to ANSI

 

Or isn't it working because the Unicode-string is in an array?!?

Another question:

How can I play more different

PlaySound-wav files in line?

I tried with Sleep() between, but it isn't working :-(

 
sunshineh:
Or isn't it working because the Unicode-string is in an array?!?

Another question:

How can I play more different

PlaySound-wav files in line?

I tried with Sleep() between, but it isn't working :-(

sunshineh

Logically they are the same : arrays of characters. Except that ANSI character takes 1 byte while Unicode character takes 2 bytes. It was done so to include all the various world languages (when Unicode was invented - nothing to do with metatrader). Now, if the dll is expecting ANSI and gets unicode string it will interpret it wrongly (and vice versa). If your dll is using dlls you have to convert the new strings to an explicit array of unsigned chars (using StringToShortArray() in order to make it accessible to ANSI dll) and the return should be converted to a string using CharArrayToString() (in order to make it accessible to metatrader)

________________________

As of sleep : Sleep() function is disabled in indicators, It only works in EAs. It always has been so (it is not a novelty of a new metatrader).

Also, metatrader is executing orders in one peace of code sequentially. Meaning that you can not start playing one sound file and then, without being ended, go on and play another one. Also, as far as I am aware, they are limiting the time duration of the sound file (in order to prevent terminal freezing - as you have probably noticed, thing like alerts and sounds are centralized - see when different charts issue alert at a same time - that is one single window you see)

Now I could go on and on, but the whole problem of metatrader is that they did not solve properly the asynchronous routines execution (it actually has no idea about it) and that brings in a lot of limitations

 

Checking if last closed orders were profitable

Hello,

I would like to check if my last three closed sell or buy trades were profitable, and change a string value depending on it.

I have this code (MT4):

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

{

OrderSelect(i, SELECT_BY_POS,MODE_HISTORY);

if(OrderSymbol()==Symbol() && OrderMagicNumber()==BUY)

{

//for buy order

if(OrderType()==OP_BUY && OrderProfit()>0) last=1;

if(OrderType()==OP_BUY && OrderProfit()<0) last=0;

}

}

for(int j=(OrdersHistoryTotal()-1);j>=0;j--);

{

OrderSelect(j, SELECT_BY_POS,MODE_HISTORY);

if(OrderSymbol()==Symbol() && OrderMagicNumber()==SELL)

{

//for sell order

if(OrderType()==OP_SELL && OrderProfit()>0) last2=1;

if(OrderType()==OP_SELL && OrderProfit()<0) last2=0;

}

}

But it doesn't work for me.

How I should modify it?

Thanks for help.