Coding help - page 495

 
Mastercash:
Mladen, I seem not to understand, Im using EMA period 10 to act as floating r/s fo a purpose, if I reduce the period to 1-period, it will be too weak to be used as r/s....! I just need a kind hearted fello to adjust the code to give its alert within the candle, not at the opening of the new candle.Im just a leaner coder!

Sorry

Reading the code in a wrong way

Anyway, this line

MainBuffer=iMA(NULL,60,10,0,MODE_SMA,PRICE_CLOSE,i);

will be wrong in any case when chart time frame is different than 1 hour. Use iBarShift() to set the index. Like this

int y = iBarShift(NULL,PERIOD_H1,Time);

MainBuffer=iMA(NULL,PERIOD_H1,10,0,MODE_SMA,PRICE_CLOSE,y);

Also, change the SIGNAL_BAR constant value from 1 to 0 in order to alert on a current opened bar (but then some more changes in the code must be made)

_________________

PS: I recommend that you take some of the new indicators from this thread : https://www.mql5.com/en/forum/180648 since there are a lot of examples how those cases should be handled

 

Please Please Please! I need and indicator with alert that will alert me When right after the close of the 7th consecutive bullish candle or 7the consecutive bearish candle.

Pin , dogi and other forms of candles are not counted. Only bull and bear candle alert that will pop up with sound When there 7 bearish or bullish bars back to back.

I will really appreciate and share my idea When the strategy is done.

 

Hi, Mladen!

I think I found out the reason for the increase time optimization.

Smooth out the data instead of the "iMAOnArray", Include MovingAverages.mqh.

A single run of the indicator in the strategy tester with iMAOnArray:

2015.06.28 00:13:42.132 2015.06.15 23:59 EURUSD,H1: 70897 tick events (71897 bars, 142742 bar states) processed in 0:02:40.525 (total time 0:02:40.556)2015.06.28 00:11:01.613 2015.06.15 23:59 TSIErgodic inputs: p2=7; p3=5; p4=3; p5=3; 2015.06.28 00:11:01.587 2015.06.15 23:59

A single run of the indicator in the strategy tester with MovingAverages.mqh:

2015.06.28 00:14:10.625 2015.06.15 23:59 EURUSD,H1: 70897 tick events (71897 bars, 142742 bar states) processed in 0:00:01.045 (total time 0:00:01.077)2015.06.28 00:14:09.577 2015.06.15 23:59 TSI_New inputs: p2=7; p3=5; p4=3; p5=3; 2015.06.28 00:14:09.546 2015.06.15 23:59 When I use a new indicator in the EA, no trades and the indicator window is empty.

During the optimization shows that the runs with transactions:

12 513.73 354 1.18 1.45 269.81 18.75% 1.18239793 p2=21 p3=9 p4=15 p5=28 s=4 stop=0.02 p=0.026 Lots=0.01 Prots=0.07

18 417.94 349 1.16 1.20 235.92 15.14% 1.15998398 p2=41 p3=19 p4=27 p5=36 s=1 stop=0.024 p=0.012 Lots=0.01 Prots=0.07

7 314.10 346 1.09 0.91 326.66 20.58% 1.08715973 p2=13 p3=21 p4=5 p5=4 s=1 stop=0.028 p=0.02 Lots=0.01 Prots=0.07

13 229.71 176 1.17 1.31 287.58 19.28% 1.16941715 p2=35 p3=15 p4=13 p5=4 s=4 stop=0.022 p=0.016 Lots=0.01 Prots=0.07

11 66.44 26 1.31 2.56 62.37 5.78% -1.00000000 p2=23 p3=27 p4=25 p5=16 s=31 stop=0.03 p=0.014 Lots=0.01 Prots=0.07

Can you fix the indicator?

tsi_new.mq4

Files:
tsi_new.mq4  5 kb
 
QuantF:
Hi, Mladen!

I think I found out the reason for the increase time optimization.

Smooth out the data instead of the "iMAOnArray", Include MovingAverages.mqh.

A single run of the indicator in the strategy tester with iMAOnArray:

2015.06.28 00:13:42.132 2015.06.15 23:59 EURUSD,H1: 70897 tick events (71897 bars, 142742 bar states) processed in 0:02:40.525 (total time 0:02:40.556)2015.06.28 00:11:01.613 2015.06.15 23:59 TSIErgodic inputs: p2=7; p3=5; p4=3; p5=3; 2015.06.28 00:11:01.587 2015.06.15 23:59

A single run of the indicator in the strategy tester with MovingAverages.mqh:

2015.06.28 00:14:10.625 2015.06.15 23:59 EURUSD,H1: 70897 tick events (71897 bars, 142742 bar states) processed in 0:00:01.045 (total time 0:00:01.077)2015.06.28 00:14:09.577 2015.06.15 23:59 TSI_New inputs: p2=7; p3=5; p4=3; p5=3; 2015.06.28 00:14:09.546 2015.06.15 23:59 When I use a new indicator in the EA, no trades and the indicator window is empty.

During the optimization shows that the runs with transactions:

12 513.73 354 1.18 1.45 269.81 18.75% 1.18239793 p2=21 p3=9 p4=15 p5=28 s=4 stop=0.02 p=0.026 Lots=0.01 Prots=0.07

18 417.94 349 1.16 1.20 235.92 15.14% 1.15998398 p2=41 p3=19 p4=27 p5=36 s=1 stop=0.024 p=0.012 Lots=0.01 Prots=0.07

7 314.10 346 1.09 0.91 326.66 20.58% 1.08715973 p2=13 p3=21 p4=5 p5=4 s=1 stop=0.028 p=0.02 Lots=0.01 Prots=0.07

13 229.71 176 1.17 1.31 287.58 19.28% 1.16941715 p2=35 p3=15 p4=13 p5=4 s=4 stop=0.022 p=0.016 Lots=0.01 Prots=0.07

11 66.44 26 1.31 2.56 62.37 5.78% -1.00000000 p2=23 p3=27 p4=25 p5=16 s=31 stop=0.03 p=0.014 Lots=0.01 Prots=0.07

Can you fix the indicator?

tsi_new.mq4

There is nothing to fix in the indicator

The problem is not in the indicator - the problem is in the backtester.

In any case, using aMAOnArray() must be significantly faster than using ExponentialMAOnBuffer() - simply because iMAOnArray() is executed on machine code level while ExponentialMAOnBuffer() is executed on P-code level. The fact that iMAOnArray() is no faster is just showing that new builds on mt4 are having serious problems

 
mladen:
There is nothing to fix in the indicator

The problem is not in the indicator - the problem is in the backtester.

In any case, using aMAOnArray() must be significantly faster than using ExponentialMAOnBuffer() - simply because iMAOnArray() is executed on machine code level while ExponentialMAOnBuffer() is executed on P-code level. The fact that iMAOnArray() is no faster is just showing that new builds on mt4 are having serious problems

Many times on the forum wrote about this issue. No good. Do you think the bug will not be fixed?

 
QuantF:
Many times on the forum wrote about this issue. No good. Do you think the bug will not be fixed?

It should be fixed

If it will be - no idea. Backtester is worse and worse with each new build - I would not hope too much

 

Is there any manual explaining how to work with arrays in a most efficient way?

 
apprentice coder:
Is there any manual explaining how to work with arrays in a most efficient way?

Since mql uses arrays in a similar way as C/C++, good start would be here : Arrays - C++ Tutorials

What you should avoid is setting arrays as series. Resizing in tha case us a pain in the ... (extremely inefficient) - best way is to use arrays indexing the same way as in C/C++ : first (oldest) element is index 0, and last (newest) element index is array size - 1

 

@Programmers and Coders in the forum please can you add a breakeven option to the expert advisor attached below

 
douceurdange:
Hi, is it possible to put arrows when the RSI line go back into the bollinger bands of the rsi+bollinger bands indicator ?

I put the cci nrp advanced alert as a model of the alert I'd like to have .

Thanks in advance

rsi__bollinger_bands.mq4rsi__bollinger_bands.ex4cci_-_nrp_-_mtf_advanced_alerts.ex4cci_-_nrp_-_mtf_advanced_alerts.mq4

the indicator was posted here : https://www.mql5.com/en/forum/general

Reason: