expat1967 Posted October 4, 2010 Report Share Posted October 4, 2010 What is the purpose of the ATR indicator in this EA? Is it not true that ATR is redundant since once it has indicated that the market is too volatile, the EA is already in a sometimes substantial loss? The basic I idea of the ATR is to prevent the EA entering trading if no open orders are active. This is simply ruled by the basic of the cable run strategy, which requires to open trades going into a drawdown. Since, I can backtest this strategy now, I have tried already several variations e.g. like hold trading while in drawdown... Will integrate the options in the EA as well. Cheers Quote Link to comment Share on other sites More sharing options...
clovelly Posted October 4, 2010 Report Share Posted October 4, 2010 (edited) The basic I idea of the ATR is to prevent the EA entering trading if no open orders are active. This is simply ruled by the basic of the cable run strategy, which requires to open trades going into a drawdown. To avoid confusion for the newbies, you should rephrase the above :). How can you have the scenario of "if no open orders are active" as "open orders" by definition are active. Also, "the basic of the cable run strategy, which requires to open trades going into a drawdown" is not entirely correct, as CR can happily take profit for any trade that goes the right way by the MinProfit. The purpose of using ATR is NOT to start a NEW trade basket if the volatility is not right (ATR not in certain ranges for the last few bars). If the basket has already been started and active (ie there are active trades) then the EA has no choice but continuing with it, hopefully to get the minimum profit (or if market goes from bad to worse, a drawdown or Stoploss) Edited October 4, 2010 by clovelly tomislav 1 Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 4, 2010 Report Share Posted October 4, 2010 (edited) ...Global Variables to consider (some not yet in the shared version 1.2), though you might not need to worry about that functions: bool SellOrderExists = false; bool BuyOrderExists = false; bool BuyPOExists = false; bool SellPOExists = false; extern int Magic = 128738; //Order Magic Number extern bool UseRandomMagic = false; // To be integrated!!! Switched the Random Magic Number on/off extern int RandomMagicLower = 100000; //Sets the lower Magic Number boundry extern int RandomMagicUpper = 200000; //Sets the upper Magic Number boundry void OnceAnHour() { int datetime800 = TimeLocal(); int hour0 = TimeHour(datetime800); int minute0 = TimeMinute(datetime800); if (hour0 != HourOnce && minute0 == 1) { HourOnce = hour0; RandomMagicNumber(); } } Should be easy enough. I suggest we change that RandomMagicNumber line inside OnceAnHour to the line below (randomization function follows): if(!(SellOrderExists || BuyOrderExists || BuyPOExists || SellPOExists)) RandomMagicNumber(); void RandomMagicNumber() { if(!UseRandomMagic) return(Magic); MathSrand(TimeCurrent()); double random = RandomMagicLower + (RandomMagicUpper-RandomMagicLower) * MathRand()/32768.0; Magic = MathRound(random); //could use MathFloor also, if u prefer } Edited October 4, 2010 by teknomage Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 4, 2010 Report Share Posted October 4, 2010 Should be easy enough. I suggest we change that RandomMagicNumber line inside OnceAnHour to the line below (randomization function follows): if(!(SellOrderExists || BuyOrderExists || BuyPOExists || SellPOExists)) RandomMagicNumber(); void RandomMagicNumber() { if(!UseRandomMagic) return(Magic); MathSrand(TimeCurrent()); double random = RandomMagicLower + (RandomMagicUpper-RandomMagicLower) * MathRand()/32768.0; Magic = MathRound(random); //could use MathFloor also, if u prefer } That was quick, thanks. Challenge here, how can we ensure that the EA recognizes open trades e.g. while MT4 is beeing restarted and the EA gets re-initialized? Shall we log the Magic in a file once changed and read it out once the EA starts up? Your thoughts... Cheers tomislav 1 Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 4, 2010 Report Share Posted October 4, 2010 Yes, that would be wise. Here's some of my own code to make your work easier. Add the first section within init() : int handle=FileOpen("IndoRun_Magic.dat", FILE_CSV | FILE_READ); //or .txt, if you like if(handle>0){ FileReadInteger(handle, Magic); FileClose(handle); } And towards the end of the RandomMagicNumber() function, we should write it: ...... Magic = MathRound(random); //could use MathFloor also, if u prefer //FileDelete("IndoRun_Magic.dat"); // not sure if we'll need this line for now int handle=FileOpen("IndoRun_Magic.dat", FILE_CSV | FILE_WRITE); if(handle>0){ FileWrite(handle, Magic); FileClose(handle); } } tomislav and expat1967 2 Quote Link to comment Share on other sites More sharing options...
jumbo Posted October 4, 2010 Report Share Posted October 4, 2010 Hi Everyone, Great work and thanks to those who've contributed to this thread. It would be fantastic if for those of us who have no programming experience, if the amended EA could be attached as a complete file ready to install to MT4. Thanks in advance Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 4, 2010 Report Share Posted October 4, 2010 It's a work in progress, so be patient. While we wait for Expat to release his version, I've modified and improved the Cable_24H version. Added quite a few new features and I also finally managed to fix that damn Error 130 issue and also fixed the problem regarding the Start & End timings not being adhered to when TelagaEmas (TradeAllDay) is false. I dont want this thread to be flooded with too many different versions, so I'm not gonna post just yet. But for those who're currently trading the original 24h version on demo or Live accounts, let me know if you're SERIOUSLY interested in testing my version; based on the response, I'll upload my mod here. I'm really inclined to trade either my version or Expat's version on a live account. The only thing that worries me is the inherent large drawdowns due to the basic nature of this robot. But optimization did help to a certain extent. Here's a backtest i ran with my 24H optimized version: $2000 deposit with 0.1 lot, from Jan 4th to Sept end 2010. Total Net Profit = $2628 , DD = 1974 and Profit Factor = 3.52 (Gross Profit=3672 and Gross Loss= -1044) The curve looks relatively straight and thats what I like to see! :) http://img691.imageshack.us/img691/1530/cablerun24hinstalivejan.gif Quote Link to comment Share on other sites More sharing options...
jumbo Posted October 4, 2010 Report Share Posted October 4, 2010 Thanks Teknomage. No rush. DD=1974 ouch! almost wiped out the account then? Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 4, 2010 Report Share Posted October 4, 2010 (edited) One important thing I'd like to add is that if one decides to trade real money with this EA (I know I shall very soon) it might be worthy to note that the closing of all trades at the end of the week and starting fresh the next week could be a good idea. Good to avoid deeply entrenched DD on a Monday London Sunrise. Some forward testing? That's an affirmative from me. Edited October 4, 2010 by tomislav Quote Link to comment Share on other sites More sharing options...
gigamax Posted October 4, 2010 Report Share Posted October 4, 2010 Hi teknomage, thanks again for your work. I agree with you we should test 1 version only in order to be aligned with the various comments that can come out. Now I'm going to ask you a probably stupid question : how the algorithm to determine the prices of the first orders set (buy + sell limits) works ? Is its logic similar/functional to the calculation used for the ATRPips? Since we are using ATR to determine if the market is trading and not trending , let me briefly summarize how it works: The Average True Range is a moving average of the True Range, which is the difference between the True Range High and the True Range Low. The current True Range High is the current high or the previous close, whichever is greater. Similarly, the current True Range Low is the current low or the previous close, whichever is lower. 1)Since we are using 3 and 5(4) + current bar values to trigger the trade entry I'd like to know if the entry limit prices (first set of pending limits orders) calculated by the algorithm follow a similar logic or if they are related only to the current bar , 2)Since ATR allows or denies the trade activity : does the EA activate (code) the algorithm calculation only AFTER having been allowed by the ATR rules ? This because of the massive use of CPU and memory by the EA. Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 4, 2010 Report Share Posted October 4, 2010 (edited) I've already added that feature, Tomislav :-) CloseTradesByFridayEOD (end of day) and you can also specify your broker's Friday EOD time @ gigamax: As far as I see, the prices of the first orders are based on the current Bid and Ask, moved away by the number of pips specified in the parameter Step (default=17 pips). So, the calculation is roughly: FirstBuyOrder = Ask - Step(pips) FirstSellOrder = Bid + Step(pips) And to answer your questions: 1)The ATR calculations are just filters/triggers as you put it correctly. And the entry limit trades are based only on the current price/bar as show above. 2) The EA calculates the above two lines BEFORE the ATR filter rules, but computationally, these do not make any difference. As stated before, if you're running Muruku's version, the high CPU usage is due to the redundant while loops and Sleep functions. Edited October 4, 2010 by teknomage tomislav and gigamax 2 Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 4, 2010 Report Share Posted October 4, 2010 (edited) I assume the feature of closing trades on a Friday is going to be featured in your new version? I was actually just prepared to close them manually because the Standard Cable Larikan ok 24hr doesn't have it. Pardon me if I'm stating the obvious it's just that communication really has to be clear on these threads! Probably not going to be the best week for earning as the market usually fizzles to almost a halt leading up to NFP but see how we go anyhow. I have 2 demos running now. Standard Cable Larikan 0k 24 hr on ATR 5 and profit mode 3 Cable Larikan 0k 24 hr with while loop on ATR 5 and profit mode 2 started this week Cable Larikan ok 24hr ATR 7 demo stopped had to much DD anyhow. Cable Larikan ok 24hr with internal ATR mod account expired but also had even more DD so discontinued. Keeping the DD within reason is the key here. If I can double a $3000 demo in a week (Cable Larikan ok 24hr on ATR 5 demo is $6660 equity $7050 - just recovered from -$1,600+ DD-trades open from Friday)) that means I could have done the same with a $300 account using micro-lots. I reckon starting off with $500 on micro-lots is a definite possibility. The demo in mention here was started last Monday on 0.1 lots-no increasing lots. A week... Can't run any more demos than this as PC power is being used up. Indo run 1.2 seems to open up trades in a similar manner to CR musketeer or even like the original Cable Run. Expat mentioned that the next version will feature a strategy option. Would it be fair to guess that a CableLarikan type strategy (cash machine strategy) is going to be featured? Thanks for all the work... amazing. Edited October 4, 2010 by tomislav Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 4, 2010 Report Share Posted October 4, 2010 @ tomislav: Yes, that's right... that feature is in my latest mod. While working on it, I was focusing on making this robot ready for Live trading, because that's my goal, and I'm sure that's what we all wanna do eventually :) @ jumbo: Yeah, its kinda painful to see that kind of drawdown, but then I purposely ran the backtest over this year just to find the lowest possible balance that I could start off with. However, i still feel that this robot should not be traded Live with anything less than $4k to $5k (on a standard account). Quote Link to comment Share on other sites More sharing options...
jumbo Posted October 4, 2010 Report Share Posted October 4, 2010 I've run various EA's on demo a/c for quite some time and I've yet to find one which does the same trades, p/l etc on a live a/c. I sometimes wonder how much use demo trading is? Quote Link to comment Share on other sites More sharing options...
isssac Posted October 4, 2010 Report Share Posted October 4, 2010 Dear Teknomage, I am currently running your version... realised that during the avoid London, NY session (ie: 14:45 - 20:30 gmt+3), pending trades are still available (trades that in the waiting list)... I am not sure if it's suppose to work this way? If not, can you modified so that it close all pending trades while during the 2 sessions? I find it pretty cool that during the avoid sessions, I saw it closing trades which were set according to our profit target! Thanks mate! :) Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 4, 2010 Report Share Posted October 4, 2010 (edited) Yes that's the mission. We can't be on here for the rest of our life. An important question comes to mind. If CableLarikan sucks up so much PC power is there a possibility that it might have some adverse effect on the broker server because of the power that it requires? Muruku has been trading live with it (or similar version) so I presume it's going to be ok. To jumbo... I'm fortunate enough to be with a broker who's demo accounts behave almost exactly the same as a live account. The biggest difference between live and demo happens due to the indicator mechanism of the EA in question. Zig Zag entry is going to be the same but for other types it depends on factors that are beyond my knowledge. Demo and Live are never the same according to Donna Forex but can get very close. Edited October 4, 2010 by tomislav Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 4, 2010 Report Share Posted October 4, 2010 Hey isssac, you're welcome! :) Now about those pending trades, was the main pair of trades still open at that time?? The purpose of the Avoid parameters was to prevent any NEW trades from opening during those time periods. In any case, my latest version is much better (and less buggy) than the previous mod i uploaded... Dear Teknomage, I am currently running your version... realised that during the avoid London, NY session (ie: 14:45 - 20:30 gmt+3), pending trades are still available (trades that in the waiting list)... I am not sure if it's suppose to work this way? If not, can you modified so that it close all pending trades while during the 2 sessions? I find it pretty cool that during the avoid sessions, I saw it closing trades which were set according to our profit target! Thanks mate! :) tomislav 1 Quote Link to comment Share on other sites More sharing options...
isssac Posted October 4, 2010 Report Share Posted October 4, 2010 Hey isssac, you're welcome! :) Now about those pending trades, was the main pair of trades still open at that time?? The purpose of the Avoid parameters was to prevent any NEW trades from opening during those time periods. In any case, my latest version is much better (and less buggy) than the previous mod i uploaded... yup... trades that were opened earlier on remained opened during the 2 avoidance sessions. Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 4, 2010 Report Share Posted October 4, 2010 If CableLarikan sucks up so much PC power is there a possibility that it might have some adverse effect on the broker server because of the power that it requires?... Well, the older versions (i.e. v4 and 24H_ok) will mostly affect the MT4 platform on your local system... as for the server, since these previous versions were prone to Error 130, the robot would continuously try to reopen trades (atleast 36 times, according to the while loop). I'm sure your broker's server wouldn't be very happy about getting 36 open order requests one after the other,on EVERY tick, lol. Which is why i got rid of that in my mods... tomislav 1 Quote Link to comment Share on other sites More sharing options...
jumbo Posted October 4, 2010 Report Share Posted October 4, 2010 Hi Tomislav, Thanks for that. I've been trading live with Figfx. mainly for tight fixed spreads. No real issues with them apart from occasional requote/slippage and they won't allow Shocker EA and one or two others. They hedge 25% of your position. It does make me wonder how reliable they are long term. Who do you use tomislav 1 Quote Link to comment Share on other sites More sharing options...
berusnet Posted October 4, 2010 Report Share Posted October 4, 2010 hi teknomage, this night 22-7 GMT I have run on my demo account your version (post #399) with others two versions (muruku azam). But your version .. 0 trades.(I have check the setting of time limits with borker time and was ok ) Can you upload your last vers ? thanks Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 5, 2010 Report Share Posted October 5, 2010 (edited) Ok, here is the next update of Indo Run => Version 1.2f Pending Order Strategy changed: sell/buy order delete opposite Pending Order for safety (e.g. weekend gap or spikes...) Day and Hour Filter fixed Day and Hour filter gets overide when trades are open Changed ATR Filter Verification to check straight on open trades Order Counter in chart changed to show only open trades Magic Random Number integrated. Current Magic Number and change date/time is shown on chart / thanks to teknomage Magic Number log file to write/read last Magic Number (to be tested) / thanks to teknomage http://www.multiupload.com/9CB9DUXT3Z Next: Strategy Variation Broker loging DD loging Others? Cheers Edited October 5, 2010 by expat1967 Endzone, luigifunk, BobR and 10 others 13 Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 5, 2010 Report Share Posted October 5, 2010 (edited) Forgot ;) Backtest 2010 till end of April... no time to do more just now. 24h no stop out ATR on http://img34.imageshack.us/img34/2779/strategytester.gif Initial deposit 10000.00 Total net profit 2791.34 Gross profit 5423.72 Gross loss -2632.38 Profit factor 2.06 Expected payoff 6.40 Absolute drawdown 150.20 Maximal drawdown 1178.83 (9.95%) Relative drawdown 9.95% (1178.83) Total trades 436 Short positions (won %) 179 (68.72%) Long positions (won %) 257 (66.15%) Profit trades (% of total) 293 (67.20%) Loss trades (% of total) 143 (32.80%) Largest profit trade 94.70 loss trade -100.77 Average profit trade 18.51 loss trade -18.41 Maximum consecutive wins (profit in money) 10 (144.60) consecutive losses (loss in money) 6 (-300.02) Maximal consecutive profit (count of wins) 336.69 (8) consecutive loss (count of losses) -300.02 (6) Average consecutive wins 3 consecutive losses 1 Will need to give it a full run in the optimizer... Cheers Edited October 5, 2010 by expat1967 taipan, TheBeast, tomislav and 4 others 7 Quote Link to comment Share on other sites More sharing options...
⭐ musketeer Posted October 5, 2010 Report Share Posted October 5, 2010 Ok, here is the next update of Indo Run => Version 1.2f Others? Cheers integrating indie inside...? should did faster BT Quote Link to comment Share on other sites More sharing options...
tgt123 Posted October 5, 2010 Report Share Posted October 5, 2010 Ok, here is the next update of Indo Run => Version 1.2f Pending Order Strategy changed: sell/buy order delete opposite Pending Order for safety (e.g. weekend gap or spikes...) Day and Hour Filter fixed Day and Hour filter gets overide when trades are open Changed ATR Filter Verification to check straight on open trades Order Counter in chart changed to show only open trades Magic Random Number integrated. Current Magic Number and change date/time is shown on chart / thanks to teknomage Magic Number log file to write/read last Magic Number (to be tested) / thanks to teknomage http://www.multiupload.com/9CB9DUXT3Z Next: Strategy Variation Broker loging DD loging Others? Cheers Expat1967, Great ! Can this version run on multi pair currency with same IndoRun_Magic.dat file? Thanks. 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.