NexusFi: Find Your Edge


Home Menu

 





multi time-frame questions -- this is different


Discussion in NinjaTrader

Updated
    1. trending_up 2,359 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

multi time-frame questions -- this is different

  #1 (permalink)
 balance 
Taiwan
 
Experience: Intermediate
Platform: TOS, Matlab
Broker: IB, ToS
Trading: HSI, TF, CL
Posts: 17 since Aug 2011
Thanks Given: 5
Thanks Received: 11

Guarantee this is a different type of multi time frame question.

I have a strategy relying on three time frames, e.g., hourly, 10 min, and 2 min charts on the same instrument.
The logic is similar, do some computation, then consult the parent and child for their 'view of the world'. Make trade decision, then move on.

since the logic is fairly complex, using the standard multi timeframe approach will make my hair grey. In addition, I'd like each to have its own position, so I came up with a new way of running the SAME strategy multiple instances, each with its own time frame.
The class will have some static members for cross strategy communication, so that each can read others' 'view of the world'.
So it's quite possible Hourly is going long while 10-min is going short and 2-min is going long. Of course I can further optimize it so that when 2-min is going short, then all upper layers will go short or revers if currently long, etc. etc. But that's not the point here.

Since we have hourly, or even day, weekly, I have to do my own tick count because per tick is too expensive, and OnBarClose is not an option. This is also fine.

The question then is, assuming the strategy will run every 20 ticks, and the 10-min one is responsible for trades and the other two are only acting as 'consultants'. How can I make sure the 10-min instance is invoked last, on each OnBarUpdate event handling?

A general question is, when multiple strategies are running on a NT system, is there a fixed sequence of how each event is handled? or They could be run in parallel or un-deterministic sequence. If it's the former, then how to set the sequence?
If it's random/or parallel then I have a serious problem since ideally I'd prefer the 10-min be run last so that whey it's asking others for information, it's up to date. You don't want the 10-min making trade decision based on 2-min's 20-tick ago data.

Of course if I want al three to run trades, then I have no choice but to leave to it per tick, then the problem is I have to worry about if the system can take the load.

Any suggestion as to solve or improve on this?

Thanks.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
45 thanks
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824



balance View Post
Guarantee this is a different type of multi time frame question.

I have a strategy relying on three time frames, e.g., hourly, 10 min, and 2 min charts on the same instrument.
The logic is similar, do some computation, then consult the parent and child for their 'view of the world'. Make trade decision, then move on.

since the logic is fairly complex, using the standard multi timeframe approach will make my hair grey. In addition, I'd like each to have its own position, so I came up with a new way of running the SAME strategy multiple instances, each with its own time frame.
The class will have some static members for cross strategy communication, so that each can read others' 'view of the world'.
So it's quite possible Hourly is going long while 10-min is going short and 2-min is going long. Of course I can further optimize it so that when 2-min is going short, then all upper layers will go short or revers if currently long, etc. etc. But that's not the point here.

Since we have hourly, or even day, weekly, I have to do my own tick count because per tick is too expensive, and OnBarClose is not an option. This is also fine.

The question then is, assuming the strategy will run every 20 ticks, and the 10-min one is responsible for trades and the other two are only acting as 'consultants'. How can I make sure the 10-min instance is invoked last, on each OnBarUpdate event handling?

A general question is, when multiple strategies are running on a NT system, is there a fixed sequence of how each event is handled? or They could be run in parallel or un-deterministic sequence. If it's the former, then how to set the sequence?
If it's random/or parallel then I have a serious problem since ideally I'd prefer the 10-min be run last so that whey it's asking others for information, it's up to date. You don't want the 10-min making trade decision based on 2-min's 20-tick ago data.

Of course if I want al three to run trades, then I have no choice but to leave to it per tick, then the problem is I have to worry about if the system can take the load.

Any suggestion as to solve or improve on this?

Thanks.

I think the only way to make sure they are called in the correct sequence would be to call them yourself. But with that approach you would be at the starting point where you could run one multi timeframe strategy. The other thing would be to instantiate the two "consultants" from within the strategy and then put the code there in a method that you call instead of in OnBarUpdate ( I never got this part right though) or you make the strategy instances available to each other and then call the methods you need (this is rather easy).

vvhg

Hic Rhodos, hic salta.
Reply With Quote
  #4 (permalink)
 balance 
Taiwan
 
Experience: Intermediate
Platform: TOS, Matlab
Broker: IB, ToS
Trading: HSI, TF, CL
Posts: 17 since Aug 2011
Thanks Given: 5
Thanks Received: 11


vvhg View Post
I think the only way to make sure they are called in the correct sequence would be to call them yourself. But with that approach you would be at the starting point where you could run one multi timeframe strategy. The other thing would be to instantiate the two "consultants" from within the strategy and then put the code there in a method that you call instead of in OnBarUpdate ( I never got this part right though) or you make the strategy instances available to each other and then call the methods you need (this is rather easy).

vvhg

Thanks for the note.
Being relative new to NT programming, I didn't even know you can instantiate another strategies from within a strategy.
In this case, if I am 10-min, how do you specify the hour being the instance created?

And can we assume the hour instance will still have its DataSeries aligned with its own timeframe?

Thanks!

Started this thread Reply With Quote
  #5 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824


balance View Post
Thanks for the note.
Being relative new to NT programming, I didn't even know you can instantiate another strategies from within a strategy.
In this case, if I am 10-min, how do you specify the hour being the instance created?

And can we assume the hour instance will still have its DataSeries aligned with its own timeframe?

Thanks!

Well, that's the tricky part. I know it can be done but I am missing one piece, so I can't do it. But you can achieve the same with running a strategy that has a pointer to itself, that way you can call and access(depending on protection level of course) its methods and variables. So you have a strategy with the poiter, add and enable it in NT UI and then you can do whatever you want with it, like call a method every time the calling strategy has counted n number of ticks...

vvhg

Hic Rhodos, hic salta.
Reply With Quote




Last Updated on January 12, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts