Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy Builder help

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

    Strategy Builder help

    I have a TopDog Visualize Trader indicator and I have been attempting to create a strategy using this indicator and its bullish and bearish flags. Unfortunately even in what I consider its simplest form I cannot get the 'strategy' to trigger a trade. Per conversations with TopDog the triggers are in the Plot 'Signal' = (Bearish or Bullish) as seen in the attached file -23. Click image for larger version

Name:	2020-07-29_12-59-23.png
Views:	453
Size:	179.5 KB
ID:	1111977

    Here is the syntax created by the above strategy condition. Click image for larger version

Name:	2020-07-29_13-02-47.png
Views:	409
Size:	285.9 KB
ID:	1111978

    Unfortunately the conditions trigger no trades. I have discussed this at length with TopDog but they have not been able to advise me. They have recommended I reach out to Ninjatrader "since it is their platform". UGH!

    In market analyzer the triggers are different and work fine. The trigger is to set a value of 1 or -1 in the conditions of the instrument as shown here. Click image for larger version

Name:	2020-07-29_13-08-52.png
Views:	428
Size:	33.4 KB
ID:	1111979

    Any thoughts on how I can get the Bullish/Bearish flags to trigger trades?

    Dolfan

    #2
    Hello Dolfan,

    Thanks for your post.

    I would suggest that you check for the value to be +1 or -1 of the same plot as you have set in the market analyzer.

    In a set, in the condition builder of the strategy builder, on the left would be the 3rd party indicator with the same plot as what you are using in the market analyzer selected as the "Value plot". In the center select "equal". On the right side select Misc>numeric value and set the value to 1 or -1 depending on the direction you are looking for.


    Last edited by NinjaTrader_PaulH; 07-29-2020, 12:24 PM. Reason: Added clarification text
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul. Sounds like this should work but still, no trades triggered.

      Dolfan

      Comment


        #4
        Hello Dolfan,

        Thanks for your reply.

        Please post a screenshot of the condition builder/set that checks for the +1 or the -1 and places an entry order and make sure to show the selection you made for "value" plot.

        Thanks in advance.


        Paul H.NinjaTrader Customer Service

        Comment


          #5
          I hope this is what you are looking for Paul. I would post the code if I could see it but it is not in the Ninjatrader indicator list for editing.
          Click image for larger version

Name:	2020-07-29_14-36-22.png
Views:	423
Size:	108.8 KB
ID:	1112019
          Dolfan

          Comment


            #6
            Hello Dolfan,

            Thanks for your reply.

            I would suggest that you print out the value of "signals" on a bar by bar basis. Basically in a single set you would use no conditions and in the action section select Misc>Print and then construct the message to print which will include the time of the bar Time[0] and the value of the plot. Here is a short video on how to construct a print statement in the strategy builder: https://paul-ninjatrader.tinytake.co...NV8xMDk5MDc5Nw This is just an example and again we need to see what the value of the plot "signals" is.

            The idea here is to see that we do get a +1 -1 or 0 for the value and then see if you can relate that to the on chart signals.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Paul,

              You video looks clear and I believe I have copied what you have done through step #3 but I get this error in the output window. Click image for larger version

Name:	2020-07-30_9-46-10.png
Views:	393
Size:	19.1 KB
ID:	1112138

              Your thoughts?

              Dolfan

              Comment


                #8
                Hello Dolfan,

                Thanks for your reply.

                Please open the strategy in the strategy builder and at the bottom click on "view code". If possible take a screenshot or two so I can see the whole code from the line that starts with "Public class " down to where it says "wizard settings, neither change nor remove" ( I don't need to see the code below that line).

                If you prefer to keep it confidential, you are welcome to write into PlatformSupport[at]NinjaTrader[dot]com. Mark the e-mail Atten Paul, ticket# 2675040 and include the screenshots along with a link to this thread for reference.


                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  How about a cut/paste? If you would prefer the pics I will go back and do that.

                  Dolfan


                  public class TopDog : Strategy
                  {
                  private bool TDVT;

                  private NinjaTrader.NinjaScript.Indicators.TopDogTrading.T opDogVisualizedTrader TopDogVisualizedTrader1;

                  protected override void OnStateChange()
                  {
                  if (State == State.SetDefaults)
                  {
                  Description = @"Enter the description for your new custom Strategy here.";
                  Name = "TopDog";
                  Calculate = Calculate.OnBarClose;
                  EntriesPerDirection = 1;
                  EntryHandling = EntryHandling.AllEntries;
                  IsExitOnSessionCloseStrategy = true;
                  ExitOnSessionCloseSeconds = 30;
                  IsFillLimitOnTouch = true;
                  MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
                  OrderFillResolution = OrderFillResolution.Standard;
                  Slippage = 0;
                  StartBehavior = StartBehavior.ImmediatelySubmit;
                  TimeInForce = TimeInForce.Gtc;
                  TraceOrders = true;
                  RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
                  StopTargetHandling = StopTargetHandling.PerEntryExecution;
                  BarsRequiredToTrade = 20;
                  // Disable this property for performance gains in Strategy Analyzer optimizations
                  // See the Help Guide for additional information
                  IsInstantiatedOnEachOptimizationIteration = true;
                  TDVT = true;
                  }
                  else if (State == State.Configure)
                  {
                  AddDataSeries(Data.BarsPeriodType.Minute, 5);
                  AddDataSeries(Data.BarsPeriodType.Minute, 15);
                  AddDataSeries(Data.BarsPeriodType.Minute, 60);
                  AddDataSeries(Data.BarsPeriodType.Day, 1);
                  AddDataSeries(Data.BarsPeriodType.Minute, 1);
                  AddDataSeries(Data.BarsPeriodType.Range, 10);
                  AddDataSeries(Data.BarsPeriodType.Tick, 100);
                  AddDataSeries(Data.BarsPeriodType.Tick, 300);
                  AddDataSeries(Data.BarsPeriodType.Tick, 1000);
                  AddDataSeries(Data.BarsPeriodType.Tick, 3000);
                  }
                  else if (State == State.DataLoaded)
                  {
                  TopDogVisualizedTrader1 = TopDogVisualizedTrader(Close, NinjaTrader.Data.PriceType.Close, BarCount_RangeType2.SMA, BarCount_RangeType2.EMA, BarCount_RangeType2.SMA, TablePosition.TopLeft);
                  TopDogVisualizedTrader1.Plots[0].Brush = Brushes.Gray;
                  TopDogVisualizedTrader1.Plots[1].Brush = Brushes.Green;
                  TopDogVisualizedTrader1.Plots[2].Brush = Brushes.Red;
                  AddChartIndicator(TopDogVisualizedTrader1);
                  SetProfitTarget("", CalculationMode.Ticks, 20);
                  }
                  }

                  protected override void OnBarUpdate()
                  {
                  if (BarsInProgress != 0)
                  return;

                  if (CurrentBars[0] < 1)
                  return;

                  // Set 1
                  if (TopDogVisualizedTrader1.Signals[0] == 1)
                  {
                  EnterLong(Convert.ToInt32(DefaultQuantity), "");
                  }

                  // Set 2
                  if (TopDogVisualizedTrader1.Signals[0] == -1)
                  {
                  EnterShort(Convert.ToInt32(DefaultQuantity), "");
                  }

                  Print(@"Time/Date " + Convert.ToString(Times[0][0]) + @" bool TDVT = " + Convert.ToString(TDVT) + @" Signal = " + Convert.ToString(TopDogVisualizedTrader1.Signals[0]) + @" ");
                  }
                  }
                  }

                  #region Wizard settings, neither change nor remove

                  Comment


                    #10
                    Hello Dolfan,

                    Thanks for your reply.

                    That's perfectly fine to copy/paste, wasn't sure what was easier for you.

                    From a code perspective, I do not see anything outstanding.

                    Can you confirm that the strategy before adding the print statement did not produce that error and that the error only shows after you added the Print statement?

                    When you created the print statement and added the topdog indicator, did you use the same setting as those shown "Close, NinjaTrader.Data.PriceType.Close, BarCount_RangeType2.SMA, BarCount_RangeType2.EMA, BarCount_RangeType2.SMA, TablePosition.TopLeft);" If not please set them the same and try again.

                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Paul,

                      I have not changed the strategy at all other than adding the print statement. As far as I know I was not getting an error before because I did not have the print statement nor did I open an output window. The strategy is about as simple and if I may say, mindless as it gets. When the indicator paints a trade signal (triangles) on the chart as seen here in this example Click image for larger version

Name:	2020-07-30_11-23-33.png
Views:	397
Size:	3.6 KB
ID:	1112170 a trade should be entered. Nothing happens. No errors to report, nothing.

                      Dolfan

                      Comment


                        #12
                        Just an FYI Paul, I took out the print set and ran the strategy again with an output window open and the error does appear.

                        Dolfan

                        Comment


                          #13
                          Hello Dolfan,

                          Thanks for your reply.

                          I would suggest removing the print statement, recompiling the strategy, keeping the output window open, and apply the strategy. If you continue to get a similar error then I would suggest going back to the 3rd party vendor with that information and I would send them your strategy to test with.

                          In addition, you can advise them of our conversation here and if they would like some insight on debugging this issue they can write into PlatformSupport[at]NinjaTrader[dot]Com.

                          Paul H.NinjaTrader Customer Service

                          Comment


                            #14
                            Paul,

                            A quick look back and you will see that I have already done this. I tried to send a quick video but cannot upload .mp4 files this this forum. I believe I have exhausted my efforts with TopDog since they told me to contact Ninjatrader (see my initial message in this matter). I will send them this exchange and see if they come around.

                            Dolfan

                            Comment


                              #15
                              Hello Dolfan,

                              Thanks for your reply.

                              While I was creating my previous reply you are already replied so I was unaware.

                              The issue here is that I do not have access to the 3rd party indicator and it appears to be the source of the errors.

                              Again we are open to helping the 3rd party with debugging if that is something they wish to pursue.
                              Paul H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by frankthearm, Today, 09:08 AM
                              5 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              43 views
                              0 likes
                              Last Post jeronymite  
                              Started by yertle, Today, 08:38 AM
                              5 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by adeelshahzad, Today, 03:54 AM
                              3 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by bill2023, Yesterday, 08:51 AM
                              6 responses
                              27 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X