exit from position and stop loss

143 views
Skip to first unread message

oruchovets

unread,
Jul 23, 2011, 6:10:44 AM7/23/11
to JBookTrader
Hi , just couple of days investigating jbooktrader and I must say that
you guys made excellent stuff.
I am very newbie to and want to ask couple of questions:

I want to run back testing couple of strategies but stuck with a
such problem:
1) What is the way to exit from position.
I saw such line of code addParam(EXIT, 12, 18, 1, 14); at
Pendulum1 class.
12 -- min
18 -- max
1 -- step
14 -- value
I didn't understand how these parameters relates to stop .(may be in
case of price will be 12 or 18 exit from the trade , but if so what is
the step and value parameters are responsible for?)
2) What is the way to define stop loss?
3) What is the best practice to test strategies based on bar/candle
stick analysis?
For example: I need to check:
in case after predefined condition I start
counting the bars number and enter the trade after closing bar number
3?

4) What TAU parameter means?

Thanks in advance
Oleg.

nonlinear

unread,
Jul 23, 2011, 9:23:12 AM7/23/11
to jbook...@googlegroups.com


1) What is the way to exit from position.
      I saw  such line of code addParam(EXIT, 12, 18, 1, 14); at
Pendulum1 class.
      12 -- min
      18 -- max
        1 -- step
      14 -- value
  I didn't understand how these parameters relates to stop .(may be in
case of price will be 12 or 18 exit from the trade , but if so what is
the step and value parameters are responsible for?)

The "value" is used for live trading, backtesting, and forward testing. The other three (min, max, step) are used for optimization. During the optimization, JBT iterates through all combinations of parameters. For example, if one of the parameters is EXIT, an it's set with min=12, max = 18, and step=1, the optimizer will try all values in the range from 12 to 18. It's important to note that in the case of this particular strategy, the EXIT does not refer to the number of points at which the stop loss happens. Instead, it's simply a threshold for the indicator used in this strategy. This strategy is called Pendulum for a reason. Think of a real pendulum. When its swing reaches the extreme point (defined by the pendulum velocity and acceleration), you can think about this moment in time as a "long entry" condition. When it reaches the neutral point, it can be thought as an "exit" condition.


 
 2) What is the way to define stop loss?

There is no built-in method for this in JBT. However, this can be easily implemented. In my experience, stop losses do not improve the risk/reward profile of the strategies, so I don't use them, and that's why JBT doesn't have it.
 
 3) What is the best practice to test strategies based on bar/candle
stick analysis?
                  For example:  I need to check:
                     in case  after predefined condition I start
counting the bars number and enter the trade after closing bar number
3?


JBT is meant for book trading (i.e. microscopic analysis of the market based on the exchange limit order book). It's not a bar-based trading system.

 
4)  What TAU parameter means?


TAU refers to time delay. It's just a smoothing parameter in this particular strategy.

 

Oleg Ruchovets

unread,
Jul 23, 2011, 11:39:06 AM7/23/11
to jbook...@googlegroups.com
Thank you for quick response.

On Sat, Jul 23, 2011 at 4:23 PM, nonlinear <eugene....@gmail.com> wrote:


1) What is the way to exit from position.
      I saw  such line of code addParam(EXIT, 12, 18, 1, 14); at
Pendulum1 class.
      12 -- min
      18 -- max
        1 -- step
      14 -- value
  I didn't understand how these parameters relates to stop .(may be in
case of price will be 12 or 18 exit from the trade , but if so what is
the step and value parameters are responsible for?)

The "value" is used for live trading, backtesting, and forward testing. The other three (min, max, step) are used for optimization. During the optimization, JBT iterates through all combinations of parameters. For example, if one of the parameters is EXIT, an it's set with min=12, max = 18, and step=1, the optimizer will try all values in the range from 12 to 18. It's important to note that in the case of this particular strategy, the EXIT does not refer to the number of points at which the stop loss happens. Instead, it's simply a threshold for the indicator used in this strategy. This strategy is called Pendulum for a reason. Think of a real pendulum. When its swing reaches the extreme point (defined by the pendulum velocity and acceleration), you can think about this moment in time as a "long entry" condition. When it reaches the neutral point, it can be thought as an "exit" condition.

Thank you , it is become much more clear now. 



 
 
 2) What is the way to define stop loss?

There is no built-in method for this in JBT. However, this can be easily implemented. In my experience, stop losses do not improve the risk/reward profile of the strategies, so I don't use them, and that's why JBT doesn't have it.

 
Can you give some Idea of implementation stop loss , Is more comfortable for me using stop loss. 


 
 3) What is the best practice to test strategies based on bar/candle
stick analysis?
                  For example:  I need to check:
                     in case  after predefined condition I start
counting the bars number and enter the trade after closing bar number
3?


JBT is meant for book trading (i.e. microscopic analysis of the market based on the exchange limit order book). It's not a bar-based trading system.

   Oh , I see. I have to learn more about book trading.
   Investigating the code I understand that the product has part of infrastructure like Bar class and other facilities.
   From your experience is it complicated to add functionality to use bar-based analysis? I liked the clean and well structured code of the product. But I have no experience in Automatic trading. May be you can share  your experience (approaches) how to add the bar-based analysis and I'll contribute the implementation of it. 

Or any other Idea like integration with another product. From mail list it is mentioned JSystemTrader , JArbitrager. 
Do these product provides bar-based functionality.


       


 
4)  What TAU parameter means?


TAU refers to time delay. It's just a smoothing parameter in this particular strategy.

 

--
You received this message because you are subscribed to the Google Groups "JBookTrader" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jbooktrader/-/g7f-4bwqqAMJ.
To post to this group, send email to jbook...@googlegroups.com.
To unsubscribe from this group, send email to jbooktrader...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jbooktrader?hl=en.

Judson Wilson

unread,
Jul 23, 2011, 1:31:43 PM7/23/11
to jbook...@googlegroups.com
 
Can you give some Idea of implementation stop loss , Is more comfortable for me using stop loss. 


All the price reading capability is easily found, as is the ability to place an order, that should be enough information.  If it is not, you probably are not technically qualified to do automated trading - one bad line of code can bankrupt you! 

Please carefully consider if you understand programming well enough before you begin live trading.

Eugene Kononov

unread,
Jul 23, 2011, 2:12:59 PM7/23/11
to jbook...@googlegroups.com
May be you can share  your experience (approaches) how to add the bar-based analysis and I'll contribute the implementation of it. 


Thanks, but I am not looking for bar-based analysis or bar-based trading  addition to JBookTrader. Conceptually, it doesn't fit in.


Oleg Ruchovets

unread,
Jul 23, 2011, 3:10:48 PM7/23/11
to jbook...@googlegroups.com
    Ok , that is why I am looking active product like jbooktrader. :-) which is use in live trading. But anyway thank you for warning me. I'll do a lot of testing before going live trading. 
             From technical standpoint I don't see any problem. I have ~10 years of java experience but I almost don't know automatic trading domain area.
  
    Any advices about similar product which based on chart-base analysis. Google didn't help me to much on it.
Most of the project I found are drowsy or doing irrelevant stuff.

 

--
You received this message because you are subscribed to the Google Groups "JBookTrader" group.

Astor

unread,
Jul 23, 2011, 3:44:23 PM7/23/11
to jbook...@googlegroups.com
 
     "Any advices about similar product which based on chart-base analysis"
 
Oleg, I may be able to help you with your automated chart trading - and you may be able to help me with Java programming in return. However, this discussion probably should be done outside of JBT group, which is dedicated to trading the order book.
 
E-mail me directly at astor...@yahoo.com so we can talk.
 
Regards,
 
Michael Astor.
From: Oleg Ruchovets <oruch...@gmail.com>
To: jbook...@googlegroups.com
Sent: Saturday, July 23, 2011 2:10 PM
Subject: Re: [JBookTrader] Re: exit from position and stop loss
Reply all
Reply to author
Forward
0 new messages