[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's wrong with this code?



PureBytes Links

Trading Reference Links

> Perhaps since you only specified minutes and your calculation
> happened to occur on that minute it would meet the criteria. I
> think its always best to specify ranges for time. 

He DID specify a range for the channel, but I assume you're talking 
about the IF TIME = BEGINCH + BARINTERVAL test to initialize the 
channel.  I agree, it's not a good idea to test for an exact minute.  
It's possible you might have a missing bar on that minute.  I prefer 
to use a test like "if Time crosses over BeginCh-1".

The reason the system buys/sells on the first bar is because you keep 
issuing orders as long as Time > EndCh.  That means you place an 
order on the LAST bar of the day, and that order is in effect on the 
FIRST bar of the next day.  Add "and Time < Sess1EndTime" to your 
test and I'll bet your spurious first-bar orders go away.

Gary