Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

look back crossover

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

    look back crossover

    Think I'm missing the genius of this ,, from my test the lookback doesn't do much since if the lookback is set to 1 or 1000,, the first bar crossing the EMA fires this..
    what am i missing?
    This looks more like " or "of the lookback bars instead of "and" of the lookback bars

    if (CrossAbove(EMA(10), EMA(20), 1))
    EnterLong();
    Last edited by gg80108; 06-21-2010, 05:21 PM.

    #2
    gg80108, with the lookback parameter you specifiy over which range of bars the cross can be detected - a lookback of 10 for example means the cross had to happen within the last 10 bars.

    What condition are you trying to create?

    Comment


      #3
      I want to filter out whip saws, where a cross occurs and the next bar crossed back, I dont want to take any action until the the next bar after the cross..

      Comment


        #4
        Hello gg80108,

        You'd have to code for the sequence you're after. You can do this with user variables or bool flags. The reference sample below offers a sample implementation on user variables to look for a specific sequence.



        PseudoCode below with bool flags:

        if (CrossAbove)
        FirstCross = true;

        if (FirstCross && !CrossBelow)
        placeYourTrades;
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X