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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    128 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    117 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X