MQL4 Learning - page 109

 

programmation help

Hello.

Several questions (EA)

1) in my EA I would like the text (info on my EA) is bigger how?

2) I can have 4 orders started to remove the first or 2 nd etc ...

3) what is the command under metatrader that allows me to know the profit or loss in court

4) how to know the profit / loss positions in court for buying and / or Sale

thank you very much

your help

 
matrixebiz:
Hello, for some reason I can't figure out how to convert the Time[] seconds number (126858000) to display the actual 24hr (Hour+Minute) time.

What is the formula please?

Thanks

You could need to use datetime() function and make and array.

Check the code on the Clock v1_2 auto (I altered the original to show seconds besides the hour and minutes in the "bar" count.) It will get you some ideas. You need to allow dlls.

Files:
 

How to change MA 5 decimal to 4 decimal?

Hi,

I'm using FX Pro, (uses 5 decimal and 3 decimal for jpy) how do i edit the code for MA(moving average) to show 4 decimal for non jpy pairs and 2 decimal for jpy pairs on data window for metatrader 4? Or is there any other MA indicators that can do that?

Thank you

 
Bongo:
Go to: How to change MA 5 decimal to 4 decimal? - MQL4 forum

Thanks, managed to solved my issues

 

Help with text lines

Hi

I've managed to create an indicator (my first) based on other indicator found in other forum, I have a little problem, the indicator has 8 lines I want them labeled but only get one of them with label, can somebody figure out what the problem is?

this is the labels code:

ObjectCreate("1", OBJ_TEXT, 0, 0,0);

ObjectSetText("1", " 1",fontsize,"Arial",Red);

ObjectCreate("0,75", OBJ_TEXT, 0, 0, 0);

ObjectSetText("0,75", " 0,75",fontsize,"Arial",Red);

ObjectCreate("0,55", OBJ_TEXT, 0, 0, 0);

ObjectSetText("0,55", " 0,55",fontsize,"Arial",Red);

ObjectCreate("0,35", OBJ_TEXT, 0, 0, 0);

ObjectSetText("0,35", " 0,35",fontsize,"Arial",Red);

ObjectCreate("-0,35", OBJ_TEXT, 0, 0, 0);

ObjectSetText("-0,35", " -0,35",fontsize,"Arial",Red);

ObjectCreate("-0,55", OBJ_TEXT, 0, 0, 0);

ObjectSetText("-0,55", " -0,55",fontsize,"Arial",Red);

ObjectCreate("-0,75", OBJ_TEXT, 0, 0, 0);

ObjectSetText("-0,75", " -0,75",fontsize,"Arial",Red);

ObjectCreate("-1", OBJ_TEXT, 0, 0, 0);

ObjectSetText("-1", " -1",fontsize,"Arial",Red);

if (PBuffer1!=PBuffer1) ObjectMove("1", 0, Time,P);

if (PBuffer2!=PBuffer2) ObjectMove("0.75", 0, Time,Q);

if (PBuffer3!=PBuffer3) ObjectMove("0.55", 0, Time,R);

if (PBuffer4!=PBuffer4) ObjectMove("0.35", 0, Time,S);

if (PBuffer5!=PBuffer5) ObjectMove("-0.35", 0, Time,T);

if (PBuffer6!=PBuffer6) ObjectMove("-0.55", 0, Time,U);

if (PBuffer7!=PBuffer7) ObjectMove("-0.75", 0, Time,V);

if (PBuffer8!=PBuffer8) ObjectMove("-1", 0, Time,W);

P,Q,R,S,T,U,V,W are declared with the indicator calculation

All missing labels are declared in object list but pressing "show" the chart goes nowhere, and editing the object I find out that instead having the rigth date, time and price, they have no price "0" no time "0" and date is 1970/01/01.

Any suggestion for correct this or replace it with something that works is wellcome

 

Fibonacci as an EA filter?

I am trying to implement a Fibonacci filter to my EA in order to maximize the profits and reduce the draw-downs (you know, the good stuff).

I created a Fib function based on Donchian channels and tried it out on my optimizations (WITHOUT RE-optimizing). I was surprised by the lack of consistent improvement throughout my various optimizations.

/*lprice and hprice are the high and low of a large-period (ex. 10080)

Donchian channel.

Various Fib levels are stored in the array L.

*/

L[0] = lprice;

L[1] = ((hprice-lprice)*0.236068)+lprice;

L[2] = ((hprice-lprice)*0.381966)+lprice;

L[3] = ((hprice-lprice)*0.5)+lprice;

L[4] = ((hprice-lprice)*0.61803399)+lprice;

L[5] = hprice;

for (int i = 0; i<14; i++)

{

if (Close[0] L) buys = false;

if (Close[0] > L && Close[0] - FibMargin*pt < L) sells = false;

}

[/CODE]

I also tried

[CODE]

if (Close[1]>L && Close[0]<L) buys = false;

if (Close[1]L) sells = false;

I can plainly see by looking at price action on fib levels that the price obeys the levels as S&R....so why can't I achieve consistently positive results?

Any ideas? Anyone use Fib in a way different to the ways I mentioned?

 

How must I modify this EA, I want no SL if a new order open. The trailingstop is ok.

I hope someone can help me.

oron.com/8dfnql6tazuo/MACD_Sample_russian.mq4.html

 
phil26:
How must I modify this EA, I want no SL if a new order open. The trailingstop is ok.

I hope someone can help me.

oron.com/8dfnql6tazuo/MACD_Sample_russian.mq4.html

Simpliest way, just give very big value on SL input let say 10,000.

 
codersguru:
g_bar1Range = MathAbs( High[ 1 ] - Low[ 1 ] );[/PHP]

This line calculates the range between the High and Low of the previous bar (bar 1).

g_bar2Range = MathAbs( High[ 2 ] - Low[ 2 ] );

This line calculates the range between the High and Low of the previous previous bar (bar 2).

[PHP]g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );
This line calculates the Body length of the previous bar (bar 1).

Codersguru, I think for g_bar1Range and g_bar2Range no need MathAbs since the return value will never negative (-) value, High will always >= tha Low.

Reason: