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 lorem, Today, 09:18 AM
    0 responses
    1 view
    0 likes
    Last Post lorem
    by lorem
     
    Started by hazylizard, Today, 08:38 AM
    4 responses
    10 views
    0 likes
    Last Post hazylizard  
    Started by geddyisodin, Today, 05:20 AM
    2 responses
    18 views
    0 likes
    Last Post geddyisodin  
    Started by Max238, Today, 01:28 AM
    5 responses
    47 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by giulyko00, Yesterday, 12:03 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X