Help with 1 trade per candle - page 2

 
andrew4789:
I just save the time for the next possible trade in an array or variable, after OrderSend().
long nextTrade=TimeCurrent()+Period()* 60 * n

Then check if TimeCurrent>nextTrade before next OrderSend.

Thanx Andrew, but I am so clueless with this programming and dont understand it. I feel I am wasting your time. Thanx again

 

The code needed to solve this:

void OnTick()
  {
   static datetime lastbartime=0; // static will remember its value on subsequent calls

   datetime bartime=iTime(NULL,0,0); // get the start time of the actual bar
   
   if(BuyConditionsMet())
     {
      if(lastbartime!=bartime) BuyNow(); // buy only once a bar
      lastbartime=bartime;
     }
  }
 

Thanx all for your contributions. I have found a solution to the issue.

Much appreciated!

 
ECI Invest: ok, it would be nice if you can show me where to add it in the original code, its all greek to me. Can you please show me?
Learn to code it. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
 
William Roeder:
Learn to code it. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
I would love to learn how to code. Any suggestions where I could learn this? The internet is very vague with this information. How did you learn?
 
ECI Invest:
I would love to learn how to code. Any suggestions where I could learn this? The internet is very vague with this information. How did you learn?
You have been given 4 links to start with.
Reason: