Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Specify timeframe from which to get Indicator values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Specify timeframe from which to get Indicator values

    Hello,

    I am developing a strategy where I have a few conditions for indicator values, e.g.:

    - indicator x is greater than 1 ("1" created as a variable) on daily time-frame
    - indicator y is greater than 2 ("2" created as a variable) on 3 minute time-frame

    It needs to be incorporated into the strategy but I could not find a way to do this using strategy builder - is there a way to do it with the builder?
    If not, I assume I will unlock the code and add it in the script. I know I need to use Add(PeriodType.Minute, 3) for example but I cannot find a way to indicate following:

    - indicator x - get value from daily and then see if the value meets the condition
    - indicator y - get value from 3-minute and then see if it meets the condition

    I did a lot of research and followed tutorial for strategy builder but didn't find anything that would answer my question, apologies if this is too trivial.
    Thanks a lot for any feedback.
    David

    #2
    Hello Paco0,

    Thanks for your post.

    There are a couple of approaches.

    1) Modify the indicators to provide a "transparent" colored plot that outputs a signal level (It looks like you are using values of 1 & 2) when their conditions are true and a zero when they are not. The indicators can then be used in the strategy builder and their signal plots can be used as part of the conditions. In the strategy builder you would need to add the time frames of daily and 3 minute and then assign those to the indicators for use as their data source. Once the other time frames are added you can assign the time frames through the "Data series" selection for the indicators. If the chart where you are applying the strategy is a 3 minute series then you do not need (or want) to add the 3 minute series in the strategy as the script will adopt/use the chart bars.

    Note, anytime you access daily bars and are using intraday data to trade with, be aware that you will likely have to load more days of data overall. You may also need to change the BarsRequiredToTrade value. Reference: https://ninjatrader.com/support/help...redtotrade.htm

    2) Work in Ninjascript as you suggested, you might find it easier to incorporate the indicator coding within the strategy although you could take the same approach as suggested above (transparent plots) if you wanted to keep things separate. Multi time frame coding in Ninjascript requires a number of considerations and this section of the help guide is written to give you the best understanding of all the considerations: https://ninjatrader.com/support/help...nstruments.htm
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by traderqz, Yesterday, 09:06 AM
    2 responses
    15 views
    0 likes
    Last Post traderqz  
    Started by traderqz, Today, 12:06 AM
    3 responses
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by RideMe, 04-07-2024, 04:54 PM
    5 responses
    28 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by f.saeidi, Today, 08:13 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by DavidHP, Today, 07:56 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X