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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        51 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        31 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        99 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        177 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        170 views
        0 likes
        Last Post CarlTrading  
        Working...
        X