
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
So, usually how this works in real life?
Do you wait for confirmation of MA crossover, or do you trade directly on tick, even if the bar is not yet closed? As we all know, one single tick is no guarantee that the crossover will actually take place...
That's why we need a new bar event handler...
So, usually how this works in real life?
Do you wait for confirmation of MA crossover, or do you trade directly on tick, even if the bar is not yet closed? As we all know, one single tick is no guarantee that the crossover will actually take place...
That's why we need a new bar event handler...
As far as I understand we are using tick by tick but again, in a 5 mins timeframe, the MM crossed and only after the new candle, the system released the order.
The code is quite simple:
As far as I understand we are using tick by tick but again, in a 5 mins timeframe, the MM crossed and only after the new candle, the system released the order.
The code is quite simple:
Hello, which value is actually assigned to iMA_buf1_tick_anterior and iMA_buf2_tick_anterior ?
Anyway, the difference of moving averages is not, IMHO, the best approach to determine a crossover...
Hello, which value is actually assigned to iMA_buf1_tick_anterior and iMA_buf2_tick_anterior ?
Anyway, the difference of moving averages is not, IMHO, the best approach to determine a crossover...
iMA_buf2_tick_anterior=iMA_buf2[0];
It is the value of the MMA[0] one tick before. I use to compare the values tick/tick to determine crossover.
What is IMHO ? What is the best approach to determine a crossover ?
Regards ...
iMA_buf1_tick_anterior=iMA_buf1[0];
iMA_buf2_tick_anterior=iMA_buf2[0];
It is the value of the MMA[0] one tick before. I use to compare the values tick/tick to determine crossover.
What is IMHO ? What is the best approach to determine a crossover ?
Regards ...
IMHO means "in my humble opinion" (In Portuguese: "em minha humilde opinião")
The best approach to determine a crossover is to compare the MA values two periods ago with the MA values one period ago.
To add more information about this subject, I took the log file from the EA.
The buy order was sent @ 01:54PM but the MA crossed @ 01:51PM (metatrader) and 01:50PM using another system we use here (graphs attached).
GG 0 13:54:48.189 M3M5 (WINM14,M5) [1]iMA_buf1[0]:52286.92 --- iMA_buf2[0]:52270.65 --- SUB:16.26 --- iMA1ta:52233.83 --- iMA2ta:52235.98 --- SUB:-2.15
PF 0 13:54:48.189 M3M5 (WINM14,M5) [3]FirstOperation==false - Buy
QS 0 13:54:48.189 M3M5 (WINM14,M5) [3]iMA_buf1[0]:52286.92 --- iMA_buf2[0]:52270.65 --- SUB:16.26 --- iMA1ta:52233.83 --- iMA2ta:52235.98 --- SUB:-2.15
To add more information about this subject, I took the log file from the EA.
The buy order was sent @ 01:54PM but the MA crossed @ 01:51PM (metatrader) and 01:50PM using another system we use here (graphs attached).
GG 0 13:54:48.189 M3M5 (WINM14,M5) [1]iMA_buf1[0]:52286.92 --- iMA_buf2[0]:52270.65 --- SUB:16.26 --- iMA1ta:52233.83 --- iMA2ta:52235.98 --- SUB:-2.15
PF 0 13:54:48.189 M3M5 (WINM14,M5) [3]FirstOperation==false - Buy
QS 0 13:54:48.189 M3M5 (WINM14,M5) [3]iMA_buf1[0]:52286.92 --- iMA_buf2[0]:52270.65 --- SUB:16.26 --- iMA1ta:52233.83 --- iMA2ta:52235.98 --- SUB:-2.15
As far as I understand we are using tick by tick but again, in a 5 mins timeframe, the MM crossed and only after the new candle, the system released the order.
The code is quite simple:
Note YouTrade, you already have the buffer, so you don't need to create such variables, like iMA_buf1_tick_anterior.
You just need to choose the right position of the array, for instance:
If you use bar [0] you already get the last tick when you copy buffer (update it) at OnTick().
If you just want to use complete bars (don't depend on tick by tick) just avoid use bar [0], for instance:
if (iMA_buf1[1]>iMA_buf2[1] && iMA_buf1[2]<=iMA_buf2[2]) ...
Finally, if you want to avoid waste of resources, you can use a new bar detection algorithm, but in my opinion this is just a level about what you need now, I would check order parameters before, mainly if you are using a Forex ready code direct to trade BM&FBovespa.
Remark1: this is just buffer usage examples, not an algorithm or trading style suggestion to use moving averages.
Remark2: please use the SRC button in this editor to insert your code, as the examples above that I just fixed to you.