Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Something Simple

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

    Something Simple

    I have been trying to code a fairly simple statement. However, today does not seem to be my day. Here is what I am trying to do.

    If the entry bar closes as a doji then exit trade.

    Can someone please tell the synatax. For the life of me I am not getting it. It is probably something simple I missed.

    #2
    Hi suburban,

    Have you tried the Strategy Wizard? You can use the Wizard to automatically generate you the code.

    The syntax would be something like this:
    Code:
    if (CandleStickPattern(ChartPattern.Doji, 4).PatternFound[0] == 1)
    {
        ExitLong(DefaultQuantity, "");
    }
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      That's It

      Thanks Josh! That worked. So, if I wanted to close the trade when this triggered at my entry price plus one tick. I would state:

      ExitLongLimit(Open[0] + 1 * TickSize)


      Would that be correct?

      TIA for your help.

      Comment


        #4
        Yup. That should work out for you.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        127 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        85 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        86 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X