How to code? - page 183

 

help to program this indicator

Can anyone help me to fix this code? I just need to output the array "theIndicator[]" to the buffer, but it wont display.

any help is appreciated. thanks.

int start()

{

int counted_bars=IndicatorCounted();

double theIndicator[];

int pos = Bars-counted_bars-1;

theIndicator[pos]=Close[pos];

while(pos>=0)

{

pos--;

theIndicator[pos] = Close[pos]*0.08 + (theIndicator[pos+1]*(1-0.08));

}

pos = Bars-counted_bars-1;

while(pos>=0)

{

ExtMapBuffer1[pos]=theIndicator[pos];

pos--;

}

return(0);

}

 

can anyone help me ?

can anyone teach me how to code the incline/vertical text object?

please help

 

How to code

I am new in this forum, can anyone pls tell me how to write codes in the MQL4 that will take 5 digits after decimal place bcos the ask and the bid can only show four decimal place. I need ur help. Thanks a lot

 

who can help me?

Can you help me when you see and know how to code it . i want to realize a function.

i check the margin. if the used margin has equal or more than 20% of the total balance, the MT4 didn't premit open manual buyorsell position.(it's different from mt4 default,the plan i made is more strict), maybe dll or script will need to control MT4? when the position cannt open, display an alert and then MT4 itself disconnect automatic or shutdown automatic.

Thank you very much in advance!!

dll file may need

 
 

mql4 Synchronize FileWrite

Hello everyone:

My friend and I am trying to implement an EA, we use FileWrite to record the log for analysis. In the way of test, We run the EA in one demo account with different pairs,but we found that the EA write record to other pairs's log. The log are mixed.

e.g. the log of EA-EURUSD.csv write to EA-GBPUSD.csv, and the log of EA-GBPUSD.csv write to EA-EURUSD.csv. The mixed log are happened when they do the same thing at the same time. It means they are not synchronized when write files.

Does anyone know that how to implement the synchornize in mql4? does mql4 have the same concept of synchronize like Java and C++?

Pls kindly help, thanks very much:)

 
Xtyun:
Hello everyone: Pls kindly help, thanks very much:)

Show us your code.

 
Roger09:
Show us your code.

--------

extern string iname="EURUSD";

--------

void writeFile(string str)

{

datetime logtime = TimeLocal();

string filename = iname+".csv";

int handle=FileOpen(filename,FILE_CSV|FILE_READ|FILE_WRITE,",");

if(handle>0)

{

FileSeek(handle,0,SEEK_END);

FileWrite(handle,TimeToStr(logtime,TIME_DATE|TIME_SECONDS),str);

FileClose(handle);

handle=0;

}

return (0);

}

the iname is to define different log files. everytime need to write log, the EA will call this writeFile() function. I know in Java there is a keyword 'synchronized' which can add to the function to make sure they are run correctly. is there a way to implement this in mql4?

Thanks:)

 

Replace

string filename = iname+".csv";

to

string filename = str+".csv";

 
Reason: