Coding help - page 264

 
MrWigglesworth:
See post 2631 above with attached DEMA.mq4...Does that help?

In your code (in the init() section), find a part that goes like this

switch(MA1Mode)

{

case 1 : MA1short_name="EMA"; break;

case 2 : MA1short_name="SMMA"; break;

case 3 : MA1short_name="LWMA"; break;

default :

MA1Mode=0;

MA1short_name="SMA";

}

switch(MA2Mode)

{

case 1 : MA2short_name="EMA"; break;

case 2 : MA2short_name="SMMA"; break;

case 3 : MA2short_name="LWMA"; break;

default :

MA2Mode=0;

MA2short_name="SMA";

}

[/PHP]

And change it to this :

[PHP] switch(MA1Mode)

{

case 1 : MA1short_name="EMA"; break;

case 2 : MA1short_name="SMMA"; break;

case 3 : MA1short_name="LWMA"; break;

case 4 : MA1short_name="DEMA"; break;

default :

MA1Mode=0;

MA1short_name="SMA";

}

switch(MA2Mode)

{

case 1 : MA2short_name="EMA"; break;

case 2 : MA2short_name="SMMA"; break;

case 3 : MA2short_name="LWMA"; break;

case 4 : MA2short_name="DEMA"; break;

default :

MA2Mode=0;

MA2short_name="SMA";

}

and all will be OK

That part was actually preventing dema to be calculated whatever you were used (dema never got calculated cut instead, SMA was used).

Attaching the one with those changes but if you make those changes on your own, you will see that it will then calculate correctly. Why did the original author do so, I have no idea and frankly did not look at that part of the code at all

ma__dema_crossover_with_arrow_and_email_1.mq4

 
MrWigglesworth:
Yes I am familiar with DEMA though never memorized the formula...Here is the practical difference between a 5-SMA (red) and 5-DEMA (green)

When setting the mode to 1 on the 5/12 DEMA cross here is what I get:

Files:
 
mladen:
In your code (in the init() section), find a part that goes like this
switch(MA1Mode)

{

case 1 : MA1short_name="EMA"; break;

case 2 : MA1short_name="SMMA"; break;

case 3 : MA1short_name="LWMA"; break;

default :

MA1Mode=0;

MA1short_name="SMA";

}

switch(MA2Mode)

{

case 1 : MA2short_name="EMA"; break;

case 2 : MA2short_name="SMMA"; break;

case 3 : MA2short_name="LWMA"; break;

default :

MA2Mode=0;

MA2short_name="SMA";

}

[/PHP]

And change it to this :

[PHP] switch(MA1Mode)

{

case 1 : MA1short_name="EMA"; break;

case 2 : MA1short_name="SMMA"; break;

case 3 : MA1short_name="LWMA"; break;

case 4 : MA1short_name="DEMA"; break;

default :

MA1Mode=0;

MA1short_name="SMA";

}

switch(MA2Mode)

{

case 1 : MA2short_name="EMA"; break;

case 2 : MA2short_name="SMMA"; break;

case 3 : MA2short_name="LWMA"; break;

case 4 : MA2short_name="DEMA"; break;

default :

MA2Mode=0;

MA2short_name="SMA";

}

and all will be OK

That part was actually preventing dema to be calculated whatever you were used (dema never got calculated cut instead, SMA was used).

Attaching the one with those changes but if you make those changes on your own, you will see that it will then calculate correctly. Why did the original author do so, I have no idea and frankly did not look at that part of the code at all

ma__dema_crossover_with_arrow_and_email_1.mq4

Yep...I can do that...Thank you will report back...Thanks a bunch!

 
MrWigglesworth:
Yep...I can do that...Thank you will report back...Thanks a bunch!

MLaden,

Your genius is exceeded only by your genius!! After the coding modifications arrows are now in alignment! Can I donate or contribute something for your efforts.

 
MrWigglesworth:
MLaden, Your genius is exceeded only by your genius!! After the coding modifications arrows are now in alignment! Can I donate or contribute something for your efforts.

No need to do anything

Glad that it works - happy trading

 

Attached is a script called Visible Pos . When applied to chart it plots arrows on the chart of previous opened and closed trades taken from your order history.

I am not a coder at all , can someone please add dotted trend lines to connect the open and closed arrows of the trade .

as in screenshot

Thank you

 
Rivabex1301:
Attached is a script called Visible Pos . When applied to chart it plots arrows on the chart of previous opened and closed trades taken from your order history.

I am not a coder at all , can someone please add dotted trend lines to connect the open and closed arrows of the trade .

as in screenshot

Thank you

Rivabex1301

Check this post : https://www.mql5.com/en/forum/176352/page45

 
mladen:
Rivabex1301 Check this post : https://www.mql5.com/en/forum/176352/page45

Thank You for your assistance

 
mladen:
Does it behave the same way on your PC (not the VPS)? If it works OK on your PC in same conditions then you have a problem with your VPS

Hi Mladen, are you from ex-yugoslavia?

Yeah, regarding the problem, it behaves the same on Pc and Vps. It wont start closing orders until i maximize mt4 on PC.

Can you please look at the code.

Thnx.

Files:
 
DarkForex33:
Hi Mladen, are you from ex-yugoslavia?

Yeah, regarding the problem, it behaves the same on Pc and Vps. It wont start closing orders until i maximize mt4 on PC.

Can you please look at the code.

Thnx.

DarkForex33

There is a function in that ea (DisableEA()) that disables all EAs in some conditions - it simply disables live trading and never re-enables it. That is the probable cause for that. I don't know what did the author want to do with that since he tries to close orders after that and in a new metatrader 4 it is not possible any more till you manually re-enable live trading

Reason: