Summing from a specific bar time

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

    Hello,

    in a intraday setting, what’s the best and most effective code to sum the lows and highs of every bar starting from the 10am bar and resetting each day at intradaybarindex=0? Code has to work across all intraday timeframes ie starts summing from 10am bar onwards (including the 10am bar itself)

    #174174 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    If IntraDayBarIndex = 0 then
       HIs = 0
       LOs = 0
    Endif
    If OpenTime >= 100000 then
      HIs = HIs + high
      LOs = LOs + low
    Endif

    HIs and LOs will retain the sums you need.

    #174183 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    It hasn’t worked accurately. Something needs to be fixed.

    Incidentally if I run the below test code:

    b= opentime = 100000
    return b

    It returns 1 at every opentime = 100000 including today, yesterday and every history day in chart.

    I need it to return 1 on ONLY the 10am bar of the current trading day.

    #174185 quote
    IG_CFD_TraderIG_CFD_Trader
    Participant
    Average

    It is working thank you. I was not counting the current bar šŸ™‚

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

Summing from a specific bar time


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
IG_CFD_Trader @wnakhoul Participant
Summary

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

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