MQL4 Learning - page 16

 

There really could be a problem with logics.

When you have any sort of calculation and you know what result should be, add a Print("Parameter X is ",X," and should be XXX");

This way you'll see when your XXX is not actually XXX but XYZ instead.

This is the best way to find a flaw of logic - put that everywhere.

And don't forget to delete old logs from time to time! They sometimes take up to 10-15 gigabytes here. Oh did I mention I have MT4 folder with 15GB generated history? My HDD doesn't have enough space for 30GB logs! Clean up from time to time. Just go to MT4 folder and point the pointer on one of the folders to see its space (or right click - properties).

Logs should be in one of the folders.

 

Excellent point Shinigami Print statements can be your best friend in trying to de-bug your program. I have used them many times to solve problems. You can usually figure out your problem by using this method.

 

That's smart!

Very smart!!!

But could you please show me how to imply it to the code?An example perhaps?

Print("Parameter X is ",X," and should be XXX");
 
MQL4:
That's smart!

Very smart!!!

But could you please show me how to imply it to the code?An example perhaps?

Print("Parameter X is ",X," and should be XXX");

before OrderSend function I set

Print("Ask is ",Ask," and stoploss will be ",sl," and takeprofit will be ",tp);

I also set stoploss level and takeprofit level before that.

Like this:

sl=Bid-SL*Point;

tp=Bid+TP*Point;

and only after I put print...

 
 

Thank You Shinigami,

You are awesome!!!

It works fine for me

You are a very good programmer!!!

 

Shinigami,

I need Your help:

Before, it was:

extern double TakeProfit = 20;[/PHP]

Then, I changed it to

[PHP]extern double TakeProfit = 400;

And the parameters, the inputs for the EA still show 20!!!!!!!!!

What's the problem?

Thanks in advance.....

MQL4.

 

After you compiled EA and started testing it, its properties (settings) are written down into a file. You need to change them manually.

If you wrote TP = 400 in the EA, then it means you set default value to 400.

In order for the EA to use that value in strategy tester you need to set it in the EA settings. Or simply use default values (there is a button for that, but I have no idea what is it called, my MT4 is russian).

Anyway just change the value in the properties.

I also recommend you setting best values as default values - each time you compile an expert that is attached to a chart, default values are being used.

MQL4:
Shinigami,

I need Your help:

Before, it was:

extern double TakeProfit = 20;[/PHP]

Then, I changed it to

[PHP]extern double TakeProfit = 400;

And the parameters, the inputs for the EA still show 20!!!!!!!!!

What's the problem?

Thanks in advance.....

MQL4.
 

Sorry, nope. Can't figure it out myself. I'm still bad with indicators.

 

Anyone?????????