Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

keltner and price cross

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

    keltner and price cross

    i'm trying to make a strategy using keltner channel and price. i'm trying to say if the simple moving average low ten is less than the keltner channel middle two twenty one bar ago, and price is greater than the simple moving average low ten and less than keltner channel middle two twenty one bar ago, but price needed to be less than simple moving average low ten three bars ago. enter long. can i get what that might look like?

    if sma(Low,10) < keltner channel middle (parameters are 2,20),1) && price > sma(Low,10),3) && price < keltner channel (parameters 2,20) && price < sma(Low,10),3)
    //enter Long

    and i have for the stop loss, if price drops below the simple moving average low ten. can i get what that might look like?

    stop loss

    if price < sma(Low,10),1)

    #2
    Hello SteveReiza,

    I highly recommend using the Strategy Builder to create the logic, and the click View Code to see the code that this produces.

    Below is a link to a forum post with helpful resources on getting started with C# and NinjaScript. Be sure to watch the 'Automate Your Trading with NinjaTrader's Strategy Builder' training video.


    The code would appear as:
    Code:
    if (SMA(Low, 10)[0] < KeltnerChannel(2, 20).Midline[0] && Close[0] < KeltnerChannel(2, 20).Midline[0] && Close[0] < SMA(Low, 10[3])
    
    if (Close[0] < SMA(Low, 10)[1])
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      if (SMA(Low, 10)[0] < KeltnerChannel(2, 20).Midline[0] && Close[0] < KeltnerChannel(2, 20).Midline[0] && Close[0] > SMA(Low, 10[0])

      if (Close[3] < SMA(Low, 10)[3])​


      sweet, i adjusted a couple things. i think its right on the money. i can take this to a vendor now. many thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      50 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X