script for filewrite:
string FileName = Symbol()+"3.csv"; int limit,f; int counted_bars = IndicatorCounted(); if(counted_bars>0) counted_bars--; limit = Bars - counted_bars - 1; for(f = limit - 1; f>=0; f--) { int handle=FileOpen(FileName,FILE_CSV|FILE_READ|FILE_WRITE,","); FileWrite(handle,"Open Timestamp","Open","High","Low","Close","Volume","fibotime_1","fibotime_3","fibotime_12","fibotime_24"); FileSeek(handle,0,SEEK_END); FileWrite(handle,Time[f],Open[f],High[f],Low[f],Close[f],Volume[f], Sensor_FiboTime(f,1), Sensor_FiboTime(f,3), Sensor_FiboTime(f,12), Sensor_FiboTime(f,24), ); FileClose(handle); } return(0);
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone
I have been reading the topics on this forum for years and I love the great feedback here.
I open my first topic, to share and ask for your opinion.
I am trying to make an indicator that automatically gives the fibonacci time of the current candle (not future candles), I insist it is the time not the price levels.
So after much research, I decided to use ZigZag to determine two points High AND low, or Low and High, depending on which were the last 2 or 3. I reviewed a lot of zigzag indicators, and the one I liked the most is zz_DT_ZZ (attached file for download), ok, with a while procedure, I search for the last 3 zigzag points, and I keep the third and second found to determine my first 100%, from then on I count the number of candles there are and I have calculated the current "moment" referenced to that distance. v0 and v1 = 100 %, next candles increase that percent.
for example, if 10 candles ago was my first point "V0" and the second point found "v1", and they were 10 candles distance, one from each other, I have my first 100%, so subsequent candles will do for example 1.38, something like 14 candles, remember first 10 candles did 100%, so would be interesting to know that current candle, present time. is almost 1.38 (14 candles away from V0).
In my script, in the while procedure, the "P"s variables store hi/low prices,(feed from zigzag hi-lo points) once found it, store the "V"s variables which count the bars to those points found it.
To achieve this, you need to smooth out the candles and renko is perfect for this, in fact, is imperative, uniform candles. So the timeframe should be "current" or "0", using renko.
Everything goes well, it's perfect, do a while to get those points of the zigzag and only alter the "extdepth", so using extdepth now I have several ways to have zigzags of different sizes, this function works perfectly for me when I comment it on my indicator script, but troubles begin when I need it to perform other calculations, curiously if I invoke it to comment, it gives the results very well, but when I invoke it to perform a "filewrite" , for example, it gets stuck and I have to wildly end the metatrader shuting down by windows manager, since it stays frozen.
The function asks for two parameters:
To comment, it works very well, you can in parameter 1 determine from which bar in the past backwards it performs its search and with the second parameter determine the size of the zigzag, all very well but only when I call the function when commenting ! when I call it for filewrite it just freezes.
note, I use this filewrite procedure for N number of functions and icustoms and it always works for me, it is specifically in this function where I get stuck. so I appreciate any comment from the community, and of course I share the idea and my code with great pleasure.
function while for scan past zigzag points and return ratio: