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

working with multiple time frames

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

    working with multiple time frames

    What if I was trying to set a specific manual profit target/stop out on a shorter (faster) time frame, like a red bar of the 5 minute.
    Can I just throw this code into my
    Code:
    protected override void OnBarUpdate()
    ?

    Code:
    if (BarsPeriod.BarsPeriodType == BarsPeriodType.Minute && BarsPeriod.Value == 5)
       {
              // Indicator calculation logic here
    
              if (Close[0] < Low[1]) //break out to the down side
                   {
                     ExitLong(DefaultQuantity,"","");
                   }
    }
    Would I need to run unlocked code for it to even work? Thanks

    #2
    Hello ezrollin,

    The strategy would need to be unlocked to place orders to an added series as this is not possible with the Strategy Builder. With the Strategy Builder orders must be placed to the primary series (chart series).

    You could instead make the chart have the time frame you want the orders to update on, and add the other series as added series, instead of that being the primary series (chart series).

    Below is a link to the unlocked example of placing orders to the BarsInProgress of an added series.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by dmking, 11-12-2019, 12:31 PM
    4 responses
    4,140 views
    0 likes
    Last Post jasonw
    by jasonw
     
    Started by roblogic, Today, 04:31 PM
    0 responses
    5 views
    0 likes
    Last Post roblogic  
    Started by morrnel, 05-12-2024, 06:07 PM
    4 responses
    56 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by xepher101, 05-10-2024, 12:19 PM
    6 responses
    72 views
    0 likes
    Last Post xepher101  
    Started by gbourque, Today, 04:11 PM
    0 responses
    3 views
    0 likes
    Last Post gbourque  
    Working...
    X