Coding help - page 131

 
arroganzmaschine:
I saw that there are also alerts. They are sent when some IndexBuffers have the right value. Can I send my orders with some if{-clauses?

Yes. That is a normal way to open orders : when some conditions are fulfilled

 

Okay, so I have to import the Buffers with the iCustom()-function to the ea and check after start { whether the condition is fulfilled?

 

Mladen what a quick response; you are the best, thanks.

 

Ok, finally there are indicator constants and indicator buffers in the indi which fulfill the condition.

Example Constant: #define IN_TRADE 0

Example Buffer: double Long[];

How can I import these to my EA and check the condition every new candle?

 
arroganzmaschine:
Ok, finally there are indicator constants and indicator buffers in the indi which fulfill the condition.

Example Constant: #define IN_TRADE 0

Example Buffer: double Long[];

How can I import these to my EA and check the condition every new candle?

arroganzmaschine

The usual way how EA communicates with an indicator is through iCustom() function. The best way is to read that thread about iCustom() function and then a lot of things about EA to indicator communication will be clarified

 

Again one question: How can I display an alert only once? e.g. one for one candlestick?

 
arroganzmaschine:
Again one question: How can I display an alert only once? e.g. one for one candlestick?

The simplest way would be the following (if you take into account just the bar for alert not the type of the alert too) :

static datetime lastTimeAlerted=0;

if (lastTimeAlerted!=Time[0])

{

lastTimeAlerted = Time[0];

//

//

// your code for alert here

//

//

}

PS: that code goes out the loop (it does not have to be in the loop, but it should be called when all the calclation is done)

 

Hi Mladen

please can you double check this, for the candle close

its possibly ok, but not sure ?

thanks very much

 
mladen:
The simplest way would be the following (if you take into account just the bar for alert not the type of the alert too) :
static datetime lastTimeAlerted=0;

if (lastTimeAlerted!=Time[0])

{

lastTimeAlerted = Time[0];

//

//

// your code for alert here

//

//

}

PS: that code goes out the loop (it does not have to be in the loop, but it should be called when all the calclation is done)

Big thanks! Worked!

 
WR1:
Hi Mladen

please can you double check this, for the candle close

its possibly ok, but not sure ?

thanks very much

WR1

As far as I see it is OK (even in a multi time frame mode)