My Eyes Are Burning Staring At This Code All Night Help Please!

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #228790 quote
    Andre36Andre36
    Participant
    New

    Hi all! Stupid Oclock in the morning where I am. Well it is to me anyway, I should be in my bed. I’m trying to code a high and low rectangle of certain daily time periods on any timeframe. I can manage one time period but I’m trying to show multiple times and it’s not working out for me. It’s a piece of code I found here and I’m trying to adapt it to show multiple times…here is what I have worked up to…

    if intradaybarindex=0 then
    maxvalue=0
    minvalue=Dclose(0)*5
    MyBar=0
    endif
    timerange = time>=020000 and time<=050000
    if timerange  then
    maxvalue = max(maxvalue , high)
    minvalue = min(minvalue , low)
    if MyBar=0 then
    x1=barindex
    MyBar=1
    endif
    if time=050000 then
    x2=barindex
    DRAWRECTANGLE(x1,maxvalue,x2,minvalue) coloured(06,17,79)
    endif
    
    maxvalue=0
    minvalue=Dclose(0)*5
    MyBar=0
    endif
    timerange = time>=070000 and time<=100000
    if timerange  then
    maxvalue = max(maxvalue , high)
    minvalue = min(minvalue , low)
    if MyBar=0 then
    x1=barindex
    MyBar=1
    endif
    if time=100000 then
    x2=barindex
    DRAWRECTANGLE(x1,maxvalue,x2,minvalue) coloured(06,17,79)
    endif
    endif
    RETURN

    Would someone be so kind to show me where I’m going wrong?

    Thank you!

    #228791 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Try moving line 35 to in between lines 30 and 31.

    #228834 quote
    Andre36Andre36
    Participant
    New

    Try moving line 35 to in between lines 30 and 31.

    Thank you very much. I tried it but it didn’t workout. However a workaround I achieved was to create separate timeframe codes for the individual times I’m looking for. This works for me because I can toggle them individually. Thanks for your reply, much appreciated sir! Mission was still accomplished. 🙂

    robertogozzi thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

My Eyes Are Burning Staring At This Code All Night Help Please!


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Andre36 @andre36 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Andre36Andre36
2 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/27/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...