little help please

 

I need a code that allow's  me to open only one order per hour on a single symbol.


 this is the  sell condition 

 if(Close[1] > Open[1])
   {
double S=MathAbs(High[0]-Close[1]); 
double Sp=S/Point; 
if(Sp>=20)
result=OrderSend(Symbol() , OP_SELL , lot , Bid , Slippage , Bid+SL*Point , Bid-TP*Point, "" ,MagicNumber , 0 , Green);
Comment(Sp);

 waiting for your help ...thanks in advance :)

 
Amin0xy:

I need a code that allow's  me to open only one order per hour on a single symbol.


 this is the  sell condition 

 waiting for your help ...thanks in advance :)

Search for "once per bar" ad use the H1 timeframe.

For example: https://forum.mql4.com/63605#975674  or  https://forum.mql4.com/34592/page2#854419   

 
thanks you ..but i didn't find something specific ...please i need the exact cmd that force the system to make only one trade per bars
 
Amin0xy:
thanks you ..but i didn't find something specific ...please i need the exact cmd that force the system to make only one trade per bars

I gave you two links . . . do some reading and learning.
 

thank u any way 

i did find this ..and its worked

 

static bool IsNewBar;
static datetime LastBarOpenAt;


start()
 {

 if(LastBarOpenAt == Time[0]) // This tick is not in new bar
    {
     IsNewBar=false;
    }
  else
    {
      LastBarOpenAt = Time[0];
      IsNewBar = true;    
    }

if(IsNewBar)
{
// the rest of the code..................................................

// ................................................................
}