How to code? - page 191

 

How can I replace the IndicatorCounted function below for use in an EA?

How can I replace the IndicatorCounted function below for use in an EA?

Thanks in advance,

Paul

int start()

{

int i,k;

int counted_bars=IndicatorCounted();

double high,low,price;

//----

if(Bars<=Tenkan || Bars<=Kijun || Bars<=Senkou) return(0);

//---- initial zero

if(counted_bars<1)

 
lumanauw:
Hi,

I try to code this, but don't work.

Try this:

bool GetFreeSpace(int Magic)

{

int total=OrdersTotal();

for (int cnt = total -1; cnt >=0 ; cnt--)

{

OrderSelect(cnt,SELECT_BY_POS);

if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && OrderType()<=OP_SELL )

if ( MathAbs(Bid-OrderOpenPrice())<(Step+Slippage)*Point))

return(false);

else return(true);

}

}
 
 

Thanks

Whats the difference between using (total) and (total-1) for cnt? If orders total=total, why it is decrease by (-1)?

for (int cnt = total -1; cnt >=0 ; cnt--)

 
lumanauw:
Thanks

Whats the difference between using (total) and (total-1) for cnt? If orders total=total, why it is decrease by (-1)?

for (int cnt = total -1; cnt >=0 ; cnt--)

i'll try to answer but don't trust me 100% still learning too

cnt = total - 1

total :will count all positions

total -1 :will return current position in decreasing value (lets say total is 5 so it will decrease like this

select cnt=position number 5 after finish the cnt-- triggered so

select cnt=position number 4 after finish the cnt-- triggered so...etc...

may be its like that i hope im correct

 

Orders are held in a ZERO based array so that's why you decrease the total number of orders by one. So the first order would have index 0, second index 1 etc.

Lux

 

Broker Symbol List

Hi...

I want to know is there any code to get broker's symbol list ?

for example EURUSD, GBPUSD, USDJPY ......

if there is so then please pass this code

Thanks

 
arshadFX:
Hi...

I want to know is there any code to get broker's symbol list ?

for example EURUSD, GBPUSD, USDJPY ......

if there is so then please pass this code

Thanks

SymbolList fromSet - MQL4 Code Base

 

How to code? Help please

Hi all

I want to code a indicator but I am novice about MQL and need help..

What I try to do is

1 Assuming the highest price before is H1 and

the lowest price before is L1

2 When price cross up higher than H1 then a event comes.

When price cross down lower than L1 then a event comes.

3 A event (signal) types are

1 color dot

2 sound (iterations is optional)

3 email (iterations is optional)

4 "X" is Variation of H1 or L1

can be assigned.

eg. When H2>(H1+X) then event comes.

5 When new event comes, color dots marked before be deleted.

Thats all

Help please

Thanks..

Files:
higher_high.jpg  24 kb
 
mladen:
It can happen that some of the symbols are "missing" from set files (by simply modifying that set file from market watch, for example). mladen

It's easy way to fix it. Right button click on Market Watch then "Show All". Again right button click, then Sets->Save as... and make the file with full list of currencies.