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

Multi Timeframe problem

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

    Multi Timeframe problem

    Hello
    I'm trying to develop a strategy using indicators in a multi timeframe system, but something is not working right.

    I'm using 10s as the primary series and added a 15min as the secondary series.

    LOGIC: After the high cross above EMA50 on the 15min, look for an EMA21 cross below EMA50 on the 10sec chart.
    The first entry marked with RED on the 10sec chart was ignored, while the second entry marked with GREEN on the 10sec chart worked fine.

    If you look at the time on the 15Min chart you will notice that the bar that cross the EMA happened at 11:15 (11:00-11:15)
    Look at the entries on the 10sec chart. The first entry happened at 11:06, while the second entry happened at 11:28, therefore the second entry happened after the 15min bar closed.
    This is not the behavior Im expecting. The green circle indicates on both charts that the CrossAbove(Highs[1][0], EMA50,1) had already happened therefore, both entries should be valid.

    I cant figure out what is happening here and how to fix it. Any inputs on this matter?

    Thank you.
    Click image for larger version

Name:	image.png
Views:	101
Size:	227.6 KB
ID:	1272812

    #2
    Hello vertx,

    I would suggest trying to use some prints so that you can see what the strategy is actually doing in its logic. Comparing charts where the strategy is not applied would not be recommended because there may be differences from what the strategy is actually seeing. You can add prints into the strategies entry conditions to see when the become true. Alternatively you can add prints outside of the conditions to output values for each bar, that would be required to know when a cross condition should be true or not
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply Jesse. I was just coming here to update the post.
      I just solved the problem by using Calculate.OnEachTick AND using the PLAYBACK. Is there any way I can do that on the strategy analyzer?

      On a side note, although I used prints before (for very basic stuff) I'm not very good with it. Do you have any article/video explaining how to use it effectively? Especially when using multi timeframe.
      Thank you for your time.

      Comment


        #4
        Hello vertx,

        The strategy analyzer uses OnBarClose processing because that is historical data. Depending on your logic you may be able to use TickReplay in a backtest to simulate that.

        We have the following document which explains the basic use of prints however each strategy will be unique in regard to where you may need to place prints. A general rule to follow would be knowing when you want to print something, for example if you need to know a condition is true its best to put the print inside the condition. If you need to know a more broad amount of information its best to put the print directly in OnBarUpdate before your condition so you can output bar times and the values you used in your conditions. That helps you see how the strategy sees the data so you can understand why a condition may be false on a specific bar. That also helps you confirm the strategy is running the same as a chart you may have been comparing it against.

        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ageeholdings, Today, 07:43 AM
        0 responses
        7 views
        0 likes
        Last Post ageeholdings  
        Started by pibrew, Today, 06:37 AM
        0 responses
        4 views
        0 likes
        Last Post pibrew
        by pibrew
         
        Started by rbeckmann05, Yesterday, 06:48 PM
        1 response
        14 views
        0 likes
        Last Post bltdavid  
        Started by llanqui, Today, 03:53 AM
        0 responses
        6 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        12 views
        0 likes
        Last Post burtoninlondon  
        Working...
        X