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 with SMAs don`t work. Strategy Builder write wrong code?

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

    Strategy with SMAs don`t work. Strategy Builder write wrong code?

    Hello
    I would like create strategy with Additional Dataseries = 1 Day and I need to know position of SMA indicators (cross above or below) on This Dataseries.
    I did it with Strategy Builder. Important screenshots you will see below.

    Main question: why it doesn`t work! Why I don`t see lines of SMA on a chart? Why I don`t have measured values of SMA in Data Box?
    Its looks like strategy don`t execute but why? I have online connection, Strategy is Enabled.
    So I don`t understand why this very simple code dont works.
    Please explaine me.

    Thanks a lot
    Click image for larger version

Name:	db86843cab.png
Views:	190
Size:	19.2 KB
ID:	1045683

    Click image for larger version

Name:	626ed0b13d.png
Views:	102
Size:	22.7 KB
ID:	1045684
    Click image for larger version

Name:	55ed2cbfcc.png
Views:	103
Size:	50.2 KB
ID:	1045685

    #2
    Hello sergey_z,

    Thanks or your post.

    Indicators based on added instruments cannot be plotted on the chart on the primary instrument. This is why you do not have the "plot on chart" option for those indicators in the strategy builder. To visualize I would suggest manually adding the moving averages to the chart which appears to already show the daily bars.

    In the screenshots, you have posted it appears you have a 57 period SMA and a 100 period SMA yet the bar index in the screenshot shows that only 68 daily bars are loaded, please increase the number of days to load so that the moving averages can be constructed by the strategy.

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Ok. some questions:
      Originally posted by NinjaTrader_PaulH View Post
      Hello sergey_z,

      In the screenshots, you have posted it appears you have a 57 period SMA and a 100 period SMA yet the bar index in the screenshot shows that only 68 daily bars are loaded, please increase the number of days to load so that the moving averages can be constructed by the strategy.
      1) I will put 300 Days in Dataseries and after Strategy will work? I can check it only by debuging with Print and etc? DataBox don`t show measured values of SMA inside Strategy?
      2) Should I need add second subchart (like on final screenshot) for Strategy or it will be enough add line in code like AddDataseries(...)

      Comment


        #4
        Hello sergey_z,

        Thanks for your reply.

        The print will only print when the 100 crosses above the 57. You may want to reverse the order so that it shows the 57 crosses above the 100 because the way it reads now the 57 actually would cross below the 100 in order for the cross above statement to be true.

        Correct the data box will not show the values of the SMA inside the strategy. This is one reason why you may want to manually add the indicators to the daily bars of the chart so that you can visually see the crosses.

        Yes, if you want to see the daily bars and want to see the SMAs based on the daily bars, you would need to add them manually to the chart as the strategy does not add them to the chart.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello sergey_z,
          Yes, if you want to see the daily bars and want to see the SMAs based on the daily bars, you would need to add them manually to the chart as the strategy does not add them to the chart.
          ok. But if I don`t need this subchart with Daily bars for visualization and only need that Strategy use this second Dataseries for calculate strategy. Strategy will use second Dataseries from code like virtual chart or it have to be on chart for user?

          Comment


            #6
            Hello sergey_z,

            Thanks for your reply.

            Correct, the strategy loads its own daily data and its own moving averages. The chart is merely to help you visualize for debugging and if you don't need to debug then you don't need to add them to the chart.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by StrongLikeBull, Yesterday, 04:05 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Mestor, 03-10-2023, 01:50 AM
            14 responses
            375 views
            0 likes
            Last Post z.franck  
            Started by molecool, 10-09-2017, 10:48 AM
            5 responses
            1,621 views
            0 likes
            Last Post trader-ap  
            Started by The_Sec, Yesterday, 03:53 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by mmenigma, Yesterday, 03:25 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X