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

CROSSOVER questions

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

    CROSSOVER questions

    hello,

    I am not getting consistent behavior with the cross method. Explanation follows.

    I need to generate a signal when price crosses the upper regression channel. my code looks like this:

    Code:
    double shortLine = RegressionChannel(50, 3.5).Upper[0];
                
    if (CrossAbove(High, shortLine, 1)) 
    {
        ShortSignal.Set(shortLine);    
    }
    This code works quite well most of the time. It appears that there are situations where it doesn't. Around the news is one situation. A fast moving market seems to be the case in which the line that sets the "ShortSignal" plot doesn't get called.

    Are there cases you can think of that the CrossAbove will return false even though price does "cross" the channel?

    In order for the cross to return true, does price need to be greater than the channel or is it enough for it to be equal?

    On a gap, will the CrossAbove return true or does price need to run through the channel for it to return true?

    I have the CalculateOnBarClose set to false. Does it make a difference if I am using the High or the Close in order to determine a cross over?

    In the call to CrossAbove, the "1" value means that the high of the previous bar has to be lower than the channel and the high of the current bar needs to be higher than the upper channel - right?

    Since the regression channel 1 bar back is moving, could it be that this is what is messing things up for me?


    Hope all this makes sense.
    Onn

    #2
    Hi Onn, so the issue is in realtime trading / Market Replay only for the generated signals? Here you could be seeing whipsaw trades with CalculateOnBarClose = false and the Regression Channel as it would always provide a best fit estimate it would recalculate with new intrabar info received, thus triggering potentially orders intrabar that would not persist until the close of the bar.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by geddyisodin, 04-25-2024, 05:20 AM
    8 responses
    60 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    4 responses
    3,285 views
    1 like
    Last Post jgualdronc  
    Started by Option Whisperer, Today, 09:55 AM
    0 responses
    5 views
    0 likes
    Last Post Option Whisperer  
    Started by halgo_boulder, 04-20-2024, 08:44 AM
    2 responses
    22 views
    0 likes
    Last Post halgo_boulder  
    Started by mishhh, 05-25-2010, 08:54 AM
    19 responses
    6,189 views
    0 likes
    Last Post rene69851  
    Working...
    X