day open indicator question

Questions about MultiCharts and user contributed studies.
FiatLux
Posts: 4
Joined: 04 Jan 2020
Has thanked: 1 time

day open indicator question

Postby FiatLux » 14 May 2022

Hello

I have a question about the day open, high and low indicators.
day high and low are numbers that change during the day.
However, in the case of day open, it is fixed with the start and does not change.
Nevertheless, day open is displayed as if it were not a fixed value.
So, when an indicator is inserted for the first time, day open is not immediately displayed.
After inserting the indicator, it will start to be drawn only after some time has passed.
And if you put an indicator for recovery the next day, the day open is not displayed at all when the market is over.

On the other hand, since yesterday's OHLC is a predetermined number, a horizontal line appears whenever an indicator is inserted.

How can I make the day open come out as a fixed value as yesterday OHLC, and as a correct horizontal line as soon as an indicator is inserted?

I have attached the picture together. thank you.

-yesterday OHLC-

variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 0 ),
var5( 0 ),
var6( 0 ),
var7( 0 ),
var8( 0 ) ;

if Date <> Date[1] then
begin

var0 = var0 + 1 ;
var1 = var2 ;
var3 = var4 ;
var5 = var6 ;
var7 = Close[1] ;
var2 = Open ;
var4 = High ;
var6 = Low ;
end
else
begin
if High > var4 then
var4 = High ;
if Low < var6 then
var6 = Low ;
end ;
condition1 = var0 >= 2 and BarType < 3 ;
if condition1 then

begin
Plot1( var1, "YestOpen" ) ;
Plot2( var3, "YestHigh" ) ;
Plot3( var5, "YestLow" ) ;
Plot4( var7, "YestClose" ) ;
end ;


----------------------------------------------------------------
-today OHL-

input:
PlotOpen( true ),

PlotPrevClose( false ) ;


variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ) ;

condition1 = GetAppInfo( aiRealTimeCalc ) = 1 ;
if condition1 then
begin

var1 = DailyHigh ;
var2 = DailyLow ;

Plot1( var1, "High" ) ;
Plot2( var2, "Low" ) ;

if PlotOpen then
begin
var0 = DailyOpen ;
Plot3( var0, "Open" ) ;
end ;

if PlotPrevClose then
begin
var3 = PrevClose ;
Plot4( var3, "YestClose" ) ;
end ;

end ;

--------------------------------------------------
Attachments
dayopen.jpg
(205.31 KiB) Not downloaded yet

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: day open indicator question

Postby TJ » 14 May 2022

See posts #1 & #2
viewtopic.php?t=11713

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: day open indicator question

Postby TJ » 14 May 2022

What is your chart resolution?
What is your session time?


Return to “MultiCharts”