Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X