> > The number 0 mean to exit all the positions. > > Not all positions, but the position of that particular strategy. In JBT, multiple stategies can run at the same time, independently. One can be short, another can be long, and another can be flat.
> The number 1 mean to keep one if there is one position, add one > position(one contract?) if there are no position held. > > setPosition(1) means "make a trade so that the strategy is long one contract (or 1 share of a stock)". So, if the strategy is flat at that time, it will buy 1 contract. If the strategy is short at that time, it will buy 2 contracts. If the strategy is long 1 contract at that time, no trade would occur. > One thing I am not clear is how do I know the position is long or > short(?). I didn't see this in the code of Sample Strategy. > > setPosition(1) = go long 1 contract setPosition(-1) = go short 1 contract setPosition(0) = go flat -- 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/groups/opt_out.
