Indicators Values

 

Hi All

Some questions

For testing purpose i write one EA that I want attach to EurUsd 4 hours period.

The question are:
_Suppose that now we have candle 0. The Macd Main and Macd Signal values are the same on all tick and change only after 4 hour (new candle) or the two values can change between "2 candle" when ea receive tick?
_Is it the same for Adx?


_I buy when Dm+, of Adx, cross Dm- upwards and close buy when Dm- cross Dm+ upwards and Sell\Close Sell in the invers condition. If now I open Buy (Event 1) and after 4 hour I close Buy (Event 2) I don't

want that in Event 2 the system open Sell but only close order Buy and if after four hour (Event 3) I see another crossing I open another position. Is this possible or, with te specified trade conditions, I

can only close and open order in the same time (Event2)?

Thanks!

 

The values for all native indicators recount every TICK. This is the basis for MT4 programming. So the value will change during the course of the Bar and will remain unchanged after the bar closes (unless the indicator repaints, which native indicators do not, including ADX). To only check once during the course of the bar you can add and if(Volume[0]==1) to your order management. That way it will only check at the beginning of the bar.


As far as your order logic: The termial is only restricted by your available margin and any hedging restrictions in that you can open up as many orders (long or short) as long as your broker's server is ok with it.

 
mixtermind wrote >>

The values for all native indicators recount every TICK. This is the basis for MT4 programming. So the value will change during the course of the Bar and will remain unchanged after the bar closes (unless the indicator repaints, which native indicators do not, including ADX). To only check once during the course of the bar you can add and if(Volume[0]==1) to your order management. That way it will only check at the beginning of the bar.

As far as your order logic: The termial is only restricted by your available margin and any hedging restrictions in that you can open up as many orders (long or short) as long as your broker's server is ok with it.

Thankyou for the answer.

Some (simple) clarifications for my correct understanding:

  • Adx1_PlusDI=iADX(Symbol(),240,14,PRICE_CLOSE,MODE_PLUSDI,1);
  • The value don't change. It is correct?
  • Adx2_PlusDI=iADX(Symbol(),240,14,PRICE_CLOSE,MODE_PLUSDI,2);
  • The value don't change. It is correct?
  • Adx2_PlusDI=iADX(Symbol(),240,14,PRICE_CLOSE,MODE_PLUSDI,0);
  • The value change at every tick. It is correct?

Thanks