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