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?

    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 :

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        118 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        166 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        85 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        130 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        88 views
        0 likes
        Last Post PaulMohn  
        Working...
        X