High/Low of an instrument

Forums ProRealTime English forum ProBuilder support High/Low of an instrument

Viewing 1 post (of 1 total)
  • #6909

    A request that was addressed to ProRealTime:

    Can the indicator code pasted below be converted to ProRealTime?

    I realise you currently cannot label on the chart itself so I would be happy with a separate indicator below the chart that shows HH HL LL LH as 1 if true or 0 if false.
    What I am really interested in is the filtering aspect of this code so not all HH HL LL LH as detected just major ones.

    Many thanks for your help.

    // This indicator labels HH, HL, LL, LH on the chart.
    //

    inputs:
    Show.Text(true),
    Show.Line(true),
    LeftStrength( 3 ) ,
    RightStrength( 3 ),
    LookBackLength( 100 ),
    line.color(black);

    variable:
    ID(-1),
    id.tl(-1),
    Offset( 0 ) ,
    HighValue1(0),
    HighValue2(0),
    LowValue1(0),
    LowValue2(0),
    tl.end(0);

    Offset = .15 * Average( Range, 5 ) ;

    if PivotHighVSBar( 1, High, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then
    begin
    HighValue1 = PivotHighVS(1, High, Leftstrength, RightStrength, LookBackLength );
    HighValue2 = PivotHighVS(2, High, Leftstrength, RightStrength, LookBackLength );

    if HighValue2 <> -1 and ( ( HighValue1 >= HighValue2 – Offset ) and ( HighValue1 <= HighValue2 + Offset ) ) then
    begin
    ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, “DT”);
    Text_SetStyle(ID, 2, 1 ) ;
    Text_SetColor(ID, darkyellow);

    Value1 = 1;

    if Show.Line then
    id.tl = tl_new(d, t[rightstrength], h[rightstrength], D, T, H[rightstrength]);
    TL_setcolor(id.tl, line.color);

    tl.end = h[rightstrength];
    end ;

    if HighValue2 <> -1 and HighValue1 > HighValue2 and value1 = 0 then
    begin
    if Show.Text then
    ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, “HH”);
    Text_SetStyle(ID, 2, 1 ) ;
    Text_SetColor(ID, darkgreen);

    if Show.Line then
    id.tl = tl_new(d, t[rightstrength], h[rightstrength], D, T, h[rightstrength]);
    TL_setcolor(id.tl, line.color);

    tl.end = h[rightstrength];
    end
    else
    if HighValue2 <> -1 and HighValue1 < HighValue2 and value1 = 0 then
    begin
    if Show.Text then
    ID = Text_New(Date[RightStrength], Time[Rightstrength], High[RightStrength] + Offset, “LH”);
    Text_SetStyle(ID, 2, 1 ) ;
    Text_SetColor(ID, Red);

    if Show.Line then
    id.tl = tl_new(d, t[rightstrength], h[rightstrength], D, T, H[rightstrength]);
    TL_setcolor(id.tl, line.color);

    tl.end = h[rightstrength];
    end ;
    Value1 = 0;
    end ;

    if PivotLowVSBar( 1, Low, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then
    begin
    LowValue1 = PivotLowVS(1, Low, Leftstrength, RightStrength, LookBackLength );
    LowValue2 = PivotLowVS(2, Low, Leftstrength, RightStrength, LookBackLength );

    if LowValue2 <> -1 and ( ( LowValue1 >= LowValue2 – Offset ) and ( LowValue1 <= LowValue2 + Offset ) ) then
    begin
    if Show.Text then
    ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] – Offset, “DB”);
    Text_SetStyle(ID, 2, 0 ) ;
    Text_SetColor(ID, darkyellow);

    if Show.Line then
    id.tl = tl_new(d, t[rightstrength], l[rightstrength], D, T, l[rightstrength]);
    TL_setcolor(id.tl, line.color);

    tl.end = l[rightstrength];

    Value1 = 1;
    end;

    if LowValue2 <> -1 and LowValue1 < LowValue2 and Value1 = 0 then
    begin
    if Show.Text then
    ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] – Offset, “LL”);
    Text_SetStyle(ID, 2, 0 ) ;
    Text_SetColor(ID, Red);

    if Show.Line then
    id.tl = tl_new(d, t[rightstrength], l[rightstrength], D, T, l[rightstrength]);
    TL_setcolor(id.tl, line.color);

    tl.end = l[rightstrength];

    end
    else

    if LowValue2 <> -1 and LowValue1 > LowValue2 and Value1 = 0 then
    begin
    if Show.Text then
    ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] – Offset, “HL”);
    Text_SetStyle(ID, 2, 0 ) ;
    Text_SetColor(ID, darkgreen);

    if Show.Line then
    id.tl = tl_new(d, t[rightstrength], l[rightstrength], D, T, l[rightstrength]);
    TL_setcolor(id.tl, line.color);

    tl.end = l[rightstrength];

    end;
    Value1 = 0;
    end ;

    if Show.Line then
    tl_setend(id.tl, d, t, tl.end);

    Suggestion for an answer:

    Labeling the chart will be possible, soon, with the release of  version 10.3.

    Concerning the HH, HL, LL and LH I have good News for you:

    ProRealTime actually has a much simpler code for this, as you can see below.

    You can add this indicator both, directly on your price chart by clicking on the little wrench icon and on an own window below the price chart.

     

     

Viewing 1 post (of 1 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login