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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    168 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    324 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    250 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    351 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    180 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X