Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where to start if I want to create a strategy on a trading set-up?

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

    Where to start if I want to create a strategy on a trading set-up?

    I have a very good trading system, ie when the indicators align one should enter a trade. Human eyes are slower than the signal and I am thinking of making it an auto trade strategy.

    I am not a technical person and would appreciate any assistance in directing me to the right start. If it's not feasible, at least I will save some hours on a fruitless venture.

    Please help. My trillion thanks in advance.

    #2
    belecona, please see this page for a brief overview of the process and some links to the programming tutorials.
    AustinNinjaTrader Customer Service

    Comment


      #3
      My belated thanks Austin. I will go through the suggested link.

      Comment


        #4
        I'm unable to have an early exit condition (Line 74 to Line 90) triggered even F5 gave me a Compile Successful message. Not sure if the SetStopLoss on Line 50 matters.

        What I'm trying to do:

        1. An initial 15 ticks stoploss.

        2. When the trade is working, say 8 ticks from the entry price, I would like to have stoploss at entry+4 ticks (replace the earlier 15-tick one).

        Please help! Thank you.
        Attached Files

        Comment


          #5
          Hello Belecona,

          Would you post the code text you're working with rather than an image?

          One thing to evaluate is the previousPrice variable is what you expect.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Text Code

            Here it comes Ryan. Please help! Thank you.

            Also have the strategy in the enclosed text file.




            // Move the SL to a more favorite position when the trade starts working
            if (Position.MarketPosition == MarketPosition.Long)
            {
            if (Close[0] == Position.AvgPrice + (8 * TickSize) && previousPrice == 0)
            {
            SetStopLoss(
            "", CalculationMode.Price, Close[0] + (4 * TickSize), false);
            previousPrice = Position.AvgPrice;
            }
            }

            if (Position.MarketPosition == MarketPosition.Short)
            {
            if (Close[0] == Position.AvgPrice - (8 * TickSize) && previousPrice == 0)
            {
            SetStopLoss(
            "", CalculationMode.Price, Close[0] - (4 * TickSize), false);
            previousPrice = Position.AvgPrice;
            }
            }
            Attached Files

            Comment


              #7
              Hello Belecona,

              One thing I see is this on your long entry:

              SetStopLoss("", CalculationMode.Price, Close[0] + (4 * TickSize), false);


              You're setting the Stop Loss 4 ticks above the current market price. This is not allowed. Maybe switch to 4 ticks below current market price? Switch around your SetStopLoss statements for long and short.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Hi Ryan

                What I am trying to do is when the trade is moving 8 ticks to my favor, set stoploss to my entry price + or - 4 ticks for long and short trades respectively. The stoploss will not be above the current market price. Please help. Thank you.

                Here it comes my script text again:


                // Move the SL to a more favorite position when the trade starts working
                if (Position.MarketPosition == MarketPosition.Long)
                {
                if (Close[0] == Position.AvgPrice + (8 * TickSize) && previousPrice == 0)
                {
                SetStopLoss("", CalculationMode.Price, Close[0] + (4 * TickSize), false);
                previousPrice = Position.AvgPrice;
                }
                }

                if (Position.MarketPosition == MarketPosition.Short)
                {
                if (Close[0] == Position.AvgPrice - (8 * TickSize) && previousPrice == 0)
                {
                SetStopLoss("", CalculationMode.Price, Close[0] - (4 * TickSize), false);
                previousPrice = Position.AvgPrice;
                }
                }

                Comment


                  #9
                  Hello Belacona,

                  If you specify your stop price as (Close[0] + anyValue), then your order is placed above the current market price.

                  What mesages are you seeing in the log tab of the control center for your strategy?
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Ryan. How can I find a way to get around it? How about a trail stop? I tried and it's not triggered too .. sigh .. Will keep exploring.

                    Another quick question please. What's the difference between the following 2 Long entry instructions:

                    1. EnterLong()
                    2. EnterLongLimit(DefaultQuantity, Open[0], "")

                    First I thought Item 1. will ask the system to go long at open when long signal get triggered - same as Item 2. However, the backtest results told me otherwise, ie Item 1. has a gross profit 9 times more than Item 2.?! Would appreciate your educating the difference.

                    I am very sorry for asking simple questions as I'm new to strategy development. My strategy looks good (backtest results I meant) except I need to enhance the entry point (to avoid substantial slippage) + adding a condition to protect the ticks gained. Not sure how to do both yet. Any comments are greatly appreciated. Thank you.

                    Comment


                      #11
                      Hello Belecona,

                      If you switch the - and + signs on your SetStopLoss statements, it might work the way you expect.


                      For Backtesting:
                      1. Enters a market long order at the open of the next bar following signal bar.

                      2. Enters a long limit order. Limit price is the open of the signal bar.
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        Thanks Ryan. Your swift response has made my day. I will knock at your door again after reviewing/revising my strategies. Thank you!

                        Comment


                          #13
                          Belecona,

                          Glad to help. Thanks for the feedback.
                          Ryan M.NinjaTrader Customer Service

                          Comment


                            #14
                            Good morning Ryan

                            Need to pick your brains again. I tried the CrossAbove/CrossBelow between 2 indicators to trigger an entry. When I checked the chart, I notice upon completion of the first trade, the system continued entering into more trades as long as Indicator 1. was above or below Indicator 2! That's not what I want.

                            I want only trades when CrossAbove or CrossBelow happens (not just above or below). Please help! Thank you.

                            Have a Nice day.

                            Comment


                              #15
                              Hi Belacona,

                              CrossAbove and CrossBelow should only be true if there was a crossing event. Maybe your "lookback period" is set to look for cross events over many bars.
                              Ryan M.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              651 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
                              577 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X