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 DJ888, Today, 10:57 PM
    0 responses
    2 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, Today, 09:29 PM
    0 responses
    7 views
    0 likes
    Last Post Belfortbucks  
    Started by zstheorist, Today, 07:52 PM
    0 responses
    7 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    151 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Working...
    X