• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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:	1
Size:	19.2 KB
ID:	1045683

    Click image for larger version

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

Name:	55ed2cbfcc.png
Views:	1
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 NinjaCustomer, Today, 01:48 AM
            0 responses
            1 view
            0 likes
            Last Post NinjaCustomer  
            Started by aligator, Yesterday, 10:11 PM
            0 responses
            2 views
            0 likes
            Last Post aligator  
            Started by psquare, Yesterday, 03:11 PM
            4 responses
            20 views
            0 likes
            Last Post psquare
            by psquare
             
            Started by ballboy11, Yesterday, 03:20 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by tonynt, Yesterday, 02:18 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_JoshG  
            Working...
            X