Question on Highest[BarIndex – lastWeekBarIndex](Price)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24467 quote
    CKW
    Participant
    Veteran

    Hi Nicholas,
    Could you please advise what’s different for X by using DailyHigh and High in “Highest[BarIndex – lastWeekBarIndex](X)”?
    I observed some weeks having different result but I couldn’t explain why?

    Which parameter is correct? I tried it on 4hours time frame.

     

    // calculate daily high/low
    dailyHigh = DHigh(1)
    dailyLow = DLow(1)
    
    // calculate weekly high/low
    If DayOfWeek < DayOfWeek[1] then
    weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
    // weeklyHigh = Highest[BarIndex - lastWeekBarIndex](High)
    lastWeekBarIndex = BarIndex
    ENDIF

    Thanks

    br,
    khin wong

    #24487 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    to be sure, a screen capture of what was observed (what instrument and when) would help to answer, but without it, the only thing I can think of when reading this piece of code is:

    if dailyhigh has been defined as Dhigh(1) (previous day) then

    weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)

    would only include highs from day before lasttweekbarindex until previous day when searching the highest of this selection, but not today’s high.

    weeklyHigh = Highest[BarIndex - lastWeekBarIndex](High)

    would include all highs from lastweekbarindex until today when searching the highest (but not high from day before lastweekbarindex).

    So not knowing if it matches what you observed, I can only guess it is possible the differences you saw occured when current day high read by code was higher than any high from lastweekbarindex until previous day, or when a high the day before lastweekbarindex was higher than any high between lastweekbarindex and current day.

    Nicolas thanked this post
    #24986 quote
    CKW
    Participant
    Veteran

    Hi Noobywan,

    Thanks for your explanation. It seems by using Dailyhigh should be more realistic.

    br,

    CKW

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Question on Highest[BarIndex – lastWeekBarIndex](Price)


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
CKW @ckw Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by CKW
9 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/09/2017
Status: Active
Attachments: No files
Logo Logo
Loading...