|
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.
| Run multiple times onTick method for one tick |
|
StephanePaulus
|
| Post subject: Run multiple times onTick method for one tick |
Post rating: 0
|
Posted: Tue 01 May, 2012, 22:25
|
|
User rating: 1
Joined: Tue 01 May, 2012, 22:05 Posts: 17 Location: United Kingdom, London
|
|
Hello,
I am looking for a way to make the onTick method run multiple times (every 10th of a second instead of every second when a new tick comes). If the end of the onTick method is reached, I want it to start over with the same tick, until there is a new tick. My onTick methode doesn't take very long to run.
Kind Regards Stephane
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Run multiple times onTick method for one tick |
Post rating: 0
|
Posted: Wed 02 May, 2012, 09:35
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
Consider implementing your onTick logic in another method and then call it from the onTick method on the same tick 10 times.
|
|
|
|
|
 |
|
astro
|
| Post subject: Re: Run multiple times onTick method for one tick |
Post rating: 2
|
Posted: Wed 02 May, 2012, 17:51
|
|
User rating: 4
Joined: Mon 19 Sep, 2011, 09:55 Posts: 29 Location: Germany,
|
|
Does this actually make any sense? What is the purpose of this seemingly odd logic? Because likely there is a better way to accomplish whatever you want to accomplish..
|
|
|
|
|
 |
|
StephanePaulus
|
| Post subject: Re: Run multiple times onTick method for one tick |
Post rating: 0
|
Posted: Wed 02 May, 2012, 22:44
|
|
User rating: 1
Joined: Tue 01 May, 2012, 22:05 Posts: 17 Location: United Kingdom, London
|
|
I am making a strategy, where you need to draw 3 ray lines. These lines represent the order(buy, sell, limit or stop), take profit and the stop loss. In my money management I calculate the width between those lines, this shows me what my risk ratio is. Because onTick runs only when a new tick comes, I have to wait on a tick when I move my lines to see my new risk ratio. The program can also automatically draw a buffer(ray)line, like 10 pips from the order line where the program will submit an pending order. If I move the order line, the buffer line will only be redrawn after a tick. It would be nice if this happens instantly.
A solution for this is nice to have, but I can live with the "wait".
This isn't exactly a automated strategy, but now I just need to place 3 lines and the program does the rest. It automatically changes the order settings, when you think the market is going up, I draw my ray lines in that direction and every tick will than increase the take profit and stop loss. This way I stay in the trade until there is a breach of a ray line.
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Run multiple times onTick method for one tick |
Post rating: 0
|
Posted: Thu 03 May, 2012, 09:36
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
|
 |
|
astro
|
| Post subject: Re: Run multiple times onTick method for one tick |
Post rating: 2
|
Posted: Thu 03 May, 2012, 10:25
|
|
User rating: 4
Joined: Mon 19 Sep, 2011, 09:55 Posts: 29 Location: Germany,
|
|
I think you can implement event listeners for chart objects (IChartObject.setChartObjectListener); there you would racalculate what ever is necessary on demand (when you access a chart object - like move)?
|
|
|
|
|
 |
|
StephanePaulus
|
| Post subject: Re: Run multiple times onTick method for one tick |
Post rating: 0
|
Posted: Thu 03 May, 2012, 17:37
|
|
User rating: 1
Joined: Tue 01 May, 2012, 22:05 Posts: 17 Location: United Kingdom, London
|
|
Thanks the event listener was just the thing I needed.
|
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|