No waiting for next 'tick'?

 

Hi All,

Does anybody know how to code an EA, custom indicator etc; to be able to run a sequence without having to wait for the next 'tick' in start()?

In its' simplest form let's say a horizontal line was added to a chart - grab the line and move it up and down the chart and produce an instant readout of price by using a 'label' or 'comment'.

This is easy enough with some code in start() but with infrequent 'ticks' there is a wait period before the price value can be obtained. How can it be done dynamically??

thanks

 
int start(){
   while(!IsStopped()){ 
      RefreshRates();

      ...// everything else goes here.

      Sleep(1000);
   } // while
   return(0);
}
Can't be an indicator as they can not sleep.
 
WHRoeder:
Can't be an indicator as they can not sleep.


thanks for this - I did try this in an indicator and as you say it doesn't work. I guess there is no solution for an indicator then?

Also, I guess it is not possible to do anything in code with cursor/crosshair data in EA, indicator etc;??

thanks

 
sd59:
Also, I guess it is not possible to do anything in code with cursor/crosshair data in EA, indicator etc;??
See Buttons & Textfields on mt4 chart possible now - MQL4 forum
 

Don't the cross hairs do this for you or do you want to do something more complex than just get a price from a chart?

 

Look for:

void start()

if(Volume[0]>0)return(0); //<----remove this line
 
Ruptor:

Don't the cross hairs do this for you or do you want to do something more complex than just get a price from a chart?



yes, I want to be able to determine s/r levels dynamically by using the price values given by the crosshairs. So if I can utilise the price values from the cross hairs in code then this would be the ultimate solution.
 
mbirrell:

Look for:


please can you expand further - I don't have his code in my routine, should I include the void start() block?
 
sd59:

please can you expand further - I don't have his code in my routine, should I include the void start() block?
sorry - I misunderstood your question.
 
mbirrell:
sorry - I misunderstood your question.


you have suggested

void start()

if(Volume[0]>0)return(0); //<----remove this line
where do i find this line to remove it?
 
if you have that line in a script it will only run the script every bar count - eg: if your bar count is 1 minute then the script will run once every minute. If you take that line out then it will run every time there is a trade.
Reason: