Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy sell signals

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

    #31
    Hi Brandon,

    Thank you for you reply. I still have the same issue.

    If i use a fixed tag name, I'm getting buy sell in the last bar or current bars, not on the historical bars based on the condition. Please check the
    sametag-issue.png screenshot attached.

    DrawArrowDown("mytag", true, 0, isBelow[0] + TickSize, Color.Blue);
    DrawArrowUp("mytag", true, 0, isAbove[0] - TickSize, Color.Orange);


    if i use unique tag with currentBar.toString(), I'm getting multiple arrow in all the bars. Please check the currentbar-issue.png screenshot attached

    DrawArrowDown(CurrentBar.ToString(), true, 0, isBelow[0] + TickSize, Color.Blue);
    DrawArrowUp(CurrentBar.ToString(), true, 0, isAbove[0] - TickSize, Color.Orange);


    attached the screen shot from trading view. I want to generte buy and sell signals and arrows based on the condition only. But I want to see those arrows in current and historical bars that are loaed in the chart. Please refer to sample-tv-buy-sell.png attached.

    I want the indicator to generate Buy, sell signal, give the closing price at the time of alert and display up/down arrows in the chart.

    Thankyou,
    Murali
    Attached Files

    Comment


      #32
      Hello Murali,

      The arrows are being drawn on every bar the condition is true.
      What condition are the DrawArrowDown/Up methods being called?

      Check the condition with prints to understand why this is true on each bar.
      Print the time of the bar and all values used in the condition (please include labels).

      Below is a link to a forum post that demonstrates using Print() to understand behavior.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #33
        Yes, I'm able to print, but the draw arrow is not working as expected, arrows display either in all candles or last candle

        Bar date - SELL
        12/23/2021 12:15:00 AM
        Last Close Pirce - 4689.5
        Bar Date - BUY -
        12/23/2021 1:00:00 AM
        Last Close Pirce - 4690.75
        Bar date - SELL
        12/23/2021 1:30:00 AM
        Last Close Pirce - 4689.75
        Bar Date - BUY -
        12/23/2021 1:45:00 AM
        Last Close Pirce - 4691.5
        Bar date - SELL
        12/23/2021 2:15:00 AM
        Last Close Pirce - 4688.75
        Bar Date - BUY -
        12/23/2021 3:00:00 AM
        Last Close Pirce - 4694.5
        Bar date - SELL
        12/23/2021 6:30:00 AM
        Last Close Pirce - 4699.25
        Bar Date - BUY -
        12/23/2021 6:45:00 AM
        Last Close Pirce - 4701
        Bar date - SELL
        12/23/2021 7:15:00 AM
        Last Close Pirce - 4700
        Bar Date - BUY -
        12/23/2021 8:45:00 AM
        Last Close Pirce - 4711.5
        Bar date - SELL
        12/23/2021 11:15:00 AM
        Last Close Pirce - 4720.5
        Bar Date - BUY -
        12/23/2021 12:30:00 PM
        Last Close Pirce - 4722
        Bar date - SELL
        12/23/2021 2:30:00 PM
        Last Close Pirce - 4724
        Bar Date - BUY -
        12/23/2021 2:45:00 PM
        Last Close Pirce - 4726.25
        Bar date - SELL
        12/23/2021 3:00:00 PM
        Last Close Pirce - 4715.25

        Comment


          #34
          Hello radhmu978,

          What is the condition that the method is called in?

          This output is not showing what is being compared.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #35
            Based on price action and moving average cross over, i set 2 boolean conditions to go LONG or SHORT. when that condition is met, I try to plot the arrow. exposedVariable is nothing but Close[0] that i print in data window. I'm planning to pass this exposedVariable to strategy for placing market or limit orders.

            if (long_final == 1)
            {
            DrawArrowUp("mytag1", true, 0, Low[0] - (TickSize), Color.Green);
            //Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Go Long", "Alert1.wav", 10, Color.Black, Color.Green);
            bullIndication.Set(true);
            bearIndication.Set(false);
            Print("BUY" );
            Print(Time[0].ToString());
            //Print("long final condition - = " + long_final);
            Print(exposedVariable);

            }

            if (short_final == -1)
            {
            DrawArrowDown("mytag1", true, 0, High[0], Color.Red);
            //Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Go Short", "Alert2.wav", 10, Color.Black, Color.Red);
            bullIndication.Set(false);
            bearIndication.Set(true);
            Print("SELL" );
            Print(Time[0].ToString());
            //Print("short final condition - = " + short_final);
            Print(exposedVariable);
            }

            Comment


              #36
              Hello radhmu978,

              If the condition is if (long_final == 1), print the time of the bar and long_final to the output window. See if this is 1 on every bar.
              Print(string.Format("{0} | long_final: {1} == 1", Time[0], long_final));

              If you want multiple objects they will have to have to have unique tag names. Reusing the same tag name will update the existing object, and if barsAgo is 0, it will move it to the last bar.

              "mytag1" + CurrentBar.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #37
                Thank you Chelsea , it is working now with "mytag1" + CurrentBar. Appreciate your help.

                May i know how to pass this boll values to strategy, it is not a indicator comparison or crossover. output from my indicator is buy, sell and close[0] at the time of alert condition. not sure how to extrach this ?

                I'm trying to build a scalping strategy with reverse trading, i'm backteing this in trading view, trying to implement the same in ninjatrading platform. Please give me some pointer to help guide.

                strategy.entry("Long", strategy.long, 1, when= long_final)
                strategy.close("Long", when = short_final)
                strategy.entry("Short", strategy.short, 1, when= short_final)
                strategy.close("Long", when = long_final)

                Comment


                  #38
                  Hi Chelsea ,

                  one more help with drawtext, my arrows goes away and no text displayed when i add DrawText

                  if (long_final == 1)
                  {
                  DrawArrowUp("mytag1"+CurrentBar, true, 0, Low[0] - (TickSize), Color.Green);
                  DrawText("mytag1"+CurrentBar, "BUY", 10, 1000, Color.Green);
                  //Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Go Long", "Alert1.wav", 10, Color.Black, Color.Green);
                  bullIndication.Set(true);
                  bearIndication.Set(false);
                  Print("BUY" );
                  Print(Time[0].ToString());
                  //Print("long final condition - = " + long_final);
                  Print(exposedVariable);

                  }

                  if (short_final == -1)
                  {
                  DrawArrowDown("mytag1"+CurrentBar, true, 0, High[0], Color.Red);
                  DrawText("mytag1"+CurrentBar, "BUY", 10, 1000, Color.Red);
                  //Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Go Short", "Alert2.wav", 10, Color.Black, Color.Red);
                  bullIndication.Set(false);
                  bearIndication.Set(true);
                  Print("SELL" );
                  Print(Time[0].ToString());
                  //Print("short final condition - = " + short_final);
                  Print(exposedVariable);
                  }

                  Comment


                    #39
                    Hello radhmu978,

                    Does it have a different tag name as directed in post# 36?
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #40
                      Even with different tag name, I see the same issue
                      DrawArrowUp("mytag1"+CurrentBar, true, 0, Low[0] - (TickSize), Color.Green);
                      DrawText("tag1"+CurrentBar, "BUY", 10, 1000, Color.Green);

                      DrawArrowDown("mytag1"+CurrentBar, true, 0, High[0], Color.Red);
                      DrawText("tag1"+CurrentBar, "SELL", 10, 1000, Color.Red);

                      Comment


                        #41
                        Hello radhmu978,

                        To confirm if you comment out the DrawText() the arrow shows, and if you uncomment the DrawText() the arrow does not show?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #42
                          yes, that is correct, commenting the drawtext, I'm able to see arrows. Moment i add Drawtext, arrow vanish.

                          Comment


                            #43
                            Hello radhmu978,

                            May I test the script?

                            To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
                            1. Click Tools -> Export -> NinjaScript...
                            2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
                            3. Click the 'Export' button
                            4. Enter a unique name for the file in the value for 'File name:'
                            5. Choose a save location -> click Save
                            6. Click OK to clear the export location message
                            By default your exported file will be in the following location:
                            • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
                            Below is a link to the help guide on Exporting NinjaScripts.
                            http://ninjatrader.com/support/helpG...-us/export.htm

                            Once exported, please attach the file as an attachment to your reply.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #44
                              instead of putting it in public forum, shall i send it over email to platform support?

                              Comment


                                #45
                                Hello radhmu978,

                                Make a test script with only this condition, print for the condition, action, and print in the action block. Do not include any other logic.
                                Chelsea B.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                563 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                329 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                101 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                547 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                548 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X