Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exits with Multi Time Frame

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

    Exits with Multi Time Frame

    First my Primary is Renko and my Secondary are 1 Minute (first) and 20 Seconds (Second additional data series)
    Strategy is running OnBarClose - my preference with indicators etc

    currently in the Strategy Builder but can unlock the code if necessary

    Goal to exit with the trigger from the 20 second bar Close while current prints are intrabar of the current Renko Bar

    // Set 40
    if ((Position.MarketPosition == MarketPosition.Long)
    && (LongTrades == true)
    && (BarsSinceEntryExecution(0, "", 0) >= 0)
    && (Closes[2][0] <= (Low[0] + (-2 * TickSize)) )
    && (BarsSinceEntryExecution(2, "", 0) > 0))

    {

    ExitLong(Convert.ToInt32(Position.Quantity), @"LStop1", @"Long1");
    }


    ATTEMPTING TO TRIGGER when 20 Second bar dataseries CLOSE is Less than or Equal to the Renko Bar Low[0] (last completed bar of renko) less 2 ticks

    Thanks - hope the solution helps me and others

    #2
    Hello DTSSTS,

    That would require unlocking he strategy so that you can execute logic on the secondary series. The builder by default only executes logic on the primary but you can reference secondary series for conditions.

    In the unlocked strategy it will start with a return statement for BarsInProgress, that would need to be removed so you can form conditions using BarsInProgress:

    Code:
    if(BarsInProgress == 0)
    {
    
    }
    if(BarsInProgress == 1)
    {
        //exit logic on secondary series 
    }

    Comment


      #3
      Unlocked this is what I found

      if (BarsInProgress != 0)
      return;

      so blocked both lines (ie removed)

      then Adding you example code


      if(BarsInProgress == 0)
      {

      }
      if(BarsInProgress == 1)
      {
      //exit logic on secondary series
      }

      BUT I HAVE STATED in my post that I have 2 additional dataseries, and I actually am adding a 3rd additional series at this point

      SO DO I NEED A LINE OF CODE FOR EACH DATA SERIES "if(BarsInProgress == 1)"

      AND " //exit logic on secondary series " IS JUST A NOTE CORRECT?

      THUS I NEED

      if(BarsInProgress == 0)
      {

      }
      if(BarsInProgress == 1)
      {

      }

      if(BarsInProgress == 2)
      {

      }

      if(BarsInProgress == 3)
      {

      }


      AND DOES THIS STAY THE SAME


      if (CurrentBars[0] < 3
      || CurrentBars[1] < 5
      || CurrentBars[2] < 0)
      || CurrentBars[3] < 0)
      return;


      THANKS FOR THE HELP

      fwiw Unlocked WITH above changes my back test results are very erratic
      Last edited by DTSSTS; 07-13-2022, 04:21 PM.

      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