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 argusthome, 03-08-2026, 10:06 AM
        0 responses
        88 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        48 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        31 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        34 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        68 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X