Hi Eugene, I can understand from the code that min sample size is 1 hour from the following code: private static final long MIN_SAMPLE_SIZE = 60 * 60; // 1 hour worth of samples, which means 3600 seconds. However for GAP_SIZE, I don't understand how 60*60*1000 represent gap size of 1 hour. Would you mind explaining the role of 1000 in the GAP SIZE?
Thanks On 11 Jan, 23:16, nonlinear5 <[email protected]> wrote: > > So, would the back testing mode close all opened positions when a GAP is > > detected? In other words, does it avoid overnight positions? > > The way open positions are managed is controlled by how you set your > TradingSchedule instance. Neither GAP SIZE nor MIN SAMPLE SIZE affect > whether any open positions will be closed. Let's look at a couple of > examples. > > Example 1. > The trading schedule is 10am to 3pm. You happen to start JBT at 9:30am. JBT > will be in the "data accumulation mode" for the period of time specified by > the MIN SAMPLE SIZE. That is, it will record the data and update the > indicators, but no trading will be allowed until after the period of time > specified in MIN SAMPLE SIZE. This allows the indicators to "settle". I am > referring to the indicators which use past data, such as all the indicators > based on moving averages. The default value for MIN SAMPLE SIZE is 1 hour, > so at 10:30am JBT will allow the trades to go through (if there is a > corresponding buy/sell signal at that time). > > Example 2. > The trading schedule is 10am to 3pm. At 1pm, your strategy went long and now > has an open position. At 3pm, JBT will close this open position, no matter > whether there were any gaps this day, the previous day, or in the overnight > session in between. > > Example 3. > The trading schedule is 10am to 3pm. At 11am, your strategy went long and > now has an open position. At 11:30am, you lost your market data feed. At > 12:31, the market data feed was restored. JBT will flag is as a gap, because > there was no market data for a period longer than the one specified in GAP > SIZE. Correspondingly, JBT will be in the "data accumulation mode" until > 1:31pm, and no trades will be place till that time. > > Hope this makes it more clear. -- You received this message because you are subscribed to the Google Groups "JBookTrader" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jbooktrader?hl=en.
