Ask! - page 87

 
BornToWin:
Thanks for reply Michel,

I got the key.

But sometimes the volume of first tick of every M1 bar > 1

While iVolume() > 1 at the first tick, the calculation didn't done !?

Or the first tick of that M1 bar must be = 1 ?

And we can't change expression to >= 1, right ?

That will make this idea turn to useless, cause it calculate to the end of that bar live !

My idea is to calculate only at the complete of TF M1.

Any other idea ?

BornToWin

I never see that volume jump with a gap from 0 to 2

Anyway, you can use this:

int bars; //on global scope

void start()

{

if(ibars(NULL,PERIOD_M1) > bars)

{

bars = ibars(NULL,PERIOD_M1);

.... //here I am at the open of every M1 bar

}

....

}

 

Thanks Michel,

Thanks Michel,

I will try it.

Did you know where and how can we got server for MT4 that can feed simulation price at weekend ?

This is to test our code at weekend ( non trading days )

Any idea ?

Michel:
I never see that volume jump with a gap from 0 to 2

Anyway, you can use this:

int bars; //on global scope

void start()

{

if(ibars(NULL,PERIOD_M1) > bars)

{

bars = ibars(NULL,PERIOD_M1);

.... //here I am at the open of every M1 bar

}

....

}

 

No, sorry, I do not know...

 

Help please

In my EA, I have a SL=50.

How code if I will a SL of 50 OR a SL when an Moving Average crosses an other MA ?

Thanks in advance.

 

include file in code - variables not defined

Hi,

can anyone help, this must be simple but i'm too new to figure it out

I've come across a post for a 3 level exit posted back in 2005.

It's an includes file

https://www.mql5.com/en/forum/173225

I have a place pending order script and have added

#include

#define MAGIC = 20051120;

extern color clModifyBuy = Aqua;

extern color clModifySell = Tomato;

extern bool UseSound = False;

extern string NameFileSound = "expert.wav";

in the top of the file and then inside int start() I have added the line

if (UseTrailing) TrailingPositions();

I've searched loads but can't find much more on it and for the life of me I cannot get my script to compile calling this. It works ok without adding te code.

Help really appreciated as it's driving me mad, i really can't figure why it isn't working. It keeps saying all the above are not defined.

Many thanks

Kevin

 

Hey Kevin nice Irish name,

Why are you trying to put this into a script and not an EA?

Scripts only run once and I don't believe a script could do a trailing stop. Try putting it into an EA.

 

@pgtips: change the second line to be only

#define MAGIC 20051120

i.e., no equal sign and no comma.

 
 

MTF indicator code inside EA

Would someone tell me where I can to find some information reward how write the code of a MTF indicator inside a EA??? Thank you

 

Hi cyberpasta,

Shouldnt it be OrderSend() instead of sendOrder() ...

k3iroll

Reason: