- daily charts
- Applying the correct number of Lots to each trade from the signal.
- Can somebody explain me how this little piece of code works?
SetTimer is useful when you want to do a repeated action in special time distance
for instance you want to open position every 5 minute
if you want to trade at special timezones you should use TimeCurrent() , Hour(),... and set your desired function
I doubt you will ever be able to do that with MT5 because it's only a gateway on Brazilian exchange.
Yes, I use a similar logic to detect market opening and closing times. And sometimes some markets opens before the oficial time, for auction, then closes for some minutes, and re-open again.
This logic which will let you know that, exactly, and you can send or change orders while on that small period, being among the first ones, and/or send orders as soon as it officially opens.
long AtivoTempoParado = 0; int tempoTimer = 200; // 200ms int OnInit() { EventSetMillisecondTimer(tempoTimer); } void OnTimer() { // AtivoTempoParado receives the timeslice since the last tick on the symbol // So when the market is open, it will always be ZERO, or very close to Zero, // because ticks are happening all the time. // // When the market closes, this variable will be kept increasing its values, which // corresponds to the time (in seconds) since the market was closed. (since the last // tick which occurred on such market. // Ex: if the value is 120 means the market is closed for 2 hours.. // // While on the morning of a new day, this variable will have a high value in seconds, // and as soon as the auction is open, instantly this variable it will become = Zero // // Once that happens, you can place your orders, being among the very first ones. // // This will be executed/checked every 200 milliseconds, which is a good time for checking. // AtivoTempoParado = TimeCurrent() - SymbolInfoInteger(_Symbol, SYMBOL_TIME); MyExampleFunction(); } void MyExampleFunction(){ // now you can use your logic // to detect the exactly moment to place the first orders. if (AtivoTempoParado < 60) { PlaceMyOrders(); DoWhateverElse(); etc(); } else { // else the market is closed WaitforSomething(); } } // Change it to fit your needs.
Yes, I use a similar logic to detect market opening and closing times. And sometimes some markets opens before the oficial time, for auction, then closes for some minutes, and re-open again.
This logic which will let you know that, exactly, and you can send or change orders while on that small period, being among the first ones, and/or send orders as soon as it officially opens.
Thanks my friend, you helped me with exactly what I needed!!! Thanks
Obrigado
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use