ProRealTime Programming Trader Session Pivots

Discussion in 'Trading Software' started by mrosbiston, Feb 17, 2010.

  1. i wish to be helped with some programming - this is in the VB language, im afraid im not so good at programming, although i wrote a script for weekly pivots i cannot alter it to trader session pivots.... help!!!

    i am trying to code a trading session pivot point. i have attempted to code but i am a novice in this respect. what i wish to be able to plot is the pivot point of each trading session. i want the (H+L+C)/3 pivot for the asian session (12am gmt - 8am gmt) and the london session (8am gmt - 4pm gmt)

    i do not need R1,S1 etc - just P

    i wish to be able to plot this single line - so that the asian session pivot occurs in the timeframe of the london session.

    the (H+L+C)/3 - would be High[8] or something like that for the 480 minutes of data.

    i would like it as an indicator so i do not have to manually plot it everyday.

    i hope i have been descriptive enough - this technique is very useful for gauging intra-day direction and can be used along-side trader pivots. you would also see that if combined with divergence it can be a useful S/R zone for a short change in market direction. Hedge Funds use this technique - although not quite as i describe it.

    here is my original VB code - if anyone can alter it i will be indebted to them and i hope others can use this as well. I'm sure it could also be used for MT4 - although i don't use MT4 - so the prorealtime version would be appreciated.

    James

    ONCE WK = 0
    once sw = 0

    if DayOfWeek < DayOfWeek[1] and wk = 1 then
    sw = sw +1
    wk = 0
    C = pwC
    L = pwL
    H = pwH
    pwH =high
    pwL = low
    endif

    pwH = MAX(Dhigh(0), pwH)
    pwL = MIN(Dlow(0), pwL)
    pwC = Dclose(0)

    if DayOfWeek > 1 then
    wk = 1
    endif


    P = (H + L + C)/3
    R03 = H + 2 * (P - L)
    R02 = P + (H - L)
    R01 = (P * 2) - L
    S01 = (P * 2) - H
    S02 = P - (H - L)
    S03 = L - 2 * (H - P)

    if sw < 2 then
    P = undefined
    R01 = undefined
    R02 = undefined
    R03 = undefined
    S01 = undefined
    S02 = undefined
    S03 = undefined
    endif

    if sw > 1 then
    if wk[1] > wk then
    barCountStart = barIndex
    endif
    barcount = barIndex - barCountStart
    HH = highest[barcount +1](High)
    LL = lowest[barcount +1](low)

    if R02 > HH then
    R03 = R02
    endif
    if R01 > HH then
    R02 = R01
    R03 = R02
    endif
    if S02 < LL then
    S03 = S02
    endif
    if S01 < LL then
    S02 = S01
    S03 = S02
    endif
    endif

    RETURN R03 Coloured(255,0,0) AS "R3 WEEK", R02 Coloured(255,0,0) AS "R2 WEEK", R01 Coloured(255,0,0) AS "R1 WEEK", P AS "PP WEEK", S01 Coloured(0,200,0) AS "S1 WEEK", S02 Coloured(0,200,0) AS "S2 WEEK", S03 Coloured(0,200,0) AS "S3 WEEK"