Help with 1 trade per candle - page 2

To add comments, please log in or register
ECI Invest
84
ECI Invest  
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

lippmaje
806
lippmaje  

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;
     }
  }
ECI Invest
84
ECI Invest  

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

Much appreciated!

William Roeder
19155
William Roeder  
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.
ECI Invest
84
ECI Invest  
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?
lippmaje
806
lippmaje  
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.
12
To add comments, please log in or register