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

Help with MTF Strategy

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

    Help with MTF Strategy

    Hi support,
    I've been using MTF strategies for a while, but I am unable to overcome a problem.

    In my strategy I use 2 time frames:
    primary time frame, lets say 60 min = BarsArray[0]
    secondary time frame, lets say 1 min = BarsArray[1]

    I am using this script:

    Code:
    if(BarsInProgress == 1)
    {
    myHigh = Math.Max(Highs[0][0], MAX(Highs[1],60)[0]);
    }
    with this code I would expect that myHigh = the highest between the previous 60min bar high and the most recent high, intended as a higher high printed on the 1 min bar. However when running this script if will always and only return the last 60 min bar, as if in all the sample data i run never a higher high of the previous high is printed.

    FOR EXAMPLE, lets say that during the last 60 min period ended at 10.00am the high was 1.6015 (Highs[0][0] == 1.6015), now lets say that at 10.15am a new high at 1.6016 is done, therefore Highs[1][0] == 1.6016 on the next 1 min bar, I would exect myHigh to be equal to 1.6016 at 10.16am, but this doesn't currently happen

    How is this possible? what am I doing wrong?

    Thanks,
    Last edited by sburtt; 11-24-2013, 11:47 AM.

    #2
    Originally posted by sburtt View Post
    Hi support,
    I've been using MTF strategies for a while, but I am unable to overcome a problem.

    In my strategy I use 2 time frames:
    primary time frame, lets say 60 min = BarsArray[0]
    secondary time frame, lets say 1 min = BarsArray[1]

    I am using this script:

    Code:
    if(BarsInProgress == 1)
    {
    myHigh = Math.Max(Highs[0][0], MAX(Highs[1],60)[0]);
    }
    with this code I would expect that myHigh = the highest between the previous 60min bar high and the most recent high, intended as a higher high printed on the 1 min bar. However when running this script if will always and only return the last 60 min bar, as if in all the sample data i run never a higher high of the previous high is printed.

    FOR EXAMPLE, lets say that during the last 60 min period ended at 10.00am the high was 1.6015 (Highs[0][0] == 1.6015), now lets say that at 10.15am a new high at 1.6016 is done, therefore Highs[1][0] == 1.6016 on the next 1 min bar, I would exect myHigh to be equal to 1.6016 at 10.16am, but this doesn't currently happen

    How is this possible? what am I doing wrong?

    Thanks,
    • How many days of data do you have on the chart?
    • I presume that you do have a CurrentBars check for both Price DataSeries?
    • What is your BarsRequired?

    Comment


      #3
      Originally posted by koganam View Post
      • How many days of data do you have on the chart?
      • I presume that you do have a CurrentBars check for both Price DataSeries?
      • What is your BarsRequired?
      Thanks, I've actually overcome the issue. This is part of a more complex script and i was missing a check. Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ZeroKuhl, Today, 04:31 PM
      0 responses
      7 views
      0 likes
      Last Post ZeroKuhl  
      Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
      54 responses
      5,336 views
      0 likes
      Last Post Gaterz
      by Gaterz
       
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      11 responses
      73 views
      0 likes
      Last Post -=Edge=-  
      Started by _Zero_, 04-10-2020, 03:21 PM
      145 responses
      7,899 views
      6 likes
      Last Post johng2
      by johng2
       
      Started by TheTradingMantis, 01-19-2023, 02:05 AM
      43 responses
      918 views
      0 likes
      Last Post jmagaia
      by jmagaia
       
      Working...
      X