Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceExit ?

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

    BarsSinceExit ?

    I want to code that from last ExitLROC, & if BarsSinceExit are betwen 1 and 10, and ROC crosses above 0 again enter long.

    Please note that it will work on multi time frame strategy.


    // Exit Long
    if
    (Position.MarketPosition == MarketPosition.Long)

    if (CrossBelow(ROC(12), 0, 1))

    {
    ExitLong(
    "ExitLROC", "Long");
    }

    // Re-entry Long ROC above 0
    if (Position.MarketPosition == MarketPosition.Flat)

    if ((BarsSinceExit(0,"ExitLROC",0) > 1 && BarsSinceExit(0,"ExitLROC",0) < 10 ) && CrossAbove(ROC(12), 0, 1))
    {
    EnterLong(
    100000, "ReLong");
    }

    //Exit ReLong
    if (Position.MarketPosition == MarketPosition.Long)

    if (CrossBelow(ROC(12), 0, 1))

    {
    ExitLong(
    "ExitLROC2", "ReLong");
    }

    First "ExitLROC" do OK. But never re-entries, although ROC do crosses above cero again. Am I using BarsSinceExit function OK?

    #2
    fercho, what entryhandling are you using here to test?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      whatever, the poit is the use of BarsSinceExit

      if (CrossAbove(SMA(10), SMA(20), 1)
      EnterLong("SMA Cross Entry");

      Comment


        #4
        fercho, sorry I don't follow you - if the entryHandling would not fit the order would for example just get ignored, so this is important point. To see in more detail, please run the strategy with TraceOrders enabled :

        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        192 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,234 views
        0 likes
        Last Post xiinteractive  
        Working...
        X