Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Execution

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

    #16
    This script looks properly made to take only the first trade, however I wasn't able to find a chart that satisfied the other conditions.

    What instrument, period, and days loaded are you using?
    LanceNinjaTrader Customer Service

    Comment


      #17
      One day time Period bar, and 365 days loaded data.

      Comment


        #18
        I didn't know what instrument so I used daily bars for the ES 12-13 contract and did see
        Condition is Satisfied get printed to the output window just once. When I removed the boolean it printed three times.

        Does your output window not print this message? If not what instrument are you using?

        Also note, no trades were generated because limit orders will expire at the end of the next bar if not filled.
        LanceNinjaTrader Customer Service

        Comment


          #19
          Hi Lance,

          Thanks a lot for your help and your efforts. I dont know why its not working in my PC. And instead of that I want to write the code for multi time frame strategy.

          I would like to enter a position based on a 1-minute chart, but only if conditions on a One-day time frame chart are met.
          In this strategy I am not understanding where to place the BarsInProgress==0 and BarsInProgress==1 . Even I have read the help guide. So please can you edit in the strategy. Then I will get the total exposure. Please see the code and edit it.

          protected override void Initialize()
          {
          CalculateOnBarClose = true;

          Add(PeriodType.Day, 1);

          SetProfitTarget("", CalculationMode.Percent, 0.01);

          SetStopLoss("", CalculationMode.Percent, 0.01, false);

          }

          protected override void OnBarUpdate()
          {

          if ( Close[0] > Closes[1][0] * (1 + 0.0025) && CrossAbove(RSI(BarsArray[1], 10, 3), 30, 1))
          {

          EnterLongLimit(100, GetCurrentBid(), "");

          }
          }

          Thanks
          Imran.

          Comment


            #20
            You could insert this at the start of your OnBarUpdate()

            if(BarsInProgress != 0)
            return;

            If you're interested in more in depth learning on NinjaScript we also offer premium education classes here: http://www.ninjatrader.com/PremiumEducation.php

            Let me know if I can further assist.
            LanceNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            649 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            576 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X