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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    111 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    60 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    38 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    43 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    79 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X