Tradestation 6 Custom Indicator Help

Discussion in 'Trading Software' started by vannielj, Apr 7, 2002.

  1. vannielj

    vannielj

    I am trying to plot fixed pivot, support and resistance lines on my intraday chart. The formula for the lines are:
    Fixed Pivot ("FP") = Yesterday's (high, low,close)/3
    Support = FP - (Yesterday's high - FP)
    Resistance = (FP - Yesterday's low) + FP

    I cannot for the life of me figure out how to do this and the code I have tried doesn't seem to work.

    As an example the S&P E-mini's high low and close were 1135.00 1120.50 and 1125.75 respectively on friday so on tomorrow's intraday chart there would be pivot support and resistance lines at 1127.08, 1119.17 and 1133.67 respectively.

    Any help is greatly appreciated.

    Thx
     
  2. rfoulk

    rfoulk

    I think that feature is already built in.
     
  3. m_c_a98

    m_c_a98

    use the functions HighD(), lowD(), closeD(), openD()

    create new indicator:

    var: pvt(0), sup(0), res(0);
    pvt = (highd(1) + lowd(1) + closed(1)) /3;
    sup = ...enter code here...;
    res = ...enter code here....;

    plot1(pvt, "pvt");
    plot2(sup, "sup");
    plot3(res, "res");
     
  4. Kymar

    Kymar

    Actually... the code in the previous post will work fine on stocks, but will work on e-minis and other futures only if you're interested in the literal high and low of the "day": The lowd and highd functions are based on dates (high of date, low of date, etc.) rather than on sessions. At this moment, on the west coast anyway plotted according to local time, the values produced by the indicator will be the ones you name, but the plots will change at midnight...

    If you want to use the values you specified, you might try the following

    VARS: HH(0), OHH(0), LL(99999), OLL(0), OC(0), FP(0);

    If TIME = SESS1ENDTIME then begin

    OHH = HH;
    OLL = LL;
    OC = C;
    HH = H;
    LL = L;
    End;

    If H > HH then HH = H;

    If L < LL then LL = L;

    FP = (OHH + OLL + OC)/3;

    PLOT1(FP, "FixdP");
    PLOT2((FP - (OHH - FP)), "Support");
    PLOT3(((FP - OLL) + FP), "Resist");

    Obviously, if you wish to define your pivots differently, you'd have to handle the code a little differently also...

    Also, be sure, when you're formatting the indicator, to set scaling to same as symbol, data to subgraph 1... That works, though the scaling for the charts won't look right until you scroll past the first few days... There may be a better way to handle it... I'm not sure... it's late...
     
  5. nkhoi

    nkhoi

  6. Kymar

    Kymar

    may just be drawing the lines using tools, calculating them/others using a spreadsheet program, rather than employing an indicator
     
  7. vannielj

    vannielj

    Thanks for all the help...Kymar you were correct about the E-mini difference. Your solution worked perfectly.

    Again, thanks to everyone who replied, it is greatly appreciated.
     
  8. m_c_a98

    m_c_a98

    I assume that because I use TS2000 and can opt to only collect ES data during regular session hours, that is why the HighD(), functions work fine for me.

    Does TS6 give you the option of what session data to include in indicators?
     
  9. Kymar

    Kymar

    TS6 currently gives the whole session for futures and the regular session for stocks, with a dribble for the Qs. It doesn't allow you to specify periods to include in the charts - though the set-up clearly gives the impression that that's a capacity someone wants to enable at some point in the future, maybe in the everything and a bag of chips upgrade that is supposed to include pre- and post-market stock charting, fully integrated futures trading (rather than browserized), hotkeys, linking, etc., etc.

    The indicators themselves can, however, be written (or re-written) to assess and/or define discreet time segments - by diverse methods whose complexity varies mostly according to what exactly you're trying to collect and assess. It would be much better, though, to be able, as above, simply to define in the symbol or some other chart-specific menu what time periods you want to include.