![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
Hi
I am trying to develop an indicator like the TTM trend anchor (http://www.tradethemarkets.com/products/item294.cfm). The idea is look at say a daily chart with a heiken ashi and link it to a weekly timeframe. If both the daily and weekly bars are blues, then the indicator is blue, if both are red, the indicator is red, and if one is blue and one is red, the indicator is grey (neutral). This is shown in the attachment. All is going well until I hit the weekly bar of 16/6/12 on AUDUSD as shown in the attachement. I have a blue weekly bar and 5 blue daily bars, but the indicator is grey. I have used the print command to get the order of calculations, and everything seems to line up so I am very confused. Code is attached. Call up 2 charts of AUDUSD, one weekly, one daily with heiken ashi on both. Apply the indicator to the daily chart and look at the weekly bar for 16/6/12 and the corresponding 5 daily bars. Any help appreciated. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
nprince,
Could you show me a screen shot here? It doesn't look l like it attached.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
Sure - I think my original was too big. The chart on the left is the daily AUDUSD with the indicator at the bottom. The chart is linked to the weekly of the AUDUSD. Both charts have Heiken Ashi candles. The cross hair is on the Monday and shows that the entire week was blue bars. The equivalent single bar on the weekly is blue, however, my indicator shows grey bars for the whole week (both charts are blue, so I expect a blue bars on my indicator for the week).
Hope the screenshot helps and you can shed some light. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Hello,
This mostly looks Ok to me, however there is one thing you may want to change. I would suggest using the overload for the HeikenAshi indicator in the proper place, I am wondering if its calling the HeikenAshi for the same time frames. HeikenAshi(Closes[BarsInProgress] ).HAOpen[0] should work as an example.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
Hi
Thanks for the response. I have replaced the code with: primarySeries.Set(HeikenAshi(Closes[BarsInProgress] ).HAOpen[0] > HeikenAshi(Closes[BarsInProgress] ).HAClose[0] ? 0 : 1); for the primary series and the same for the secondary series. Have I understood this correctly? If so, it hasn't changed the outcome of the indicator. Any other ideas? Thanks |
|
|
|
|
|
#6 | |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello nprince,
In historical, the weekly bar will form at the end of the week. If you look into the prints you will find the same as. Quote:
Joydeep M.
NinjaTrader Customer Service
Last edited by NinjaTrader_Joydeep; 09-12-2012 at 09:18 AM.
|
|
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Joydeep
Thanks for your response - I'm not sure how I missed that from the prints! If this were a live chart, would it calculate differently? ie would the weekly bar for the 15th start forming and be updated for each bar on and after the 11th? Thanks |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello nprince,
If Calculate on Bar Close is set to false then in realtime, both the 1 day bar and the weekly bar will updated tick by tick.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem Creating EMA for Multi-Time Frame on Highs | RoyBoy | Strategy Development | 7 | 09-26-2012 11:22 AM |
| Multi time frame problem | basanca | General Programming | 5 | 07-09-2012 08:32 AM |
| Problem with Multi Time Frame | kevinchongck | Strategy Analyzer | 2 | 05-02-2010 11:57 AM |
| multi-time frame strategy problem | mfmsonic | Strategy Development | 4 | 12-20-2009 02:37 AM |
| Market Reply and Multi time frame Strategy problem | kekkis | Strategy Development | 3 | 12-30-2008 05:26 AM |