Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

code question

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

    code question

    I would like to enter a buy limit order if there is a pullback of the price to a SMA of 12 periods, the buy limit order would be if the price touches that SMA (12).
    I would have "calculate on bar close set to false"

    How could I code that? It is correct this idea:

    If (Low[0] == SMA(12)[0])

    EnterLongLimit....}

    Thanks

    Sincerely

    #2
    dvercher,

    You could use something like :

    if ( CrossAbove(Low,SMA(12),1) )
    {
    EnterLongLimit....
    }

    Or if you are trying to get "close" to the SMA,

    if ( Math.Abs(Low[0] - SMA(12)[0] ) < Constant*TickSize)
    {
    EnterLongLimit....
    }
    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    646 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    367 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X