Multi Time Frames

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #181010 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    Hello coders,

    Would the below simple indicator work on a 1 Hr chart?

    defparam drawonlastbaronly = true
    if CurrentTime = 172000 Or OpenTime = 172000 Then
    DrawText(“Check 65m TimeFrame”,barindex,high+10,SansSerif,standard,16)coloured(255,255,255)
    Endif
    Return

    if it doesn’t work, is there a way to fix the code to make it work?

    #181012 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    1-hour TF will only open, and close, every hour, so there will never be a chance for a condition to be met at a 20-minute time.

    You need to change TF or your code as follows:

    if Time = 172000 or (Time > 172000 and Time[1] < 172000) then

    you can replace TIME by OPENTIME.

    #181013 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    I am confused. Did you mean the code will never work on 1 Hr chart no matter what or are you saying if I change the code to what you suggested then the 20 minute time condition will be met on 1 Hr chart?

    #181027 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    No, it allows your condition to be checked on the first TF boundary AFTER 172000.

    On a 1-hour TF your condition will be met at 180000.

    With your code it will never be met.

    #181082 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    No good mate. I want my condition to be met at precisely 172000 when I am on a 1 Hr chart. is it possible?

    #181083 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Nope. Sorry.

    #181096 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    Tnx Roberto. Much appreciated mate.

    #181207 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    Would the below trick code work and Draw the Text at 15.45 on the 1 Hr Chart?

    defparam drawonlastbaronly = true
    elapsed = timestamp - opentimestamp
    if OPENTIME = 150000 then
    if elapsed = 2700 then
    DrawText("Check 135m F9",barindex,high+10,SansSerif,standard,16)coloured(255,255,255)
    Endif
    Endif
    Return
    #181233 quote
    NicolasNicolas
    Keymaster
    Legend

    The above code should work, but the text will appear only at exact timestamp. But you will probably not see it for 2 reasons:

    1. “elapsed” is equal to 7200 seconds, there is only a small chance the 1-hour bar will update at this precise second
    2. if the text is plotted, it will disappear automatically since you are using a drawonlastbaronly
    #181237 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    Tnx Nicolas.

Viewing 10 posts - 1 through 10 (of 10 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

Multi Time Frames


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
IG_CFD_Trader @wnakhoul Participant
Summary

This topic contains 9 replies,
has 3 voices, and was last updated by IG_CFD_TraderIG_CFD_Trader
4 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/05/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...