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

Strategy Builder Question

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

    Strategy Builder Question

    I have generated this
    1. Can you please tell me what does this line does - CrossoverDetected = false;
    2. Is (Position.MarketPosition == MarketPosition.Flat)) better to be part of entry logic? I have several strategies inside one strategy. I keep (Position.MarketPosition == MarketPosition.Flat)) as part of time filter. Is it better to keep it inside entry or it can be declared once inside time filter. Whats general rule? Thank you


    if ((CrossoverDetected == true)
    && ((CrossoverBar[5] - (CurrentBars[0])) == -5)
    // barspresent
    && ((BarsSinceExitExecution(0, "", 0) > 2)
    || (BarsSinceExitExecution(0, "", 0) == -1))
    && (Position.MarketPosition == MarketPosition.Flat))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    CrossoverDetected = false;
    }​

    #2
    Hi Boris, I moved your question into a new topic. The CrossoverDetected look like its a variable that you created in the builder, and by the looks of how it is being used, you are using this to prevent this cross condition from occurring more than once per bar. Checking the market position has nothing to do with a time filter, so it can be used outside of a time filter condition. It is used to check if the strategy position is flat.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    5 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    12 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,982 views
    3 likes
    Last Post jhudas88  
    Working...
    X