Yeah, this looks perfectly fine, Ali. Please post a chart so that we can see the original problem where the indicator values are not calculated until the start of the trading schedule.
On Tue, Oct 7, 2014 at 7:59 PM, Ali Farahani <[email protected]> wrote: > Hello Eugene, > > The indicator I am using is a variation of Tension, as follows: > > public class Force extends Indicator { > private final double fastMultiplier, slowMultiplier; > private double fastBal, slowBal, fastPrice, slowPrice; > private final double scaleFactor; > > public Force(int fastPeriod, int slowPeriod, int scaleFactor) { > super(fastPeriod, slowPeriod, scaleFactor); > fastMultiplier = 2.0 / (fastPeriod + 1.0); > slowMultiplier = 2.0 / (slowPeriod + 1.0); > this.scaleFactor = scaleFactor; > } > > @Override > public void calculate() { > > MarketSnapshot snapshot = marketBook.getSnapshot(); > > // balance > double balance = snapshot.getBalance(); > fastBal += (balance - fastBal) * fastMultiplier; > slowBal += (balance - slowBal) * slowMultiplier; > double balanceVelocity = fastBal - slowBal; > > // price > double price = snapshot.getPrice(); > fastPrice += (price - fastPrice) * fastMultiplier; > slowPrice += (price - slowPrice) * slowMultiplier; > double priceVelocity = fastPrice - slowPrice; > > // force > value = balanceVelocity - scaleFactor * priceVelocity; > } > > Thanks again, > > Ali > > > On Tue, Oct 7, 2014 at 9:06 AM, Gmail <[email protected]> wrote: > >> Hi Eugene, >> >> Thanks for the clarification. I'm not by my PC right now, I'll send you >> the Force code later today. The code is a simple combination of >> BalanceVelocity and PriceVelocity. I combined them into a Force Indicator >> to be able to view the curve on the chart. >> >> Many thanks, >> >> Ali >> >> >> On Oct 7, 2014, at 6:08 AM, Eugene Kononov <[email protected]> >> wrote: >> >> Hi Ali, >> >> The indicators are calculated for the entire duration of the period in >> which market data is available, regardless of the trading schedule. The >> only thing that trading schedule controls is the time interval when the >> onBookSnapshot() method is invoked. If you don't see the indicator values >> before the trading schedule starts, the problem is in the indicator itself. >> The most likely explanation is that your indicator needs a history of >> market data which spans over the trading interval. For example, if you >> record from 9am, and the indicator needs 60 minutes of data to calculate >> its values, the first calculated indicator value would be at 10am. If you >> post your indicator code, perhaps I can spot a problem. >> >> E. >> >> >> On Tue, Oct 7, 2014 at 1:34 AM, Ali Farahani <[email protected]> wrote: >> >>> Hello Eugene, >>> >>> I am using the Trading Schedule of: >>> >>> TradingSchedule tradingSchedule = new TradingSchedule("10:05", "15:25", >>> "America/New_York"); >>> >>> The indicator I am using (Force) only becomes available starting at >>> 10:05. I am trying to also monitor Force between 9:30 and 10:05, so I >>> changed the Trading Schedule (in StrategyES) and added the following >>> exclusion: >>> >>> TradingSchedule tradingSchedule = new TradingSchedule("09:30", "15:25", >>> "America/New_York"); >>> tradingSchedule.setExclusion("09:30", "10:05"); >>> >>> So I am getting the "Exclusion period must be within trading period in >>> trading schedule." message (from TradingSchedule). >>> >>> Other than modifying the TradingSchedule class OR using 9:31 instead of >>> 9:30 in the exclusion statement, is there a better way of accomplishing >>> this objective? >>> >>> Kind regards, >>> >>> Ali >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "JBookTrader" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/jbooktrader. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "JBookTrader" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/jbooktrader. >> For more options, visit https://groups.google.com/d/optout. >> >> > -- > You received this message because you are subscribed to the Google Groups > "JBookTrader" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/jbooktrader. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "JBookTrader" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/jbooktrader. For more options, visit https://groups.google.com/d/optout.
