Button ChartRedraw() delay

 


I am endeavoring to have a button redraw, for about one second, to give the appearance of the button being pressed and immediately unpressed, on a single click.
The below code does not delay the change of STATE by one second between true and false. I have also tried a loop delay, instead of Sleep(1000), to no avail.

Any suggestions?

 ObjectSetInteger(0,sparam,OBJPROP_STATE,true); 
 ChartRedraw();
 Sleep(1000); 
 ObjectSetInteger(0,sparam,OBJPROP_STATE,false); 
 ChartRedraw();



 
rod178:


I am endeavoring to have a button redraw, for about one second, to give the appearance of the button being pressed and immediately unpressed, on a single click.
The below code does not delay the change of STATE by one second between true and false. I have also tried a loop delay, instead of Sleep(1000), to no avail.

Any suggestions?




If it is in an indicator, sleep will have no effect
Reason: