funny I just ran into that problem yesterday. I also thought this would be the 
case. For my auto system I used Hermans code for a new bar, like:

PrevTN = StaticVarGet("TimeNumber" + Name() + "combiSys"); 
TN = LastValue(TimeNum()); 
NewBar = TN != PrevTN; 
StaticVarSet("TimeNumber" + Name() + "combiSys",TN);

however,  

if (NewBar) 
{
}

inside a 5 minute chart will give a true value each minute.

I needed to use:

if (NewBar AND LastValue(round(Minute()/(Interval()/60)) - 
Minute()/(Interval()/60)) != 0)
{
}

this will give a true value every 5 minutes inside a 5min chart.

regards, Ed




From: Keith McCombs 
Sent: Friday, August 06, 2010 7:06 PM
To: amibroker@yahoogroups.com 
Subject: Re: [amibroker] EOD exit


  
I have some questions:  
I thought that TimeNum() returned the time stamp of an existing bar, so that if 
you were using 1 minute bars, you would not get the signal until 125600, or 
with 5 minute bars until 130000.  Is that not correct?

Wouldn't it be better to use either TimeNum() >= 125500 (for backtesting); and 
Now(4) > 125500 (for real time trading)?

-- Keith

On 8/6/2010 10:24, Sidney Kaiser wrote: 

    
        Thanks, so simple..I just wasn't seeing the answer.  Sid

        --- On Fri, 8/6/10, reinsley <reins...@yahoo.fr> wrote:


          From: reinsley <reins...@yahoo.fr>
          Subject: Re: [amibroker] EOD exit
          To: amibroker@yahoogroups.com
          Date: Friday, August 6, 2010, 12:22 AM





          Hi,

                Buy = â?¦your conditionsâ?¦. 
                Sell = â?¦.your conditionsâ?¦. OR TimeNum() > 125500; 

               
                For example - MACD crossover : 

               
                Buy = Cross( MACD(), Signal() ); 
                Sell = Cross( Signal(), MACD() ) OR TimeNum() > 125500; 

          Best regards

          Le 06/08/2010 05:45, Sidney Kaiser a écrit : 
              
                  Hi Gang,

                  I'm evaluating a simple day trading concept and I need a 
quick and easy way to exit the trade at 1255 hours.  What code do I need to 
exit either short or long near EOD.
                  TIA
                  SId 




       



Reply via email to