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

DOES THIS LINE indicate that I was using a secondary data series

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

    DOES THIS LINE indicate that I was using a secondary data series

    I had this working on prior strategies but not on the one I am working on at this time


    if ((Position.MarketPosition == MarketPosition.Short)
    && (ShortTrades == true)
    && (TimeExit2 == true)

    && ((Close[1] > Open[1])
    || (Close[1] == Open[1])
    || (Close[1] < Open[1]))


    && (ToTime(Times[0][1]) == 092600))

    {
    ExitShort(Convert.ToInt32(Position.Quantity), @"STimeExit2", @"");

    }


    DOES THIS LINE indicate that I was using a secondary data series, (which would make sense to me as I used a non time based primary bar type)

    && (ToTime(Times[0][1]) == 092600))

    Thanks

    #2
    Hello DTSSTS,

    No, not necessarily. Using Times[0][1] would be the most recent bar of the primary series BarsInProgress 0.
    This would be fine to use even if no additional data series have been added with AddDataSeries() calls in State.Configure.

    If you want to know why the condition is not evaluating as true, print the time of the bar and all values in the condition along with labels for each value and comparison operator.

    Below is a link to a forum post that discusses using prints to debug and understand behavior.


    Are you certain that a non-time-based bar type is going to have a bar with a close time of exactly 9:26 am? (This seems unlikely)
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,966 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    4 views
    0 likes
    Last Post rbeckmann05  
    Started by rhyminkevin, Today, 04:58 PM
    4 responses
    54 views
    0 likes
    Last Post dp8282
    by dp8282
     
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    8 views
    0 likes
    Last Post lightsun47  
    Working...
    X