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

    Scripts will work on both real time and historical data without any extra code. The line you put in specifically excludes historical processing.

    if (Historical)
    return; // This is used if you want real time only processing.

    I would just remove that and see if it works any better.
    Ryan M.NinjaTrader Customer Service

    Comment


      Hi Ryan

      Thanks for your quick response. I removed the suggested code (Historical) and market replayed the revised script. Not plotting text/diamonds anymore. Not sure why. I added it back and it's working again. Please give me some tips on how to have the historical diamonds stayed on the chart and not replaced by the current ones. Thank you.

      Note: Aqua/Orange diamonds will be plotted when the lower TF conditions are met.

      Comment


        belecona,

        Make sure you are using unique strings in order for these DrawDiamond objects to plotted when the historical conditions are true as well as the real time. You can do this by adding " + CurrentBar" to your object string.

        DrawDiamond("longdiamond" + CurrentBar,true,0,Low[0]-8*TickSize,Color.Aqua);

        DrawDiamond("shortdiamond" + CurrentBar,true,0,High[0]+8*TickSize,Color.OrangeRed);
        Last edited by NinjaTrader_Matthew; 07-20-2011, 06:56 AM.
        MatthewNinjaTrader Product Management

        Comment


          Hi Matthew

          I added CurrentBar to my script and market replayed it. Both higher time frame text and lower time frame diamonds did not work anymore. I ran the original script as follows so that you can see the diamonds' disappearing:

          World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


          Please help. Thank you.

          Comment


            Note the corrected lines below, which have the quotes only on the name so you're using our CurrentBar (bar index) and not a literal "CurrentBar"

            DrawDiamond("longdiamond" + CurrentBar,true,0,Low[0]-8*TickSize,Color.Aqua);

            DrawDiamond("shortdiamond" + CurrentBar",true,0,High[0]+8*TickSize,Color.OrangeRed);
            Ryan M.NinjaTrader Customer Service

            Comment


              Hi Ryan

              I am running the revised script real-time. Higher time frame text label is back. Not sure about the diamonds yet. I will knock knock when I require more help. My trillion thanks to you and Matthew. Night-night.

              Comment


                Good afternoon

                I removed Historical and added CurrentBar to the script. It's plotting both text label and diamond alert on the lower time frame chart. Thank you.

                Based on the following screenshot, I wonder why double diamonds:

                World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


                PLUS the script has not been checking the entry conditions of the higher time frame first. Please help reviewing my script (Post #255) and confirm I did have the codes in good order. Thank you very much.

                Comment


                  Nothing sticks out from a quick review of your code. Sorry, no specific advice here except to simplify and debug your indicator. If code-based drawing is new, focus on that first with simple conditions until you understand the mechanics. Once you have a good grasp work on integrating what you've learned into a multiseries script.
                  Last edited by NinjaTrader_RyanM1; 07-22-2011, 09:01 AM.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    Great tips Ryan. Thank you.

                    I am going to take a break from indy development for some weeks. Will work on a book instead. Then start again with some baby steps on my MTF creation. Continue enjoying your day Ryan. I am always grateful for your prompt response.

                    Comment


                      OK, Good luck and thanks for your contribution on these forums. Hope to see you knocking again in the future.
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        .. knock .. knock ..

                        Good morning

                        Cannot stay away lol ..

                        Need to pick your brains please on the following:

                        1. A trading friend alerted me that I should consider replacing my condition A with his B (using Abs). What's the benefits of using B?

                        Condition A: SMA(7)[0]-SMA(3)[0]<=2*TickSize

                        Condition B: Math.Abs(SMA(7)[0]-SMA(3)[0])<=2*TickSize

                        2. Order of Conditions

                        This question has been haunting me for some months. Now I am going to ask (even it could be a stupid question):

                        if (Condition 1 && Condition 2 && Condition 3)
                        Do something

                        Will the system check Condition 1 first, then Condition 2, and lastly Condition 3? Or it will consider all three conditions at the same time and ignoring their order?

                        Thank you! Have a great day.

                        Comment


                          Hi belecona, Ryan is off for day so I'll respond.

                          The Math.Abs() function returns the absolute value of a number.
                          Code:
                          Math.Abs(2); // would return 2
                          Math.Abs(-2); // also would return 2
                          It looks like the modification would mean that the condition would return true if the two MAs were within a certain distance of each other (direction doesn't matter). Condition A would return true only if SMA(7) is two or more ticks greater than SMA(3) (direction does matter).

                          As for the order of conditions in your example, they would all be evaluated at the same time. If one of the conditions wasn't true, the entire statement would evaluate to false and thus not execute.
                          AustinNinjaTrader Customer Service

                          Comment


                            Thanks Austin for your prompt response. No more myth now .. haha

                            Comment


                              Good morning

                              Tried to start fresh again on my indicator/strategy development. Based on the following NT reference samples:

                              SampleBoolSeries Strategy
                              SampleBoolSeries Indicator

                              If my indicator (with bearIndication and bullIndication) is called ABCBoolSeries, should I change the strategy codes to

                              protected override void OnBarUpdate()
                              {
                              if (ABCBoolSeries().BullIndication[0])
                              EnterLong();

                              if (ABCBoolSeries().BearIndication[0])
                              EnterShort();
                              }

                              I got the following error message when I compiled the strategy:

                              'NinjaTrader.Indicator.ABCBoolSeries' is a 'type' but is used like a 'variable'.

                              Please help. Thank you.

                              Comment


                                The syntax looks good and is the same as used in the sample. Can you post the indicator file you're using here? You can save a copy of it and take out any proprietary conditions. Will use it to see how it should be referenced from a strategy.
                                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