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 Running - Possible to display manual trades?

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

    Strategy Running - Possible to display manual trades?

    Hi all,

    I have a strategy running. It is WIP and so far functions more like an indicator, i.e. shows me certain things but does not place orders yet. While I am running my strategy/indicator I am trading manually, but those trades do not show up in the chart. They only show when I disable the strategy. Is there a way to have my manually trades shown?

    Thank you. P


    #2
    Hello pennywise,

    Thanks for your post.

    When a strategy is added to a chart and enabled, the chart will display the execution and trade markers made by that strategy. Executions markers for manual trades and trades made outside of the strategy are hidden.

    You have some options:

    1. Move the code to an indicator so the markers are not hidden by the strategy.
    2. Create a new chart that does not have the strategy enabled to see the markers on that chart
    3. Add the strategy in the Strategies tab of the Control Center so it is not attached to a chart.

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thank you, Jim, I was afraid you would tell me that. I will try to create an indicator, the other options are not practical for me.

      If you have a moment, would you mind guiding me to an introduction video for indicators that may contain advice on how to do this?

      Comment


        #4
        Hello pennywise,

        There isn't a video I could link, but to elaborate on #1, this would involve implementing the code from your strategy in an indicator. Strategies and Indicators work very much the same, expect that strategies add functionality to place trades. If you have a strategy that simply places drawings on a chart, you could implement that same code in an indicator.

        If this is a strategy that you built with the Strategy Builder, then you could consider reviewing the NinjaScript Editor video to get more acquainted with unlocked code. The video below for NinjaScript Editor 401 is publicly available.

        NinjaScript Editor 401 - https://www.youtube.com/watch?v=BA0W4ECyVdc

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thanks Jim, I think I got it to work (and no, my code was not locked anymore).

          But I have an unexpected issue right now:

          My indicator draws dots into the chart. But when I start the indicator it shows an empty panel below the chart, as if it tried to display something but has not data...

          Interesting is that my indicator used to contain code that would draw a line in a second panel below the chart, but since I got error messages when compiling, I commented these lines out. The code left does not try to plot anything, I checked multiple times. Do you have an idea of what I am doing wrong?

          The lines my indicator was attempting to plot before uses code like the below and the error message came for "AddChartIndicator" (all this worked perfectly fine in the strategy):

          Avg_Volume = SMA(Volume, Convert.ToInt32(AveragePeriod));
          Avg_Volume.Plots[0].Brush = Brushes.Blue;
          Avg_Volume.Panel = 2;
          AddChartIndicator(Avg_Volume);

          Comment


            #6
            Hello pennywise,

            Thanks for your question.

            Indicators can plot to the panel they own, or the price panel. This is controlled with the IsOverlay property set in State.SetDefaults. If this is false, then the indicator will add a new panel, and the indicator plots will reside on that panel. If this is true, the indicator will plot in the price panel.

            AddChartIndicator does not exist in the context of an indicator. To show another indicator's plots in your hosting indicator, you will want to add plots in the hosting indicator and then assign the hosting indicator's plot values with the data from your hosted indicator. See AddPlot for examples on adding plots and assigning values.

            AddPlot - https://ninjatrader.com/support/help...8/?addplot.htm

            Please let me know if you have any questions.
            JimNinjaTrader Customer Service

            Comment


              #7
              Thank you Sir, making little progress every day.

              Question remaining is if I can
              - add one plot A that appears in the price panel (say my own moving average) -- i.e. IsOverlay = True and also
              - another plot B that appears in a separate panel below the chart (say my own volume) -- i.e. IsOverlay = False

              As I am defining this in OnStateChange() I fear I cannot do that, right?

              Comment


                #8
                Hello pennywise,

                Indicators can only plot to one panel. If you want to plot to both the price panel and the indicator panel, you will need two indicators or have the indicators added by a strategy.

                As we discussed, if you add the indicators from a strategy, then the strategy will hide the execution markers on your chart.

                Let us know if you have any additional questions.
                JimNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by judysamnt7, 03-13-2023, 09:11 AM
                4 responses
                57 views
                0 likes
                Last Post DynamicTest  
                Started by ScottWalsh, Today, 06:52 PM
                4 responses
                36 views
                0 likes
                Last Post ScottWalsh  
                Started by olisav57, Today, 07:39 PM
                0 responses
                7 views
                0 likes
                Last Post olisav57  
                Started by trilliantrader, Today, 03:01 PM
                2 responses
                19 views
                0 likes
                Last Post helpwanted  
                Started by cre8able, Today, 07:24 PM
                0 responses
                9 views
                0 likes
                Last Post cre8able  
                Working...
                X