hello, can you reset the Seconds () variable?
my test reset does not work
if ( Open[0]!= Open[1]) { seconds = Seconds (); } if (seconds >= 20 ) { seconds = 0; }
How about this?
How about this?
thank you, it works,
but when it returns to zero it does not start until the next candle. Can it be restarted in the same candle?
Show all relevant code. Is seconds a global or static variable? If not than the value has been lost.
Show all relevant code. You reset it on the first tick of a new bar (probably a small number.) You zero it over 20. But do you ever modify it?
thank you, it works,
but when it returns to zero it does not start until the next candle. Can it be restarted in the same candle?
Since "Seconds()" enter the current seconds in "seconds", 21 - 59 seconds will be entered after 20 seconds.
To put in the elapsed seconds, you need to find another way.
For example,
datetime start_time; int init() { start_time = TimeCurrent (); } int start() { int seconds = 0 ; if ( Open [0] != Open [1]) { seconds = (int)(TimeCurrent () - start_time); } if (seconds >= 20 ) { start_time = TimeCurrent (); } }
Poiché "secondi ()" inserisci i secondi correnti in "secondi", 21 - 59 secondi saranno inseriti dopo 20 secondi.
Per mettere nei secondi trascorsi, devi trovare un altro modo.
Per esempio,
thank you
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello, can you reset the Seconds () variable?
my test reset does not work