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

Flaky BarsSinceEntry (multi-timeframe)

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

    Flaky BarsSinceEntry (multi-timeframe)

    Hi,

    I'm using a muti-timeframe strategy to enter and exit my trades (Eg entering on a 5min setup and exiting on a 1min scenario). Specifically, I have set some 5min exits and some 1min exits.

    So far, the code seems to be behaving rather well when I use the prescribed settings of BarsInProgress, BarsArray, High / Highs etc.

    However, the trade Exits get flaky When I use the BarsSinceEntry multi-timeframe function and its 3 overloads, and what was supposed to have been exited on a 1min timeframe gets confused with the 5min one.

    Please let me know if my understanding is correct:

    eg: BarsSinceEntry (1,"",0) > 5
    translates into: if more than 5 time periods have passed since the last entry on the secondary data series

    Can you tell me how to fit in entryName and entriesAgo using my example? The most recent entry in all cases would have been on the primary 5min data series.

    I have also uniquely labeled all the entries in a way that every open position at that point in time has its own name. Eg. "A", "B" (from a different market), "C" as the pyramiding increment of "A", each entered on a 5min timeframe

    Thanks

    #2
    Hi andreneoh,

    Ensure you place this under a BarInProgress check, for example...
    Code:
    if (BarsInProgress == 0) 
        { 
           BarsSinceEntry(1, "B", 0)                  
        }
    More info at - http://www.ninjatrader-support.com/H...BarsSinceEntry
    TimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by guillembm, Yesterday, 11:25 AM
    2 responses
    9 views
    0 likes
    Last Post guillembm  
    Started by junkone, 04-21-2024, 07:17 AM
    9 responses
    68 views
    0 likes
    Last Post jeronymite  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    4 responses
    18 views
    0 likes
    Last Post trilliantrader  
    Started by mgco4you, Yesterday, 09:46 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by wzgy0920, Yesterday, 09:53 PM
    0 responses
    10 views
    0 likes
    Last Post wzgy0920  
    Working...
    X