Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData and tick resolution

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

    OnMarketData and tick resolution

    Hello!
    I have the next problem.
    In my strategy I'm using multiple timeframes (1minute and 60minutes).
    The Entry Logics are on 1 minute timeframe.
    To Exit the positions I'm using OnMarketData with this code:


    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
    if (marketDataUpdate.MarketDataType == MarketDataType.Last)
    {
    if(Position.MarketPosition == MarketPosition.Long)
    {
    if(mycondition)
    {
    ExitLong(0, orderSize, "Exit Long", "Enter Long");
    }
    }
    }
    The problem is, that when I'm testing this strategy in Analyzer it does'nt works fine. All timestamps are only from 1 minute timeframe (on Entries and on Exits). Tick Replay is on.
    One problem is that now it seems like Strategy Analyzer ignores the Highs and Lows of bars - it must be the stoploss and ExitLong triggered, but the Close of the bar was higher then SL price - and it ignored this ExitLong. After some time, when Close comes lower - it comes.

    What I need to do?
    Thanks.

    #2
    Hello YevhenShynkarenko,

    When you say "All timestamps are only from 1 minute timeframe", what timestamps are you referring to? The code you have provided does not have any prints in it.
    I would be expecting:
    Code:
    Print(string.Format("{0} | market data update | {1}", marketDataUpdate.Time, marketDataUpdate));
    Or something like it, to see the time stamps of each market update..

    Are you printing the Highs and Lows to see these are being ignored in OnBarUpdate()?

    When you mention:
    " when I'm testing this strategy in Analyzer it does'nt works fine"

    What is not working fine?

    TickReplay cannot be used for order fill accuracy. Are you expecting the order fill prices to change? (They won't)
    An added 1 tick series would need to be used for accurate fill prices.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    53 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X