Expert advisor

 

Hello everyone , please I need a help (EA programmers only ) ,  I am new to EA development 

why Bid price is not changing programmatically with this code :

int init(){
int i=0;
for(i=0;i<3;i++)
{
start(); 
}
return true;
}
int start()
{
Alert(Bid);
Sleep(2000);
return 1;
}

// result :              0.96776          0.96776             0.96776          but Bid was changing realtime on graph!!!  

 
rodoboss:

Hello everyone , please I need a help (EA programmers only ) ,  I am new to EA development 

why Bid price is not changing programmatically with this code :

// result :              0.96776          0.96776             0.96776          but Bid was changing realtime on graph!!!  

You have to explain where you define the "Bid" variable and how you assign a value to it ...

Without this information it's virtually impossible to help you.

Regards,
Malacarne

 
rodoboss:

Hello everyone , please I need a help (EA programmers only ) ,  I am new to EA development 

why Bid price is not changing programmatically with this code :

// result :              0.96776          0.96776             0.96776          but Bid was changing realtime on graph!!!  

I know the problem, but sorry I am not  an EA programmer.
 
rodoboss:

why Bid price is not changing programmatically with this code :

init() is called only when the EA is initialized (executed the first time)

start() is called and run 1 time for every new tick (Ask and Bid change)

if you call start() by yourself this doesn't make new Ask and Bid values appear (from nowhere)

Ask and Bid can come from:

- Server, during live execution
- History, during backtesting

 
um , thx for your help and  I found the solution : I must call  RefreshRates(); to refresh bid and ask ()
Reason: