Squeeze indicator for TOS

Discussion in 'Trading Software' started by joe4422, Sep 8, 2009.

  1. joe4422

    joe4422

    Just copy and paste in to the study editor




    declare lower;
    input Length = 20;
    input price = close;
    ######################
    def e1 = (Highest(High, length) + Lowest(low, length)) / 2 + Average(close, length);
    def osc = Inertia(price - e1 / 2, length);
    plot oscp = osc;

    def diff = reference BollingerBandsSMA(length = 20)."upperband" - reference KeltnerChannels."Upper_Band";
    plot mid = 0;
    mid.AssignValueColor(if diff >= 0 then Color.UPTICK else Color.DOWNTICK);

    #oscp.assignValueColor(if osc[1] < osc[0] then Color.CYAN else Color.magenta);
    oscp.AssignValueColor(if osc[1] < osc[0] then
    if osc[0] >= 0 then
    #UpPos
    CreateColor(0, 255, 255) else
    #UpNeg
    CreateColor(204, 0, 204)
    else if osc[0] >= 0 then
    #DnPos
    CreateColor(0, 155, 155) else
    #DnNeg
    CreateColor(255, 155, 255));

    oscp.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
    mid.SetPaintingStrategy(PaintingStrategy.POINTS);