Coding help - page 409

 

Hi. Is it possible someone can code this indicator so that I can attach it in a sub window....? Many thanks.

Files:
5days.mq4  4 kb
 

Hi,

I have a few Buttons on my Chart and created a rectangle behind this Buttons.

Now everytime when I want to click on a button, I only reach the rectangle.

How can I do that?

OBJPROP_SELECTABLE = false

or OBJPROP_BACK = true,

doesn't help.

 

Mladen,why do you all indicators declare :

extern int Price = PRICE_CLOSE;[/PHP]

should be:

[PHP]extern int Price = PRICE_OPEN;

because candle gives signal open, beginning. I'm right whether the wrong ?

 
popej30:
Mladen,why do you all indicators declare :
extern int Price = PRICE_CLOSE;[/PHP]

should be:

[PHP]extern int Price = PRICE_OPEN;
because candle gives signal open, beginning. I'm right whether the wrong ?
You have a choice of 7 prices in metatrader :

open

close

high

low

median - (high+low)/2

typical - (high+low+close)/3

weighted - (high+low+close+close)/4

Close is the usual close for price (that us the price that you normally see on you charts since bid is sometimes different from the close), Using open price in indicator sets the value using the open price of the bar and then ignores any current (opened bar) changes.

PS: option is there to enable you to use whatever price you wish. Default value using close price for is calculation is widely accepted as a default value in almost all indicators (not only metatrader). If you do not like the close price, than use open, but there is no rule that would say that using open price for current bar is better (quite the opposite - for the reasons explained above)

 
popej30:
Mladen,why do you all indicators declare :
extern int Price = PRICE_CLOSE;[/PHP]

should be:

[PHP]extern int Price = PRICE_OPEN;
because candle gives signal open, beginning. I'm right whether the wrong ?

Most of the usual indicators use the closing price, except CCI which uses typical price. I believe that's because it shows the current price in a better way than the open one. If you set an indicator to open price, it will not recalculate the current candle like it does with close, but it will also not show where the current price is. Also if you use an indicator on close price and enter on next candle when it gives a signal, it is quite the same than is you use open price and enter on the current candle...

Edit : I just saw Mladen replied, I thought it was weekend and no one was here, so I wanted to help . I leave my reply anyway. Regards.

 

I thing if indicator follow by price this always indicator will repaint.

 
popej30:
I thing if indicator follow by price this always indicator will repaint.

You are confusing repainting with calculating current opened bar price changes

One more time : repainting/recalculating is when closed bars are changed (and repainting being a coding error). Nothing to do with opened bar change to reflect the current price state

 

As I see is there actual no posibility to draw a rectangle behind a button and define, that clicking on the button is the Event and not the rectangle...

But I have another question:

How can I draw a horizontal line with a defined length? I tried it with OBJ_TREND, but one side of the line is infinite or Zero. So I can't draw a horizonal line from Bid-10 to Bid+10.

Do you now a solution?

 

i am a newbie coder. how to select only current window's symbol by orderselect function?

for(int cnt=0;cnt<OrdersTotal();cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); how to modify this sentence?

thanks a lot.

 
leowang:
i am a newbie coder. how to select only current window's symbol by orderselect function?

for(int cnt=0;cnt<OrdersTotal();cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); how to modify this sentence?

thanks a lot.

You can not modify the order select. But you can filter the orders processed. Add one "if" right after the OrderSelect() and all the processing should be after the following line :

if (OrderSymbol()!=Symbol()) continue;