Question on Highest[BarIndex – lastWeekBarIndex](Price)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24467 quote
    CKWCKW
    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_BywanJC_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
    CKWCKW
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 CKWCKW
9 years, 7 months ago.

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