Hello, Is there any way how to do it?

 

i'm sorry but i'm still begginer in programing - so it may seems very simple for you...


How can i do something like:

if(true)

{

BUY else SELL - no matter

WAIT FOR NEXT BAR - this is important

}


because between bars should be the condition changed many times :(


So, can i forbid the int start() to solve the conditions in one bar again and again? Or is there some other way how to prevent it to make 50 trades at same bar?

I've tried to use the Sleep() function, but it doesn't seemed to work :(


Many Thanks


maarty

 
maarty:

i'm sorry but i'm still begginer in programing - so it may seems very simple for you...


How can i do something like:

if(true)

{

BUY else SELL - no matter

WAIT FOR NEXT BAR - this is important

}


because between bars should be the condition changed many times :(


So, can i forbid the int start() to solve the conditions in one bar again and again? Or is there some other way how to prevent it to make 50 trades at same bar?

I've tried to use the Sleep() function, but it doesn't seemed to work :(


Many Thanks


maarty

You can probably use some variation of this:


static datetime barTime;


if(true && barTime != Time[i])

{

BUY else SELL - no matter

WAIT FOR NEXT BAR - this is important

barTime = Time[i];

}



Reason: