Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to trade MNQ based on 100 tick NQ data

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

    how to trade MNQ based on 100 tick NQ data

    I want to trade MNQ based on 100 tick NQ data. I open a MNQ chart and apply the strategy as follows. However, it still buys and sells NQ instead of MNQ.

    else if (State == State.Configure)
    {
    // Add 100-tick series for RenkoKings_NovaWyndRK2
    AddDataSeries("NQ JUN25", Data.BarsPeriodType.Tick, 100, Data.MarketDataType.Last);

    }
    else if (State == State.DataLoaded)
    {
    Moon1 = Moon(Closes[1], A1, A2, 5, 10, true, 10);
    }
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 1)
    return;

    if (CurrentBars[0] < 1)
    return;

    // Set 1
    if (Moon1.Signal[0] == 1)
    {
    EnterLong(Convert.ToInt32(Quantity), "");
    }

    // Set 2
    if (Moon1.Signal[0] == -1)
    {
    EnterShort(Convert.ToInt32(Quantity), "");
    }

    #2
    Hello Playdc,

    Thanks for your message.



    From the sample code you provided us, the issue seems to be coming from the BarsInProgress condition, where your order method is being triggered on BarsInProgress 1. Also, there's no BarsInProgress index selected in your order methods to select the correct BarsInProgress index.

    This means that within your code:


    protected override void OnBarUpdate()

    {

    if (BarsInProgress != 1)

    return;


    Your condition states that if BarsInProgress does not equal 1, it should return. The BarsInProgress 1 is your added NQ data series, meaning that the BarsInProgress 0, which is the primary data series(MQN), will not run OnBarUpdate(). Your order methods are also being submitted on BarsInProgress 1, your added data series(NQ).

    Since the conditions are calculated based on the added data series (NQ 06-25), to correctly place orders on the primary series, MNQ, you can overload EnterLong() and EnterShort() with the barsInProgressIndex 0.

    For example.


    EnterLong(0,Convert.ToInt32(Quantity),"");



    The number 0 represents the BarsInProgress index of the primary series of the chart, MNQ

    Below you will find documentation in regard to BarsInProgress, EnterLong(), and EnterShort().


    BarsInProgress

    EnterLong()

    EnterShort()

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Working...
    X