Vertical line at a certain time display on Tradingview, pine script - line

I want 2 lines to be displayed automatically at a certain time. This worked fine with the code below, but Monday is generally not displayed. I am in the timezone Utc+1, Berlin. What have I done wrong?
("Line", overlay=true)
t1 = time(period, "2100-2105")
t2 = time(period, "0030-0035")
Open = na(t1) ? na : green
Close = na(t2) ? na : green
bgcolor(Open, title="Open")
bgcolor(Close, title="Close")

Related

Pine Script Indicator - Sunday Open Horizontal Line

I'm stuck and need some help please... I'm trying to create a indicator which draws a horizontal line from the Sunday Daily Open candle for the upcoming week. I found the code below as an example, which works for simple line, but the line is too short; it only continues for a day - I would want it to plot through to the following Sunday open (if this isn't possible it's also fine to just extend the line, and delete all previous lines.. or I was thinking a continuous step line could be best?)
The chart below shows how I want it to look, whether step line or individual lines for each week. But I wouldn't want them all to extend to the end of the chart, would be too messy.
study(title="Sunday Open", shorttitle="Sunday Open", overlay=true)
openPrice = security(tickerid, 'D', open)
isSunday() => dayofweek(time('D')) == sunday ? 1 : 0
plot(isSunday() and openPrice ? openPrice: na, title="Sunday Open", style=linebr, linewidth=2, color=orange)
That is because you are plotting only when it is Sunday with isSunday() inside your plot().
Instead, use a var to store the open price when it is Sunday, and update this variable the next Sunday.
//#version=5
indicator(title="Sunday Open", shorttitle="Sunday Open", overlay=true)
var float open_price = na
is_sunday = dayofweek == dayofweek.sunday
is_sunday_first_bar = not is_sunday[1] and is_sunday
open_price := is_sunday_first_bar ? open : open_price
plot(open_price, title="Sunday Open", style=plot.style_linebr, linewidth=2, color=color.orange)

R tableGrob cell colors with condition on multiple columns

Is there a way to put colors on all the cells of a tableGrob that are not 0 ?
I have this table with a lot of lines
[][1]
[1]: https://i.stack.imgur.com/w7RCJ.png
I am using tableGrob and then grid.arrange to put 2 tables on the same page with some text
tab1<-tableGrob(tab_glob,rows=NULL,theme = ttheme_default(10),widths=unit(rep(1/ncol(tab_glob), ncol(tab_glob)), "null"), heights=unit(rep(0.95/nrow(tab_glob), nrow(tab_glob)),"npc"))
tab2<-tableGrob(Notes_tous,rows=NULL,theme = ttheme_default(11))
footnote<- textGrob("Moyenne référence = résultats techniciens référents")
padding<-unit(0.5,"line")
tab3<-gtable_add_rows(tab2,
heights = grobHeight(footnote)+ padding,pos=0)
tab3 <- gtable_add_grob(tab3,list(footnote),
t=1, l=1,
r=ncol(tab2))
pdf(paste("Table_",i,".pdf",sep = ""),width=10,height=15) #save in pdf
Point_tab<-grid.arrange(tab1,tab3,ncol=1,nrow=2, top=textGrob("\n \n \nNombre de pointages par note",gp=gpar(fontsize=14,font=3)))
dev.off()
In the first table, showing all the values, I am looking for a way to highlight the values that are not 0 in all the columns. All the answers I have found on the internet are for particular cells or a particular value... Do you have any idea to help me update my code ?
Kind regards,

how to show numeric data in seaborn

I am analyzing the covid 19 data in Seaborn, I have taken a specific state Maharashtra I have given the x='Dates' and for y = "Deaths" data = maha and color = g like this
but when I run my output of Date becomes messed up. like this
How do I show "date" as in date format like 2020-05-03,
Please provide a solution on how I can achieve this format

Pentaho CCC Bar chart : displaying a threshold

I have a bar chart displaying a monthly ratio (e.g. amount of sales in a country ) : I have the month on horizontal axis and the height of each bar is the amount.
Let's assume that the boss sayed 'the monthly amount of sales must be at least 10000€' : I would like to draw an horizontal line with y-coordinate = 10000
How can I do that?
Thank you
I found a solution : I have had a plot2 with the value of 10000 => that draws a circle ; then, in the post execution, I wrote some javascript in order to replace the circle by a line

How to Read/Store many files using GrADS?

I would like to know if anyone can help me to find the issue about this code in GrADS language.
I'd like to read many files and compute and store them, but when I perform that in GraDS, I have the same answer for all imput file.
Could anyone help me in this problem, please?
'reinit'
****Modify here******
var = v10
ano = 1980
while(ano <= 2013)
*Desire point
local = IAG
**lat = -22.3
**lon = 314.62
latInitialP = -34.58
lonInitialP = 305.43
*******************************************************
'sdfopen C:\Pesquisa_Michelle\dados_amandenha\V10m_'ano'.nc'
*Storing out
'set gxout print'
'set prnopts %10.2f 1 1'
in = 1
test = 1460
if ( math_fmod(ano,4) = 0 )
test = 1464
endif
while(in <= test)
'set t 'in
in2 = in + 3
say in
say in2
'define m = ave('var',t='in',t='in2')'
'set lat 'latInitialP''
'set lon 'lonInitialP''
'd m'
valor = sublin(result,2)
lixo = write('C:\Pesquisa_Michelle\dados_amandenha\'var'_'ano'.txt',valor)
in = in + 4
endwhile
lixo = close(''var'_'ano'.txt')
ano = ano + 1
endwhile
update
I don't get an error (message) about that. That works fine, the problem is the result files. All result files have the first result, like a file replication. When I perform that not using a loop, but changing each value for "ano" by myself, I got different result.
The problem is, in my point of view, the command:
'sdfopen C:\Pesquisa_Michelle\dados_amandenha\V10m_'ano'.nc'
This command aren't replace the files for each "ano".
The problem is that you are never closing your input datafile or resetting grads during your main loop. Consider this example where I open a file:
% grads -l
ga-> open data/semicircle-qv14_s.ctl
Scanning description file: data/semicircle-qv14_s.ctl
Data file data/semicircle-qv14_00%y4_s.dat is open as file 1
LON set to -79.5 79.5
LAT set to -79.5 79.5
LEV set to 0.05 0.05
Time values set: 0:7:3:0 0:7:3:0
E set to 1 1
Notice that it says open as file 1. Now I'll narrow down my selection to a single grid point and display the pressure:
ga-> set lat 0
LAT set to 0.125 0.125
ga-> set lon 0
LON set to 0.125 0.125
ga-> set lev 5
LEV set to 4.92368 4.92368
ga-> d prs
Result value = 55198.4
The pressure is 551 hPa. Looks good. Now lets open another data file without closing this one:
ga-> open data-fine/semicircle-qv14_s.ctl
Scanning description file: data-fine/semicircle-qv14_s.ctl
Data file data-fine/semicircle-qv14_00%y4_s.dat is open as file 2
Notice this says open as file 2. Lets display pressure from this file:
ga-> d prs
Result value = 55198.4
Wait, this is the same value? Yes, because we are still displaying from file 1, here prs is the same as writing prs.1. If we want pressure from the second file, we need to use prs.2:
ga-> d prs.2
Result value = -9.99e+08
Different result (and this on is missing because there is no data at this time step in the second file.
There are two ways to fix this.
Where you are incrementing ano in your loop, add the command close 1. This will close the input data file so when the next one is loaded the display commands will properly display its content.
At the top of your loop, before sdfopen add reinit, which will reset lots of things, including closing all open files. You set your output up in each loop iteration so this shouldn't be a problem for you.