Thread: How to code?
View Single Post
  #1059 (permalink)  
Old 07-02-2008, 01:25 AM
luxinterior luxinterior is online now
Senior Member
 
Join Date: Nov 2006
Posts: 308
luxinterior is on a distinguished road
Quote:
Originally Posted by IngvarDagmar View Post
Sorry for my Englsih.

I want count number times condition is true only once per bar. Computer add up many times per bar. What wrong I do?
Use a function like this...

PHP Code:
bool NewBar() {

    static 
datetime LastTime 0;

    if (
Time[0] != LastTime) {
        
LastTime Time[0];        
        return (
true);
    } else
        return (
false);

Then put an if statement round your main code, like...

PHP Code:
if(NewBar() == true){
// do the main processing here

Hope that helps.

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
Reply With Quote