Coding help - page 755

 
mladen:

Your original question was :

The answer was regarding that. In any case, if you are trading manually, then there is no purpose of changing anything (not even the repainting indicator)
okey, you're right ... sorry my english is poor so as to make other people do not understand what I mean ... is there anything you recommend to me about EA to close all orders based HH and LL can lock the profit ..OP order with manual ... please

Thank you in advance for advice
 

Hello.

 

I am trying to write some bit of code to check if a 100 EMA has been lower or higher each candle for 10 candles. I can write it as 20 lines but that would not be very convinient. (trending for 10 periods)

Can anyone help me write a loop for this? 

 

Thank you very much. 

 

Hi Mladen sir

The Divergence index displays the percentual value of the closing price to the underlying moving average. A Divergence Index of 105% shows that the closing price is 5% above the moving average.

will You please code this indicator or give link if already made?

 
NWFstudent:

Hello.

 

I am trying to write some bit of code to check if a 100 EMA has been lower or higher each candle for 10 candles. I can write it as 20 lines but that would not be very convinient. (trending for 10 periods)

Can anyone help me write a loop for this? 

 

Thank you very much. 

You can do something similar to this :

         int count=0; for (;count<10; count++)  if ((iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,startFrom+count)-iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,startFrom+count+1))<0) break; bool allHigher=(count==10);
             count=0; for (;count<10; count++)  if ((iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,startFrom+count)-iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,startFrom+count+1))>0) break; bool allLower =(count==10);
 
alpha24:

Hi Mladen sir

will You please code this indicator or give link if already made?

Well I got this indicator on another forum

here is for forum members.

Files:
PDO.mq4  4 kb
 

Could this indicator be checked as it does not load on my chart?

Thanks

TEAMTRADER

Files:
 
TEAMTRADER:

Could this indicator be checked as it does not load on my chart?

Thanks

TEAMTRADER

It is working for now,but don't trust my correction,i don't know how to code/correct proper way,moderators can better guide us.

regards


Files:
 
TEAMTRADER:

Could this indicator be checked as it does not load on my chart?

Thanks

TEAMTRADER

It is not enough to just declare "DEMA" mode and then hope that iMA() can calculate it. iMA() does not "know" to calculate DEMA, it must be implemented as a separate calculation method
 
mntiwana:

It is working for now,but don't trust my correction,i don't know how to code/correct proper way,moderators can better guide us.

regards


mntiwana

With default settings as it is, it is calculating SMA (not DEMA, since iMA() does not know to calculate DEMA)

 
TEAMTRADER:

Could this indicator be checked as it does not load on my chart?

Thanks

TEAMTRADER

it does not compile
Reason: