Horizontal lines, start time, end time

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #147348 quote
    Geons
    Participant
    Average

    Hi! I want to make an indicator to plot horizontal lines with manual input, but between specific times of the day. In detail, I want to have the option to put my preferred start time and end time of the day, and on those duration to have the option to put manual my prices for horizontal lines. As an extra, I will be happy if these lines has auto dynamic color (green>last price, red<last price) versus the last price. The lines I want to end at the end time. Something like the pivot points.. Can someone help me, please..

    #147349 quote
    robertogozzi
    Moderator
    Master

    There you go:

    //DEFPARAM DrawOnLastBarOnly = true
    //FromHour = 0
    //ToHour   = 120000
    //Price    = 0
    ONCE PlotFlag = 0
    IF (OpenTime = FromHour) OR ((OpenTime > FromHour) AND (OpenTime[1] < FromHour)) THEN
       PlotFlag = 1
       StartBar = BarIndex
    ENDIF
    IF PlotFlag > 0 THEN
       EndBar = BarIndex
       r = 255                             //Red
       g = 0
       IF close > Price THEN
          r = 0
          g = 202                          //Green
       ENDIF
       DRAWSEGMENT(StartBar,Price,EndBar,Price) coloured(r,g,0,255)
    ENDIF
    IF ((OpenTime >= ToHour) OR (Price <= 0)) AND (PlotFlag = 1) THEN
       PlotFlag = 0
       EndBar   = BarIndex
    ENDIF
    RETURN

    You can import the attached ITF file with variables already set for the properties. If you pefer to Copy & Paste remove comments from lines 2-4.

    Geons thanked this post
    PriceLine-From-Time-to-Time.itf
    #147352 quote
    Geons
    Participant
    Average

    Thank you soooo much!!!!

    #147417 quote
    Geons
    Participant
    Average

    Hey robertogozzi

    It is possible to add a little text to that horizontal lines??????

    #147423 quote
    robertogozzi
    Moderator
    Master

    There you go, replace XXXXXX with your text:

    DEFPARAM DrawOnLastBarOnly = true
    //FromHour = 0
    //ToHour   = 120000
    //Price    = 0
    //Distance = 10
    ONCE PlotFlag = 0
    IF (OpenTime = FromHour) OR ((OpenTime > FromHour) AND (OpenTime[1] < FromHour)) THEN
       PlotFlag = 1
       StartBar = BarIndex
    ENDIF
    IF PlotFlag > 0 THEN
       EndBar = BarIndex
       r = 255                             //Red
       g = 0
       IF close > Price THEN
          r = 0
          g = 202                          //Green
       ENDIF
       DRAWSEGMENT(StartBar,Price,EndBar,Price) coloured(r,g,0,255)
       DRAWTEXT("XXXXXX",BarIndex,Price + Distance * PipSize)
    ENDIF
    IF ((OpenTime >= ToHour) OR (Price <= 0)) AND (PlotFlag = 1) THEN
       PlotFlag = 0
       EndBar   = BarIndex
    ENDIF
    RETURN

    I added variable Distance to plot the text at a distance from the line (it can be negative to plot below the line).

    Geons thanked this post
    PriceLine-From-Time-to-Time-1.itf
    #147429 quote
    Geons
    Participant
    Average

    Oh! Thank you again!!! Very good and fast answer!!!!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Horizontal lines, start time, end time


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Geons @geons Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Geons
5 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/13/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...