Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with enter a long

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

    Problem with enter a long

    on this code , i try enter long when nq take low of a range and es dont take the low , or when es take a low of a range and nq dont take the low,

    when im runing the code , both pairs take low of a range and is still enter to trade why?


    region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.Indicators;
    using NinjaTrader.NinjaScript.DrawingTools;
    using NinjaTrader.Custom.utils;
    using static NinjaTrader.Custom.utils.TradingSessions;
    using System.Globalization;
    #endregion

    //This namespace holds Strategies in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class TEST: Strategy
    {




    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "Quaterly";
    Calculate = Calculate.OnEachTick;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;

    }
    else if (State == State.Configure)
    {
    AddDataSeries("MES 03-25", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);



    }
    }
    double currLowNq = 0;
    double currLowEs = 0;



    protected override void OnBarUpdate()
    {


    if (BarsInProgress == 1)
    {

    ESLow = SampleGetHighLowByTimeRange(startTime.Hour, startTime.Minute, endTime.Hour, endTime.Minute).LowestLow[0]; // start time on 8:00 end time of 9:00
    currLowEs = Lows[1][0];
    }

    if (BarsInProgress == 1)
    {

    NQLow = SampleGetHighLowByTimeRange(startTime.Hour, startTime.Minute, endTime.Hour, endTime.Minute).LowestLow[0]; // start time on 8:00 end time of 9:00
    currLowEs = Lows[1][0];
    }


    if (currLowNq < NQLow && currLowEs > ESLow || currLowNq > NQLow && currLowEs < ESLow )
    {
    EnterLong("");
    }


    }

    }

    }
    }

    #2
    Hello matanamar,

    It looks like you have already posted about this topic and received a response: https://forum.ninjatrader.com/forum/...f-prev-day-low

    We kindly ask that users refrain from posting multiple threads about the same topic. If you have questions about the same topic, please respond to the representative that has been working with you instead of creating a new thread.

    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