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

    Click image for larger version

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

Name:	55ed2cbfcc.png
Views:	134
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.

    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.

        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.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            71 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            143 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            76 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            47 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            51 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X