Hi.
I write a script that connect my app and send a message informating that has a new candle.
But I dont want to put this script in each chart time. I want to use this in only one and verify if for a new candle .
I start with:
So if diferent, we have a new candle in chart 1 minute. Now I need verify in chart 5 minute.
if the below code would work would be perfect
So number like 5/5=1 ; 10/5=2 ; 15/5=3...This results are Integer so we have a new candle in this times...
And for other periods like 15/15=1 ; 30/15=2...
But this line have an error because I dont use double as comparision.
Any idea?
In this way, I will need to put the script in all charts times. If I work with 5 chart, I will need to put this script in all chart.
and this is the problem because I use a connection PIPE to send this information. So I haven't more then one.
So, I need in one script, detect in other chart a new bar. In .net is very easy:
Integer.TryParse( minute/ 5, val) //if minute = 8 the result is False. If = 5,10,15,20... the result is True. So we know when a New chart is created with the Server Time. If I use one timer in my .net, is possible too, however only in system local time.
. . .
So if diferent, we have a new candle in chart 1 minute. Now I need verify in chart 5 minute.
if the below code would work would be perfect
if(Minute() / 5.0 != double){
So number like 5/5=1 ; 10/5=2 ; 15/5=3...This results are Integer so we have a new candle in this times...
And for other periods like 15/15=1 ; 30/15=2...
But this line have an error because I dont use double as comparision.
Any idea?
First, I would suggest saving the current bar's time and then test whether that time changes. If it does, newbar is detected. See here.
Second, your above code won't work as you intended. Try using the remainder operator (the %) to calculate the remainder of division.
if (Minute() % 5 == 0)
Presumably (not necessarily saying correctly), a newbar is detected when Minute() is evenly divided by 5 (with no remainder).
In this way, I will need to put the script in all charts times. If I work with 5 chart, I will need to put this script in all chart.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi.
I write a script that connect my app and send a message informating that has a new candle.
But I dont want to put this script in each chart time. I want to use this in only one and verify if for a new candle .
I start with:
So if diferent, we have a new candle in chart 1 minute. Now I need verify in chart 5 minute.
if the below code would work would be perfect
So number like 5/5=1 ; 10/5=2 ; 15/5=3...This results are Integer so we have a new candle in this times...
And for other periods like 15/15=1 ; 30/15=2...
But this line have an error because I dont use double as comparision.
Any idea?
Thanks