molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming http://www.molanis.com/forum/ |
|
Delay next trade by x amount of time http://www.molanis.com/forum/viewtopic.php?f=6&t=6096 |
Page 1 of 1 |
Author: | MikeT [ Fri Oct 24, 2014 2:48 am ] |
Post subject: | Delay next trade by x amount of time |
Hi Guys Can anyone help me with the code for a MQL block that will delay the opening of the next trade by X amount of time... My EA gets stuck in an Open/Close loop at very specific times based on a custom indi of mine and I just can't work it out so I'm thinking that if I delay the opening of the next trade by 30 or 60 mins then this will solve the issue... Thanx |
Author: | molanisfx [ Fri Oct 24, 2014 11:17 am ] |
Post subject: | Re: Delay next trade by x amount of time |
The mql and mql+ icons were created with specific purposes for people that know mql but like to use molanis for fast development The mql icon is to create trading conditions (like indicator> indicator, etc) The mql+ icon is to manage contained mql code. By contained it means that cannot do what you want unless you write all code that evaluates your trading condition and trade. We put it out there for people that want to have access to molanis functions like number of open positions, open,close trades, or add any custom code that does stuff. But it cannot modify what happens in a TA icon or a Buy icon. |
Author: | MikeT [ Fri Oct 24, 2014 2:29 pm ] |
Post subject: | Re: Delay next trade by x amount of time |
Thanx... But surely I can put a MQL box between my AND and BUY/SELL that will induce MQL4 code that will stop my EA from opening another trade after a certain amount of time.... I'd love to be able to code as well as you guys do but I'm a bit lost here.... Point me in the right direction and I'll try to wing it.... Thsnx... |
Author: | MikeT [ Fri Oct 24, 2014 2:40 pm ] |
Post subject: | Re: Delay next trade by x amount of time |
Sorry... I've just just read your response again and I appreciate what you are saying... I'm trying to get familiar with the MQL blocks.... BUT: 1. I have cut and pasted code (sorry) I have re-typed code into the MQL blocks and it keeps being rejected... 2. WHY can I not copy and past code into the blocks... I don't get that... because if I'm wrong with the code I have to re=type it all in again... I'm not trying to be funny... I love what you guys have done... but I'm getting stumped with advancing my programming... this is new territory that I have been avoiding for a year now... And, it's all about not being able to cut and paste code into the MQL box.... Why can't I do that...? It really F#@$ up my time and motivation to experiment more with the MQL blocks.... Please let me know if I'm not getting something here.... Thanx MikeT |
Author: | MikeT [ Fri Oct 24, 2014 2:51 pm ] |
Post subject: | Re: Delay next trade by x amount of time |
[quote We put it out there for people that want to have access to molanis functions like number of open positions, open,close trades, or add any custom code that does stuff. ][/quote] Don't you understand that that is exactly what I am trying to do... Jesus... Anyways... |
Author: | molanisfx [ Sun Oct 26, 2014 7:57 pm ] |
Post subject: | Re: Delay next trade by x amount of time |
Quote: But surely I can put a MQL box between my AND and BUY/SELL that will induce MQL4 code that will stop my EA from opening another trade Yes you can but it has to follow the condition format as in if (condition) then , or in mql if (insert condition) { So you create the insert condition part and the code generator will use it in if (insert condition) { ... it adds if ( and ) { Thus you cannot just paste any mql code because most likely it is not in condition format For any code you need to use the mql+ icon and write the trading condition and the execution if (condition) { Buy... } |
Author: | MikeT [ Mon Oct 27, 2014 12:04 am ] |
Post subject: | Re: Delay next trade by x amount of time |
Thanx guys.... I've started to become familiar with how the MQL+ boxes work and realized that I had to hard code it.... for those of you who are interested, paste the following code just before Quote: if (TradeOrAlert) { //Set Next Trade Delay int WaitTime = 20; // 20 Min. static int TimeSent; if (TimeCurrent() >= TimeSent + (WaitTime * 60)) { ....and then paste the other part of the functions code just before Quote: // Check Trailing Stops TimeSent = TimeCurrent(); } else return(0); Note: You can obviously change the delay time to whatever delay you would like to use... It seems to be working.... Later |
Page 1 of 1 | All times are UTC - 5 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |