Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

most recent high or low

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

    most recent high or low

    since I have a multi timeframe strategy, I cannot use the built in MRO and devised my custom function. for some reason, It does not return correctly. could you look into it and share where I made a mistake?
    the intention is to return the barid of the most recent donchianchannel high crossover or low crossover
    private int mostRecentUpper()
    {
    int barid=CurrentBar-1;
    int mru=0;


    while(barid>1){
    if (High[barid] > DonchianChannel(100).Upper[barid+1])
    {
    mru=barid;
    break;
    }
    barid-=1;


    }
    return mru;

    }
    private int mostRecentLower()
    {
    int barid=CurrentBar-1;
    int mrl=0;


    while(barid>1){
    if (Low[barid] < DonchianChannel(100).Lower[barid+1])
    {
    mrl=barid;
    break;
    }
    barid-=1;


    }
    return mrl;

    }

    #2
    Hi junkone,

    There are a few terms you are using I am not familiar with.

    Can you clarify MRO (is this an indicator that you have imported?) and barid (is this a math term?).

    Your script does not appear to be a multi-time frame script. With multi-time frame I would expect to see Highs[BarsInProgressIndex][BarsAgoIndex] used along with the correct BarsArray used with the indicator call such as DonchianChannel(BarsArray[BarsInProgressIndex], 100).Upper[BarsAgoIndex].

    I see that there are two methods that return ints. When these are called, it is the value that is calculated that is incorrect, is this correct?

    Are you asking for assistance correcting your logic so that the calculation is what you are expecting?

    Have you added a secondary series and you are wanting assistance using the correct BarsInProgress indexes with Closes, Highs, Lows, Times, etc, and BarsArray index when supplying a secondary series to an indicator call?

    What does the code to add the secondary series look like?
    Are you using if conditions to ensure the code is only run during the specific BarsInProgress in OnBarUpdate?
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by chbruno, 04-24-2024, 04:10 PM
    4 responses
    50 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    10 responses
    398 views
    1 like
    Last Post beobast
    by beobast
     
    Started by lorem, Yesterday, 09:18 AM
    5 responses
    20 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by WHICKED, Today, 12:56 PM
    2 responses
    15 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by Felix Reichert, Today, 02:12 PM
    0 responses
    4 views
    0 likes
    Last Post Felix Reichert  
    Working...
    X