1 trade per day

[Deleted]  

HI,

I am having trouble making this EA take only 1 trade per daily bar.

I have used the code suggested by various posts here on the forum, but it continues to take multiple trades per daily bar.

Please help me make this ea trade once a day.

thanx

Joao Rosas
391
Joao Rosas  

int time_candle=0;



int start()

{ //time_candle =GlobalVariableGet("time_candle");

if(time_candle!=iTime(Symbol(),PERIOD_D1,0) )

{

if(your_buying_condition) {

ordersend....

time_candle = iTime(Symbol(),PERIOD_D1,0)

//GlobalVariableSet("time_candle", time_candle);

}

if(your_selling_condition) {

ordersend....

time_candle = iTime(Symbol(),PERIOD_D1,0)

//GlobalVariableSet("time_candle", time_candle);

}

}

}


//this approach is ok if terminal does not crash, otherwise it can still submit another trade because time_candle is set to zero again a terminal power up. In order to always work, you should use global variables, which is the code at the comment chars "//"

[Deleted]  
abstract_mind:


int time_candle=0;



int start()

{ //time_candle =GlobalVariableGet("time_candle");

if(time_candle!=iTime(Symbol(),PERIOD_D1,0) )

{

if(your_buying_condition) {

ordersend....

time_candle = iTime(Symbol(),PERIOD_D1,0)

//GlobalVariableSet("time_candle", time_candle);

}

if(your_selling_condition) {

ordersend....

time_candle = iTime(Symbol(),PERIOD_D1,0)

//GlobalVariableSet("time_candle", time_candle);

}

}

}


//this approach is ok if terminal does not crash, otherwise it can still submit another trade because time_candle is set to zero again a terminal power up. In order to always work, you should use global variables, which is the code at the comment chars "//"

Many thanx Ill give it a try.

[Deleted]  
23510:

Many thanx Ill give it a try.

Thanx absract_mind, the code works a charm!