|
Attention! Read the forum rules carefully before posting a topic.
Try to find an answer in Wiki before asking a question. Submit programming questions in this forum only. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
onBar function being called every ten seconds |
[triwebb1]
|
Post subject: onBar function being called every ten seconds |
Post rating: 0
|
Posted: Fri 03 Jul, 2009, 01:55
|
|
User rating: 0
Joined: Tue 30 Jun, 2009, 20:38 Posts: 17
|
It seems that the onBar() function is being called every ten seconds, no matter what live chart I try to run my strategy on, and no matter what period I use with the strategy tester. How do I make it so that onBar() is called only at the open of every new bar? I suppose I could filter everything under the onBar function by checking the current minute and second and only run it on the minute/second combinations that would correspond to the opening of new bars, but that sounds like a workaround to me, not a solution.
|
|
|
|
 |
[triwebb1]
|
Post subject: Re: onBar function being called every ten seconds |
Post rating: 0
|
Posted: Fri 03 Jul, 2009, 02:11
|
|
User rating: 0
Joined: Tue 30 Jun, 2009, 20:38 Posts: 17
|
OK, I figured it out, but it doesn't make sense to me. When using the strategy tester you have to select a period to test on, but it doesn't seem to matter what you select because the strategy will be run on all periods at the same time, starting with the 10 second bars and moving up. This is probably why I was seeing duplicate data before, because the strategy will be run on the same bars multiple times if that bar is the opening time for more than one period.
This really doesn't make sense to me - why would you allow the user to select what period to test on, but then require that the strategy filter out the bars that it wants to run on? It seems like you should either get rid of the ability to choose a period to test on, or make it so that the strategy is only run on the period specified. But w/e, I will make it work by putting everything in my onBar function under anf "if (period = "Desired Period")" statement.
|
|
|
|
 |
API Support
|
Post subject: Re: onBar function being called every ten seconds |
Post rating: 0
|
Posted: Fri 03 Jul, 2009, 11:28
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
when you selecting period in tester , it's doesn't' meaning that you defining period for testing, it's means you defining from what candles period tester will do approximation. In any case finally you will get ticks and all periods of bars in tester, but if you choose HOURS - you will have rough approximation , if you choose TICKS - you will get absolutely precise feed , exactly as it was. But testing takes more time.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|