Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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?
    BertrandNinjaTrader Customer Service

    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 kujista, Today, 05:44 AM
        0 responses
        3 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        5 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        8 views
        0 likes
        Last Post adeelshahzad  
        Working...
        X