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 fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,403 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        94 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        6 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        158 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X