reading bid value in script

 

hi

i have a question about reading Bid value inside script, which is run with infinite loop. When i run this script:

int start()
  {
   while(true)
   {
      Print("Bid:",Bid);
      Sleep(10000);
   }
   return(0);
  }

it takes Bid value from the moment when script was started, and isnt refreshing it.

When i use:

int start()
  {
   while(true)
   {
      Print("Bid:",MarketInfo(Symbol(),MODE_BID));
      Sleep(10000);
   }
   return(0);
  }

it takes current Bid value in every loop pass, so it works ok, but i need to have the first example working .

My goal is to run script as EA on offline chart with nonstandard time frame, and i think when i'll be able to get current Bid value in every loop pass i will be able to do this. Script which is run like this, also reads indicators value only on the moment when script is started, and also doesnt refresh them inside loop.

Does anyone has an idea how to circumvent this, and make script reading current values every time inside loop? I'm struggling with this for some time....


regards

oromek

 
int start()
  {
   while(true)
   {
      RefreshRates(); //add this
      Print("Bid:",Bid);
      Sleep(10000);
   }
   return(0);
  }

//z

 

thank you zzuegg

this is exactly this what i needed, i wasted so much time with this.... lack of knowledge costs so much time....


have a great day

oromek

Reason: