Hello traders,
I am trying to build an indicator that will give me the high and the low of a specific candle. I have tried using time but the highs and low would always be of the next candle so I gave up and am now using te number of the candle (perhaps not a good ideia for future testing in a strategy, i don’t know). It is now drawing 2 horizontal lines of the high and low but the lines extend until the next the next same candle in the next trading day.
- is it possible to limit the horizontal lines to the end of the session, in this case 160000 in New York, like if the highs and lows would reset at the end of the session (and not be shown on the chart)?
- is there a way to use the time interval of the candle (in this case 103000-104500) instead of the number (just to add more flexibility)?
- also, I assume that I can then use this indicator in a strategy to use buy and sell orders (this is the next step). Please let me know otherwise.
if IntradayBarIndex =42 THEN
maxprice = high
minprice = low
ENDIF
return maxprice as "maxprice", minprice as "minprice"
PS: I am attaching the picture of how it looks in the chart
Many thanks in case you can help
Hi, you can take a look at this article describing an indicator that updates based on time and the highs and lows reached in a fixed time range. https://www.prorealcode.com/prorealtime-indicators/ict-killzones-and-pivots/
JSParticipant
Senior
Hello,
- When using IB as your broker and you only want to view the Regular Trading Hours (RTH), you can use a “Full (no Globex)” contract. The “no Globex” option shows only the regular trading hours. The standard “Full” contract includes both RTH and ETH.
If this is not what you intend, you can hide the lines with a “trick.” To make the lines invisible, you can set them to “transparent” using the “alpha” parameter (see code).
- Refer to the code: using “OpenTime,” you can determine the opening time of the candle.
- Yes, in most cases, the indicator serves as the basis of a strategy. With the ProOrder module, you can add positions and money management.
If OpenTime=103000 then
maxprice = high
minprice = low
EndIf
If OpenTime=>103000 and OpenTime<=160000 then
alpha=255
else
alpha=0
ENDIF
return maxprice as "maxprice" coloured(255,0,0,alpha), minprice as "minprice" coloured(0,255,0,alpha)
Hi Ivan,
Muchisimas gracias (many thanks)!
That will be helpful so I will try to adapt to what I need.
I tried to understand how/why are you using tthe variables “limitday” and “opentrueday”. Do you mind helping me out on this one?
Buen finde (hava great weekend).
Saludos (regards)
tiago
Thanks JS!
It worked really well visually. Appreciate it.
tiago
Hi!
limitday: Defines a specific moment at the end of the trading day (e.g., market close) to perform final calculations, such as drawing lines or segments on the chart. For example, it marks support or resistance levels accumulated during the session.
openTrueDay: Sets the opening time of the trading day. It is used to initialize values at the beginning of a new day, such as the opening price (openTD) and the bar index (barTD).
These variables help structure the indicator within trading sessions and highlight key start and end points.
Muchas gracias Ivan. I believe these will be both helpful as I want to treat each session independently and will also need to reset a few things like for instance max number of trades per session, etc…