MQL4 Learning - page 29

 

IndicatorCounted can be used to multipairs ?

Hi,

I just learn MT4 programming.

I read alot many EA source code using

counted_bars=IndicatorCounted();

I already read the documentation, there is no parameter in function IndicatorCounted, is very totally different like other function.

The problem is

How to deal with currency pairs which are different than the current chart currency (The chart that hosts the expert advisor)? For example, how to make an expert advisor that can get the GBPUSD's totals bar or USDCHF while the expert advisor is hosted on EURUSD chart ?

It's simple for another function like iMa, iRSI, etc, that have symbol parameter, but IndicatorCounted ??

Any tricks or solution for IndicatorCounted() function for multipairs ??

Many thanks

Hans

 

Simple question...

Hi all,

I need help

How can I use the parameter "expiration" in a OrderSend function?

It doesn't seem to be the hour when the pending order will be deleted....if I put 21 (for example) my order will not deleted....

What is the right way to insert the expiration time???

Thanks

 
Maury74:
Hi all,

I need help

How can I use the parameter "expiration" in a OrderSend function?

It doesn't seem to be the hour when the pending order will be deleted....if I put 21 (for example) my order will not deleted....

What is the right way to insert the expiration time???

Thanks

As I know some trade servers forbid using this parameter (if "exp">0).

 

So the only solution is to set a function that close all the orders when time is > than x??

if(orderExists())

OrderSelect(getOrderTicket(),SELECT_BY_TICKET,MODE_TRADES);

if(OrderType() == OP_BUYSTOP && Bars>=openbar )

{

if(Hour() > 21)

{

closeOrder(getOrderTicket());

}

Is it right???

 

Need Code for determining # of positions currently open

Hi. I need a code snippet for determining number of positions opened. I am trying to work a piece of code for an EA that will allow 2 different variables for sending an order. the 1rst would be based on an external interger for lot size - that would be the 1rst lot size of the order sent. the second and subsequent lots would be based on an account balance/mulitplier (exernal int) figure. I just want to control the size of the initial lot, but be able to independently set the multiplier for subsequent lots. PLEASE HELP! Thanks

 
prouton:
Hi. I need a code snippet for determining number of positions opened. I am trying to work a piece of code for an EA that will allow 2 different variables for sending an order. the 1rst would be based on an external interger for lot size - that would be the 1rst lot size of the order sent. the second and subsequent lots would be based on an account balance/mulitplier (exernal int) figure. I just want to control the size of the initial lot, but be able to independently set the multiplier for subsequent lots. PLEASE HELP! Thanks

something like this ?

BuyLots = 0; SellLots = 0;

for(int i = OrdersTotal()-1; i >= 0; i --)

{

if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;

if(OrderSymbol()!= Symbol() || OrderMagicNumber()!= Magic) continue;

if(OrderType() == OP_BUY) BuyLots += OrderLots();

if(OrderType() == OP_SELL) SellLots += OrderLots();

}
 

Is there indicator that displays delimitation of time?

Nice to meet you.

I am Japanese.

The translation function is used.

The scale that displays time under the chart is displayed in MT4.

Is there "Indicator that displays the delimitation of a day, one week, and one month"

in this scale?

 

Hi from U.S. (Houston, Texas)!

If you go to the MT4 platform toolbar>Charts>Properties check 'show period separators' check box and it will divide up the graph in days. How is Godzilla these days?

Dave

<<<

 

Godzilla (N.Kositsin) - actually from Russia

if he in a bad mood this days - you don't wanna mess with him

 

Thank you for the answer.

It is possible to have done.

Is there a method of displaying the delimitation only in "Begin about a day" and "Begin

about one week" according to Japan standard time, too?

Reason: