Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Entries same direction

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

    Multiple Entries same direction

    Hi I'm trying to send these 3 market order long when starting a strategy but only the first one is submitted. Why?
    thanks!


    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "StrategiaALESSIO";
    Calculate = Calculate.OnPriceChange;
    EntriesPerDirection = 3;
    EntryHandling = EntryHandling.AllEntries;

    IsExitOnSessionCloseStrategy = false;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = true;
    MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    Calculate = Calculate.OnPriceChange;
    StartBehavior = StartBehavior.AdoptAccountPosition;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = true;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.ByStrategyPosition;
    BarsRequiredToTrade = 0;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.Configure)
    {
    }
    }

    protected override void OnBarUpdate()
    {
    EnterLong(1, "1");
    EnterLong(1, "2");
    EnterLong(1, "3");


    if (BarsInProgress != 0)
    return;



    }

    #2
    Hello AlessioCianini12.

    I tried the sample you provided and see that working on my end. Did you re apply the strategy after changing the EntriesPerDirection?

    I did notice that on the first entry on the chart that the execution was outside of the visible range so I had to rescale the chart slightly to see the second and third executions.

    I look forward to being of further assistance.

    Comment


      #3
      Hi, i solved the issue using if (State == State.Historical) return;
      it was doing the enters also for the previous bars and so i was exceeding the maximum number of bars.
      thank you

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      45 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
      31 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
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X