I am writing indicator which scans different symbols and timeframes for candlesticks - could you help ?
Hello,
I am writing indicator which scans different symbols and timeframes for candlesticks. Candlesticks formations are early trend changing signals.
The idea is:
1) Scan array of symboks ("for" cycle)
2) Scan array of timeframes ("for" cycle)
3) Find symbols/timeframes which matches criteria ("if" condition)
4) Give alert to screen : symbol, timeframe, range, open-close, range/open-close ratio ("alert")
I also added time intervalto reduce number of alerts.
There are some problems:
Some times ranges are calculated correctly and simetimes not (expecially are problems with daily charts) - perhaps problems with iHigh, iLow, iClose, iOpen settings ? Or "for" cycle ?
Also I want that alert gives range and open-close without number afer digits.
Thanks in advance for assistance,
Edward
Hi Edward
On the calculation of the ranges, I notice that the line that constructs Message1 is before the values of Range and OpCl are calculated, so Message1 will contain the values for the previous iteration. I suggest moving Message1 = ... to after Ratio = ...
For the zeros after numbers, when you use "+" to add numbers to string variables, MQL does an implicit conversion to string for you. If you use DoubleToStr(), it allows you to specify the precision.
I hope this helps.
Jellybean
Hi Jellybean,
Thank you for advice. Problems with digits and bar size/ratio now are solved. Only one problem remains - Alerts are given too often.
My idea was to give only one Alert per one candle. Therefore I wrote condition:
if ( TimeCurrent() >= PrevTime[i][j] + 45* timeframe[j] )
//pause between the same symbol/timeframe alert. Idea is to make a pause between alerts. Pause depends of time frame. If timeframe is 60 (min), then pause is //60*30 = 1800 sek = 30 min
{
//long shadow, small body
if ( Ratio >= 3)
{
Alert(Message1);
PrevTime[i][j] = TimeCurrent(); //This gives new value for time (symbol/timeframe combination i-symbol number, j-timeframe number)
}
However the pause does not work correctly. Maybe you have idea ?
Thanks,
Edward
Hi Edward
I haven't had a detailed look at your code, but I did notice that you have declared the array PrevTime within the start() function. This means that it will vanish when start() is completed and will be re-initialised every time start() is called (usually every tick). I suggest you move the declaration to occur before init(), then it will continue to hold previous values.
Also, I would declare it to be type datetime, not int. int probably works fine, but I think it is better practice to assign times to datetime variables.
Cheers
Jellybean
Hi,
I tested my scanner for several days and it seems quite useful. However alert periods does not work well: often it gives the same alert several times. Perhaps time assignment does not work. I declared time as two demantional array, using "static"
if ( TimeCurrent() >= PrevTime[i][j] + 60* timeframe[j] ) //pause between the same symbol/timeframe alert. Comparies Current Time with time, when last signal for certain symbol/timeframe combination was generated.
{
//long shadow, small body (last candle)
if ( Range/Body >= 3) //long shadows
{
Alert(Message1," TimePrevious ", TimeToStr(PrevTime[i][j]|TIME_SECONDS), " TimeCurrent ", TimeToStr(TimeCurrent()|TIME_SECONDS)); // Previous time is 1970.01.01
Print(Message1);
PrevTime[i][j] = TimeCurrent(); // assigns currnet time to symbol/timeframe combination
Alert(Message1," TimePrevious ", TimeToStr(PrevTime[i][j]|TIME_SECONDS), " TimeCurrent ", TimeToStr(TimeCurrent()|TIME_SECONDS)); //now previous time is OK
}
Is it possible to assign time in better way ?
Thanks in advance,
Edward
Hi,
I tested my scanner for several days and it seems quite useful. However alert periods does not work well: often it gives the same alert several times. Perhaps time assignment does not work. I declared time as two demantional array, using "static"
if ( TimeCurrent() >= PrevTime[i][j] + 60* timeframe[j] ) //pause between the same symbol/timeframe alert. Comparies Current Time with time, when last signal for certain symbol/timeframe combination was generated.
{
//long shadow, small body (last candle)
if ( Range/Body >= 3) //long shadows
{
Alert(Message1," TimePrevious ", TimeToStr(PrevTime[i][j]|TIME_SECONDS), " TimeCurrent ", TimeToStr(TimeCurrent()|TIME_SECONDS)); // Previous time is 1970.01.01
Print(Message1);
PrevTime[i][j] = TimeCurrent(); // assigns currnet time to symbol/timeframe combination
Alert(Message1," TimePrevious ", TimeToStr(PrevTime[i][j]|TIME_SECONDS), " TimeCurrent ", TimeToStr(TimeCurrent()|TIME_SECONDS)); //now previous time is OK
}
Is it possible to assign time in better way ?
Thanks in advance,
Edward
Hi Edward,
I am a newbie trader and need someone to help me program a similar multi currency pair scanner on 1H time frame, using RSI and stochastics western indicators.
Could you please contact me on segun_oso@yahoo.co.uk? Or send me your email address and/or phone number so I can contact you.
Thanks in advance.
- 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,
I am writing indicator which scans different symbols and timeframes for candlesticks. Candlesticks formations are early trend changing signals.
The idea is:
1) Scan array of symboks ("for" cycle)
2) Scan array of timeframes ("for" cycle)
3) Find symbols/timeframes which matches criteria ("if" condition)
4) Give alert to screen : symbol, timeframe, range, open-close, range/open-close ratio ("alert")
I also added time intervalto reduce number of alerts.
There are some problems:
Some times ranges are calculated correctly and simetimes not (expecially are problems with daily charts) - perhaps problems with iHigh, iLow, iClose, iOpen settings ? Or "for" cycle ?
Also I want that alert gives range and open-close without number afer digits.
Thanks in advance for assistance,
Edward