Lukeye Posted September 19, 2009 Report Share Posted September 19, 2009 Re: Building your own EA G/08. thanks it works :-bd I tried with sleep function and other things , took me several hours LOL Will go through the tutorial this weekend . Quote Link to comment Share on other sites More sharing options...
Lukeye Posted September 19, 2009 Report Share Posted September 19, 2009 Re: Building your own EA G/08. It is not my priority now.. but I think this should work.. why dont you test it and let us all know I tested the sell code and it did not work . i changed (Symbol() == OrderSymbol() to (Symbol() != OrderSymbol() and now it works but instead of waiting 46 Minutes extern int NextSellStop_Order_Minutes =46; it waits only 32 minutes :-? EDIT There is a difference of 14 minutes. When I add 14 like NextSellStop_Order_Minutes =60 it is ok :hammer: Quote Link to comment Share on other sites More sharing options...
clovelly Posted September 19, 2009 Report Share Posted September 19, 2009 Re: Building your own EA G/08. asgard2, what is the purpose of the thread? If it is to teach members how to code by going through the process of "building your own EA", then it is fine the way it has been going. But if it is to (re)build the EA that you already modified on the Buy side by completing the other half (Sell side) then I propose either: 1. you post the EA as is, there are plenty of coders in this forum that can help, or 2. PM some coders that you believe can help you (if you do not want to make the EA public, for some personal reasons) Either way, you will have a final complete EA in no time. With my programming experience, piecemeal coding by a collective of people without seeing the existing totality, will not lead to a satisfactory conclusion. It reminds me of the game of blind-folded people trying to draw an elephant. I am saying this with a friendly spirit, so pls do not interpret it as some criticism :) . It is your call, of course. Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 19, 2009 Author Report Share Posted September 19, 2009 Re: Building your own EA G/08. Either way, you will have a final complete EA in no time. With my programming experience, piecemeal coding by a collective of people without seeing the existing totality, will not lead to a satisfactory conclusion. It reminds me of the game of blind-folded people trying to draw an elephant. I am saying this with a friendly spirit, so pls do not interpret it as some criticism :) . . The EA, works the way it is. I am not looking for anyone's code to fix this EA. Why would I? Another 4 months, it will have made its first Mill. :)>- :)>- That is not to say it is perfect, but how much money do I need? The idea here is to help others do it too. This thread is not for me. When I wanted help with this EA there was non to be had.. I mean none! I don't mean here particularly, I mean anywhere. This thread is for anyone else that lacks the independence to do it themselves and wishes they could. That was me three months ago. I still don't know very much about coding but that is exactly the point I am making. If your a good trader and you know the coding basics.. you are a long way ahead of a good coder that knows the trading basics. Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 19, 2009 Author Report Share Posted September 19, 2009 Re: Building your own EA G/08. It reminds me of the game of blind-folded people trying to draw an elephant. I am saying this with a friendly spirit, so pls do not interpret it as some criticism :) . LOL... well you could show a bit of good spirit and help them too! Save the Elephants ;) Quote Link to comment Share on other sites More sharing options...
Rio Posted September 19, 2009 Report Share Posted September 19, 2009 Re: Building your own EA G/08. Cheers for posting this asgard... I'm trying to get into MQL4 coding proper, so this is all helpful. I'm just getting around to experiment with the Greezley code, but I wonder what pairs and timeframe it runs on.... I guess it's USDJPY. I get a lot of Order Send error 130 issues (I'm testing on 4 digit broker) Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 19, 2009 Author Report Share Posted September 19, 2009 Re: Building your own EA G/08. Cheers for posting this asgard... I'm trying to get into MQL4 coding proper, so this is all helpful. I'm just getting around to experiment with the Greezley code, but I wonder what pairs and timeframe it runs on.... I guess it's USDJPY. I get a lot of Order Send error 130 issues (I'm testing on 4 digit broker) Hi Rio, Good job someone posted or I was thinking I may as well send the snippets straight to Lukeye and not worry about this thread. The currency pairs it works on are GBP/JPY GBP/USD EUR/USD, not that I have traded anything but the GBP/USD live. Others, may find more pairs it works on. if you are getting order send errors.. could be something is set to close to the broker requirement. It will not work the way it does in the video on a four digit broker...sorry. I wish I knew the solution to this myself. Edit, the time frame can be any.. you will see no difference unless you put other code in that relies on a timeframe. Quote Link to comment Share on other sites More sharing options...
Rio Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. Cheers for the heads-up. I have trawled through all the past posts and added the snippets you posted already, so now I feel up to date. Saw the video too. Very impressive. Already I've figured most of the extern inputs you added to the code, as well as the trade times - just from looking at the video. I will see how the externs you added fit together with Gepard a bit later. There is a lot to soak up! I'm still unfamiliar with the conditions on which this one trades, so I'll try and get some research done. That's really half the battle reverse engineering this... I have no idea how it trades! (yet) Here's what I know so far -- which isn't much, as I am a coder, I'm not much of a trader or very experienced with MQL4 either, so here goes.... 1) trade hour Already figured out from the video that it trades between hours 2 -21. Adding something to ensure that it only trades at these times can easily be ripped from other EAs, for sure. 2) if trade is in profit at trade hour close and no sl, set intrim trailing at break even. 3) if trade is not in profit at trade hour close, then close trade at first break even. Not sure how to code this yet 4) Don't use limit or instant execution orders There was a pile of inputs that I never saw towards the top as the scrolling of the video went too fast. Have you removed a huge block of them? (or only the ones related to limit and execution orders?). 5) delete unused buystop every 14 minutes 6) if 5 is true, then don't reorder for 45 minutes. OK, some of the patches deal with this already.... 7) Minimum Time between real orders 30 minutes 8) If MA crossing is higher than trailing stop, then take profit now. 9) Dynamic stop loss.. works on speed indicator and iAC well, the input look like this:- extern string _s3 = "Market Exit Control"; extern int UseDynamicStoploss = 0; extern double StopLossB = 1080; extern double StopLossS = 780; extern int TimeStopLoss_Minutes = 0; How the indicators determine the stop loss is a mystery to me still. 10) If buystop is taken out buy a spike close order now. Not sure what this means. I notice that there is "Spike Protection" in the inputs however..... 11) Divide buy and sell. inc stop order level, take profit, trailing stops, trailing steps, and indicator parameters. 12) Don't trade the NFP Second friday of the month. Right!? A lot of the time related functions I can borrow from the MegadroidPro code... and avoiding the NFP from the Megadroid James Mod B stuff 13) Don't buy on 4hr downtrend, don't sell on 4hr uptrend. How is trend determined? Indicator? 14) If trade is one hour old and has reached 14 pips twice and is now 14 pips down, close at next break even and sleep 16 minutes. two of the inputs:- extern int DropProtection = 120; extern int SleepAfterDrop = 4320; Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 20, 2009 Author Report Share Posted September 20, 2009 Re: Building your own EA G/08. OK.. I was going to tidy this up and make it shorter but it works so there are more important things for me ATM. Naturally you need to add the trade hour variable at the top. 15 minutes before trade hour close it puts in a trailing stop if the trade is in profit. Otherwise it closes asap after tradehour //-------------------------------------------------------------------------- if ((UseTradeHourClose == true) &&((TimeMinute(TimeCurrent()+15))>= ToHourTrade)&& (TimeMinute(TimeCurrent())<= FromHourTrade)) { total = OrdersTotal(); { for(i = 0; i < total; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if ((OrderType() == OP_BUY) && (OrderSymbol() != Symbol())) continue; // if ((OrderStopLoss()==0) && (Bid > (OrderOpenPrice() + _Point * SL))) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - _Point * SL, OrderTakeProfit(), 0); } } } } //-------------------------------------------------------------------------------------------------------------------------- //Closes orders at the end of trade hour if no trailing stop is set and if order reachs break even price. if((UseTradeHourClose ==true)&& ((TimeHour(TimeCurrent())<= FromHourTrade || TimeHour(TimeCurrent()) >= ToHourTrade))) { total = OrdersTotal(); for(i = total - 1; i >= 0; i--) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() != Symbol()) continue; if((OrderType() == OP_BUY) || (OrderType() == OP_SELL)) { if ((OrderStopLoss()==0) && (((OrderProfit())+ 0.0003) > OrderOpenPrice())) { if(PrintComments) Print("TradeHour over, closed trades!"); glOrderClose(); } } } } //-------------------------------------------------------------------------------------------------------------- The next code needs to be someone else's, just because it is the right thing to do. Aside from the trading style which is half of the equation.. the rest of the success of this EA belongs to the "don't trade now" rules. That will be your own restrictions after the EA thinks it is time to enter the market. Most times it is right but not often enough to keep your account safe.. that is your job. Today I am writing a dynamic trade-hour.. it is so changeable and the trade-hour now would be 4 - 23 Most things need to be dynamic, markets rarely last doing the same thing for long. Quote Link to comment Share on other sites More sharing options...
Rio Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. if ((OrderStopLoss()==0) && (Bid > (OrderOpenPrice() + _Point * SL))) The SL there refers to what exactly? The sell trailing stop external value? I see what you mean for the "don't trade now" rules. If the EA makes one wrong move and your account explodes. what sort of factors do you think would influence a dynamic change in trading hours, especially the first few hours of the day? The Asian market response to an NFP release? Interesting. I need to spend much longer learning bits from the MQL manual so I can completely reverse engineer the code...... I'll get the Megadroid Mod code for no NFP trades up when I get more time. Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 20, 2009 Author Report Share Posted September 20, 2009 Re: Building your own EA G/08. The SL there refers to what exactly? The sell trailing stop external value? I see what you mean for the "don't trade now" rules. If the EA makes one wrong move and your account explodes. what sort of factors do you think would influence a dynamic change in trading hours, especially the first few hours of the day? The Asian market response to an NFP release? Interesting. I need to spend much longer learning bits from the MQL manual so I can completely reverse engineer the code...... I'll get the Megadroid Mod code for no NFP trades up when I get more time. The NFP is one line, could not really be considered code just an instruction...if(DayOfWeek()==5 && Day()<=7)return(0); I have a couple more lines for it just so I could put it in the external settings. SL was just a setting I though I might use if i got greedy.. at the moment it's set stop loss at 15 above order open price. It is not an external because it is not important enough to worry about. The average of the last weeks best trading ours will most times be this weeks best trading hours - 1 hour Quote Link to comment Share on other sites More sharing options...
Lukeye Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. Thanks asgard, now the EA makes less trades . As I understand with this new added code it looks for closing open trades outside of 'FromTradeHour' and 'ToTradeHour', but it still opens trades 24 hours a day. I was not able to figure out why it trades less ?? Quote Link to comment Share on other sites More sharing options...
Lukeye Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. asgard, what are your settings for: UseAcceleratorIndicator UseSpeedIndicator UseFlatIndicator ? Do you set value to 1 and if so do you set their stoploss to 0 ? Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 20, 2009 Author Report Share Posted September 20, 2009 Re: Building your own EA G/08. Thanks asgard, now the EA makes less trades . As I understand with this new added code it looks for closing open trades outside of 'FromTradeHour' and 'ToTradeHour', but it still opens trades 24 hours a day. It should not be opening trades 24hrs.. something is wrong I was not able to figure out why it trades less ?? Yes, right there is the challenges of building your own EA. :o You will need to optimise on the settings once you have your code done and working. My settings will not work for you because they are all based around rules. I can't remember which one but I think it is the AC start frame... makes the difference of a lot of trades. Also setting the iHL limit distance to 9000 instead of 7000 also increases trades on some pairs. This is the steps to optimise it.. 1) Find a period that it can get through. 2) Optimize on that period 3) Go to a difficult period and find out why it fails 4) Write the rules so it can survive and does not lower trades. 5) then optimise the two periods and pick settings that are best for both. BTW.. this will take you hours to do it right.. put the pc in front of the TV. If you have problems comment out all of the new code and then let one out at a time until you find the problem. Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 20, 2009 Author Report Share Posted September 20, 2009 Re: Building your own EA G/08. Something I didn't say.. your rules must suite all market conditions (lots of thinking).. else who knows what will happen tomorrow. The need to be real trading strategy.. Quote Link to comment Share on other sites More sharing options...
Lukeye Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. It should not be opening trades 24hrs.. something is wrong I understand it like this: if an order is open it looks to modify the order outside of 'TradeHour'. Where does it say : dont open trades outside of 'TradeHour' ? Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 20, 2009 Author Report Share Posted September 20, 2009 Re: Building your own EA G/08. I understand it like this: if an order is open it looks to modify the order outside of 'TradeHour'. Where does it say : dont open trades outside of 'TradeHour' ? I didn't give you that, I thought you wrote it.. So, now you need to write a line that says.. something like.. if current time is less than trade start time and greater than trade end time.. mayopendeferorder = false; I need to go now.. its getting late here. See how you go... You will get more/better trades too. Go through some Ea's and see how they did it.. better still get on the metaquotes site and look at the snippets. Quote Link to comment Share on other sites More sharing options...
Lukeye Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. ok i think this should work if((UseTradeHourClose ==true)&& ((TimeHour(TimeCurrent())<= FromHourTrade || TimeHour(TimeCurrent()) >= ToHourTrade))) return; Quote Link to comment Share on other sites More sharing options...
asgard2 Posted September 20, 2009 Author Report Share Posted September 20, 2009 Re: Building your own EA G/08. ok i think this should work Mate, so many people are watching this thread.. only one other participating.. Time to take this elsewhere. PM me.. Quote Link to comment Share on other sites More sharing options...
manganate Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. asgard2, Are you closing this thread after only 2 days? Some of us have only found it (a few hours ago in my case). I haven't examined the original Greezly08 yet. I still haven't finished with Gepard. :)>- Quote When mind lingers in one place efficiency is lost Link to comment Share on other sites More sharing options...
asgard2 Posted September 20, 2009 Author Report Share Posted September 20, 2009 Re: Building your own EA G/08. asgard2, Are you closing this thread after only 2 days? Some of us have only found it (a few hours ago in my case). I haven't examined the original Greezly08 yet. I still haven't finished with Gepard. :)>- Yes, I am about to go into importing the Gepard Logic.. that is why I am closing it. This is one of the important parts. Trust me when I say, the last thing I want is to see a replicated EA on the market for money. I could have done that myself. Some people already sell Greezly (a*h*l*s).. it's free! Too many people watching are keeping their knowledge to themselves and will take the ideas of this thread away without benefiting anyone. That was not my goal! If this is the way it works, I want no part of it. Right now, this thread will do what it is designed to do, which is to give someone a great start if they want. Sorry Mate.... It is not supposed to be an easy ticket for the commercial guys. ( I loath those guys) Of course there is nothing to stop anyone else keeping this thread going. Quote Link to comment Share on other sites More sharing options...
manganate Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. asgard2, No problems. If my Gepard work shows promise I will post in this forum. Quote When mind lingers in one place efficiency is lost Link to comment Share on other sites More sharing options...
⭐ birt Posted September 20, 2009 Report Share Posted September 20, 2009 Re: Building your own EA G/08. ok i think this should work if((UseTradeHourClose ==true)&& ((TimeHour(TimeCurrent())<= FromHourTrade || TimeHour(TimeCurrent()) >= ToHourTrade))) return; For example, if your starting hour is 22 and end hour is 02, it will always return. There are 2 cases: 1. FromHourTrade <= ToHourTrade, in which case what you wrote there works 2. FromHourTrade > ToHourTrade, in which case you have to check the other way around Pay very close attention to using <= vs <. If you use <= there, it will only start trading AFTER the hour you set has passed. If you set FromHourTrade to 14, it will start trading at 15. Also add some GMT offset variable while you're at it and make it into a nice function called something like IsTradeTime() and returning true or false. Quote Link to comment Share on other sites More sharing options...
Lukeye Posted September 21, 2009 Report Share Posted September 21, 2009 Re: Building your own EA G/08. if((UseTradeHourClose ==true)&& ((TimeHour(TimeCurrent())< FromHourTrade+GMTOffSet || TimeHour(TimeCurrent()) >= ToHourTrade+GMTOffSet)))MayOpenDeferOrder = false; This line works for me. Quote Link to comment Share on other sites More sharing options...
Mindsphere Posted September 21, 2009 Report Share Posted September 21, 2009 Re: Building your own EA G/08. Yes, I am about to go into importing the Gepard Logic.. that is why I am closing it. I've only recently found this thread and have barely had a chance to look into Greezly properly. I think many of us here are interested in part-taking in this thread in an open non-commercial fashion. I would ask you to reconsider your decision :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.