How to code? - page 155

 

Hi guys

How to end a order at the CLOSE of the current bar?

I tried:

if (Close < Open)

but it did not work.

i'm totaly rookie in mql.

 
nuozek:
Hi guys

How to end a order at the CLOSE of the current bar?

I tried:

if (Close < Open)

but it did not work.

i'm totaly rookie in mql.

There is no way to know the last tick of a bar before the next bar opens. The "Close[0]" is always the last know bid, and a new bar starts at the first tick following the timeframe grid.

The first tick of a bar is easier to catch, you can use:

1) Volume[0] == 1

2) Bars() > PreviousBars

3) Time[0] > PreviousTime

The last one is the most reliable and the only one to be used on real account.

I said "most" because it may happen to be also wrong, for example in the case of deconnection. When the connection is retablished you might have lose 5 bars, then the first received bar is the current one, NOT the first missed one. The missed ones are coming after. So the times of the received bars are no more sorted ! Tkx MQ for this very intelligent behavior .

PS : But its also true that the missed bars are not tradables.

 

Probleme My EA

Hi,

I have a problem with my EA. and I know nothing in MQ4. if anyone can help me I can explain my problem

THX

 

pop up box (how to)

Hi there!!

I'm new to coding and as long as I did some code change in the past I never get to acctually write something from scratch before.

Basically I would like to know how to make a pop up box appear on my chart when I right click with my mouse in a candle.

If somebody knows about a template or some plug already there that does it, I'm pretty sure I can take a look at the code and learn from it

 

Srp ea

Here an EA idea that looks good but i'm sure there's a mistake in the code some where.

SRP= Support, Resistance, Pivot.

entry

using the S & R based on the previous bar and a different TF.

currently the signals are from the 30min TF I have started testing on the 4hr

Anyway if you want to have a look at the EA it's attached.

I think a percentage based exit would work well. one for both buy and sell.

Cheers

Beno

Files:
srp.mq4  3 kb
 

How to create finite line object

It is possible to create trendline_object which is infinite. But how can I draw line from one point to another?

 

Make a trendline, then mark it by twice click, then click right button on any square. In a menu find "trendline properties", then tab "Parameters". Unmark "Ray", then OK. That's all.

 

adding money management

I need to add a money management feature to one of my existing EA's. Such as:

Use MM - True/False

Margin % - 5, 10, 20, etc.

Max Lots - 1, 2, 3, etc.

Can someone help? Thanks!

 

How do you code bar pattens for different TF's. I am ok with indicators but no bars.

if (Close [2]Open[1] && Open[0]> Open[1])Long1 = true;

if (Close [2]>Open[2] && Close[1]<Open[1] && Open[0]< Open[1])Short1 = true;

any help would be great

Cheers

Beno

 

would i use something like this for the 30min

double high30 = iHigh(NULL,30,0);

double low30 = iLow(NULL,30,0);

double close30 = iClose(NULL,30,0);

double open30 = iOpen(NULL,30,0);

double P30 = (high30+low30+close30)/3;

Exept change the TF to 60 for the 1Hr or 240 for the 4Hr

Cheers

Beno

Reason: