[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 210

 
solnce600:

QUESTION 1.

How to code this idea.

To set a pending order but make it convert to a market order only if the pending order set price coincides with the opening price of any TF60 candle

QUESTION 2.

How to code this idea.

If a pending order is converted into a market order, in 10 min we should set another pending order with the same values: open price, stop price, volume as in the previous pending order which was converted into a market order.

Thank you.


1. No.


2. The only problem is that you cannot place an order that will trigger only at H1 open price

 
PapaYozh:

1. No.


2. The only problem is that you cannot place an order, which would only trigger at the open price H1

The second question is unrelated to the first.

The idea is as follows.

We set BUYSTOP at 1.3000, stop at 1.2700, profit at 1.3300, volume - 1 lot.

At 10:00 this BUYSTOP was converted into a market order

At 10.10 (if price is not in a freeze zone)

Set a BUYSTOP or SELLLIMIT order at 1.3000, stop 1.2700, profit - 1.3300, volume - 1 lot.

 
Vinin:


For starters I would remove this line from your library

Since you are not using a library but an include file

Thanks for the advice, but please elaborate.

If you remove this line, the compiler generates warnings that Start is not found, and since there are no calls to the functions present in the library, the compiler warns that they will not be included in the exe-file.

 
polycomp:

If this line is removed, the compiler generates warnings that Start is not found, and as there are no calls to functions present in the library, the compiler warns that they will not be included in the exe file.

Let me make a suggestion.
Similar messages are generated by the compiler if one tries to compile the inluders directly instead of compiling only one indicator file.
 
granit77:
I'll cut in with a suggestion.
Similar messages are generated by the compiler, if you try to compile directly the inludes instead of compiling only one indicator file.

If you can explain to me how I should go about connecting library functions, I've completely lost track.

1.I write the code for the library function func.

2.I create a header file corresponding to the function. It should have the #import "func.ex4" line in it.

I take this to mean that the library needs to be compiled. If you compile without #property library, the compiler gives appropriate warnings.

And if I don't compile, where do I get "func.ex4" from? Or am I missing something?

What is the correct sequence of actions?

 
polycomp:

If you can explain to me how I should go about connecting library functions, I've completely lost track.

1.I write the code for the library function func.

2.I create a header file corresponding to the function. It should have the #import "func.ex4" line in it.

I take this to mean that the library needs to be compiled. If you compile without #property library, the compiler gives appropriate warnings.

And if I don't compile, where do I get "func.ex4" from? Or am I misunderstanding something?

What is the correct sequence of actions?


Use the template when creating a new project. There is a template there - "Function Library". All necessary code will be inserted automatically.
 
PapaYozh:

1. None.


2. The only problem is that you cannot place an order that will only trigger at the H1 opening price

1.No way......

And how can you place a market order but

- at the opening of, say, an hour candlestick

и

-at a certain price.

I.e. in 2011 there were 5 hourly candles with an opening price of 1.2999.

How to open only 5 market orders for the whole year 2011 at the opening price of the above 5 Hourly candles.

Thank you.

 
polycomp:

If you can explain to me how I should go about connecting library functions, I've completely lost track.

1.I write the code for the library function func.

2.I create a header file corresponding to the function. It should have the #import "func.ex4" line in it.

I take this to mean that the library needs to be compiled. If you compile without #property library, the compiler gives appropriate warnings.

And if I don't compile, where do I get "func.ex4" from? Or am I misunderstanding something?

What is the correct sequence of steps?



#property library should be in the library file itself (func.mq4) that you are going to compile, but not in the header mqh. Mqh does not need to be compiled separately.
 

The OrderSend() help states:

" Returns the ticket number assigned to the order by the trade server or -1 in case of failure. "

When testing the Expert Advisor, the tickets start from 1 and above. Why is there no ticket number 0 (zero) ?

 
alsu:

The #property library should be in the library file itself (func.mq4) that you are going to compile, but not in the header mqh. Mqh does not need to be compiled separately.
That's what I do, but here's some advice from Vinin with the exact opposite meaning.
Vinin:


I would first remove this line from your lib

Since you are not using a library, but an include file

I understand it, because I'm really not using a DLL, but an include file.

Or is ex4 acting as a DLL in this case, and being loaded on demand?