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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    148 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    84 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    129 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    125 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    102 views
    0 likes
    Last Post CarlTrading  
    Working...
    X