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 pechtri, 06-22-2023, 02:31 AM
        10 responses
        124 views
        0 likes
        Last Post Leeroy_Jenkins  
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Yesterday, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Yesterday, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Yesterday, 03:01 PM
        2 responses
        22 views
        0 likes
        Last Post helpwanted  
        Working...
        X