teknomage Posted October 1, 2010 Report Share Posted October 1, 2010 (edited) Sure, I'll do that in the next version, gigamax. But my focus is on trying to get rid of the Errors 130. Can you please make the require adjustments in the GMT timings and try backtesting it on your MT4? Let us know how it goes... Edit: One more thing.. please remember that in this version, all timings are with respect to your broker's. In my case, my broker is GMT +3. So, to stop trading during the Eurpoean/London session (which starts from 6am), the CableRunNOTtoTradeTimeLon1 time would 9 am on my broker's platform, but i set it a little early at 8:45 just to be safe. Hope that clairifies this a bit... Edited October 1, 2010 by teknomage Quote Link to comment Share on other sites More sharing options...
krisware Posted October 1, 2010 Report Share Posted October 1, 2010 (edited) If I'm not wrong then those 130 Errors might not be problem at all, because this error pops out when You try to modify order or set a pending order if current market price is too near (let say less then 5 pips away). You'll need (depends on broker i think) at least 5 pips distance for setting pending order or take profit and 10 pips for setting stoploss (with my broker). For avoiding these problems, You should respond correctly to those errors and check the distance. Anyway correct me If I'm wrong. From MGL4 Doc - ERR_INVALID_STOPS 130 Invalid stops. I could fix this, but maybe somebody is faster, because I do not have time now. Maybe later. "If it gets scary sometimes I'm using hedging (I'm not closing any open orders manually) - lot size about 50-70 % of open lots". Anyway I started demo with 1000 USD deposit on 22.09.2010 and today account Balance is 4529 USD and Capital 3271. Edited October 1, 2010 by krisware Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 1, 2010 Report Share Posted October 1, 2010 (edited) Thanks krisware, but I've already added conditions to ensure that the pending price is not close to the market price. So, the Error 130 might be caused due to something else. The broker's minimum gap is determined by MODE_STOPLEVEL; so, the conditions I added are as follows: ... && MathAbs(NextSLStep-Bid) >= MarketInfo(Symbol(), MODE_STOPLEVEL)*Point) NewOrder(OP_SELLLIMIT, ... ...&& MathAbs(NextBLStep-Ask) >= MarketInfo(Symbol(), MODE_STOPLEVEL)*Point) NewOrder(OP_BUYLIMIT, ... I'm using MathAbs here coz it doesnt really matter if the gap is negative, as long as its absolute value is more than the minimum gap required by the broker (which is MODE_STOPLEVEL) The only thing that I can think of changing is the comparison itself. If you think something else can be improved here, do let us know and i'll test it out... Edited October 1, 2010 by teknomage Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 1, 2010 Report Share Posted October 1, 2010 What would be a way to work around the 130 errors? Can the pending order still set in the step/distance defined? I am using in my version the current ask/bid price + distance which eliminates the error. As a result the distance to the prior orders might differ if the market is ranging quickly, but so far it looks pretty straight. I was thinking in placing a market order in case of an error which might drive better. I am not a coder though... Your ideas? Cheers Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 1, 2010 Report Share Posted October 1, 2010 Yeap the backtest matter is a pain. I find it simply essential to setup/improve an EA at least to check its potential. Therfore I took a different approach ystrdy and started with the CR strategy from scratch since I was not happy with the original CR base. Its my first time approach on coding but EA Generator works just nice and quick for the basics ;) I started from scratch, simply to understand the coding better to add or change some features/safety further ahead (as well day filter, trade SL, cumulative stop, optional filters, independent steps for long/short trades, #Trade Limit...). Currently, the EA is still basic, not optimized and tested below on a varied strategy. While on for 24h some trades might run for months in the basic setup... lets see how to work around this... A timed stop out might just to simple and kill the overall approach. Below my first backtest from 2000 onwards on GBPUSD 1H 0.1Lot 24H ATR starting 10k and 50k 2004. Oops its in two parts ;) Backtests should match forward/live tests after my initial checks. mmmhhh and no order send errors etc... 2000 - Mid April 2004 http://img821.imageshack.us/img821/5826/cablerunprincilpepart1.gif Mid April 2004 - current http://img291.imageshack.us/img291/3351/testergraphz.gif Initial deposit 50000.00 Total net profit 75797.85 Gross profit 215905.30 Gross loss -140107.44 Profit factor 1.54 Expected payoff 9.05 Absolute drawdown 33378.92 Maximal drawdown 52462.86 (53.78%) Relative drawdown 74.72% (49121.28) Total trades 8378 Short positions (won %) 4281 (74.23%) Long positions (won %) 4097 (74.40%) Profit trades (% of total) 6226 (74.31%) Loss trades (% of total) 2152 (25.69%) Largest profit trade 711.98 loss trade -990.88 Average profit trade 34.68 loss trade -65.11 Maximum consecutive wins (profit in money) 37 (18170.96) consecutive losses (loss in money) 37 (-17496.67) Maximal consecutive profit (count of wins) 18170.96 (37) consecutive loss (count of losses) -17496.67 (37) Average consecutive wins 5 consecutive losses 2 Will share later as it is still too raw. Cheers Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 1, 2010 Report Share Posted October 1, 2010 @ krisware: That's cool! Which version/mod of CableRun did you use on your demo? And did you stick to the default settings alone? @ expat1967: Neat results, my friend, even if the drawdowns in between are a little worrisome. Will be looking forward to your version of the robot as well, hopefully soon :-) Quote Link to comment Share on other sites More sharing options...
Mee Posted October 1, 2010 Report Share Posted October 1, 2010 It worked well for 2 days, now I have -62 floating loss. I use : first lot 0.01 inclot 0.0 min profit 15 profitmode 2 tradetime false atr 7 emas false Are you guys having the big drawdown to ??? Quote Link to comment Share on other sites More sharing options...
krisware Posted October 1, 2010 Report Share Posted October 1, 2010 I'm running CableLarikan_ok_24H and CableLarikanMuruku_V4, but as I remember I changed running times in one of them. Anyway, If it gets scary I'm using manual hedging and looking Forex Factory for bad/good news to find a clue if trend is going to be long or not (if hedge is needed or not). I'm going to use it on my demo as long as possible. Quote Link to comment Share on other sites More sharing options...
Mee Posted October 1, 2010 Report Share Posted October 1, 2010 Can you guys put a code into the EA that close all open position if -x% reached? Thank you Quote Link to comment Share on other sites More sharing options...
⭐ pipmaster Posted October 1, 2010 Report Share Posted October 1, 2010 Ok for this week have ended up going ok. Closed off most of the trades manually thought last night woudl have been better leaving the EA going on the GU short. And was a massive draw down on the GU reversal upwards which I closed off all the trades and turned the EA off. What does the ProfitMode mean? Is there a way to change the gap between trades etc? As it seems to open trades on a couple of pips apart and end up with 20 - 30 trades and even at 0.05 if it goes bad with 30 trades going could be massive draw down. Just use MT on the phone and often manage trades while driving on traveling so far up 40% this week with basically minimal effort, is the best week trading I've had, but think I'll definitely decrease risk some what. Using other scalpers and EA's also. Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 1, 2010 Report Share Posted October 1, 2010 This is from a previous posting where I asked the same question... This is what its means extern int ProfitMode = 2; // 0 by pips;1 by profit;2 by totalpips,3 by totalprofit; it is for close order mode ... Lot's of answers come to awareness upon skimming through the entire thread... By the way what does TelegaEmas parameter refer to? I might have missed it because it's becoming a really BIG thread. Quote Link to comment Share on other sites More sharing options...
isssac Posted October 1, 2010 Report Share Posted October 1, 2010 This is from a previous posting where I asked the same question... This is what its means extern int ProfitMode = 2; // 0 by pips;1 by profit;2 by totalpips,3 by totalprofit; it is for close order mode ... Lot's of answers come to awareness upon skimming through the entire thread... By the way what does TelegaEmas parameter refer to? I might have missed it because it's becoming a really BIG thread. TelegaEmas when set to "true", runs 24 hr tomislav 1 Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 1, 2010 Report Share Posted October 1, 2010 (edited) Thanks Isssac Does then CableNotToRunTradeTimes parameter affect TelegaEmas? CableNotToRunTradeTimes is set to false by default. This in plain English means that Cable Run IS running trade times. Only a few parameters but the whole "when this thing trades" has had quite a few posts dedicated to it because of a lack of clarity. Ok then. When TelegaEmas is set to true does CableNotToRunTradeTimes "false" affect TelegaEmas? I appreciate the reply. Tom Edited October 1, 2010 by tomislav Quote Link to comment Share on other sites More sharing options...
Tick4x Posted October 1, 2010 Report Share Posted October 1, 2010 (edited) Tomislav, TelegaEmas settings override CableNotToRunTimes settings. So, if TelegaEmas = True, then the EA runs 24 hours a day independently from CableNotToRunTimes settings. Hope this helps :) Edited October 1, 2010 by Tick4x tomislav 1 Quote Link to comment Share on other sites More sharing options...
gigamax Posted October 1, 2010 Report Share Posted October 1, 2010 Hi, I'd like somebody explain to me how this EA manages TPs. This morning (from 7.05 GMT to 9.36 GMT) the EA opened a total of 8 sell orders (each every 17 pips step as written in the code)then GU was stopping go higher ,so the EA stopped selling .Currently it closed only the last order (the one with the higher sell price) making 60 pips profit. Al other orders are open (loosing a lot).I have the EA setted with a MinProfit=5(pips).I know there is not a SL. Maybe there is a MaxProfit(referred to a single trade)?It's strange but 60 pips are about 50% of the total loss (-17pips x7 trades =-119 pips) the EA was having at the moment it closes the last trade. Appparently the original C****R** didn't trade today at the FPA ! Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 1, 2010 Report Share Posted October 1, 2010 Tick4x, that's not true. Please read through the robot's code before advising someone else. @ Tom: When CableNotToRunTradesTimes is set to True, the robot will NOT trade between CableRunNOTtoTradesTime1 to CableRunNOTtoTradesTime2, IRRESPECTIVE of whether TelagaEmas is true or not... that means it will avoid these times irrespective of whether the robot is running 24 hrs or not (as long as CableNotToRunTradesTimes is TRUE) If you want me to explain it further, let me know... tomislav 1 Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 1, 2010 Report Share Posted October 1, 2010 (edited) @ Gigamax : Got a few questions for ya... 1) Did you notice any closing errors after the last order was closed... i.e. did you notice if the robot was infact trying to close other trades but unsuccessfully? 2) Were you using more than one instance of C**R** on your MT4? 3) Which mod are you using exactly? Depending on which mod you're running, the orders are closed according to the TotalProfit gained. Personally, i think using the code line below is silly, because it assumes that you are running ONLY C**R** and no other robot on metatrader... if ((AccountEquity() >= GlobalVariableGet("OldBalance")... Edited October 1, 2010 by teknomage Quote Link to comment Share on other sites More sharing options...
gigamax Posted October 1, 2010 Report Share Posted October 1, 2010 @ teknomage , about today trades: 1) it seems it has no errors closing pending orders( 1 additionals sell limit closed after about 2 hrs/30 pips from the higher high ); but the the first buy limit (placed together wit the sell limit as first orders this morning) is still opened! 2)no,I'm running 1 instance only 3) larikan_OK_24 Quote Link to comment Share on other sites More sharing options...
gigamax Posted October 1, 2010 Report Share Posted October 1, 2010 Tick4x, that's not true. Please read through the robot's code before advising someone else. @ Tom: When CableNotToRunTradesTimes is set to True, the robot will NOT trade between CableRunNOTtoTradesTime1 to CableRunNOTtoTradesTime2, IRRESPECTIVE of whether TelagaEmas is true or not... that means it will avoid these times irrespective of whether the robot is running 24 hrs or not (as long as CableNotToRunTradesTimes is TRUE) If you want me to explain it further, let me know... @teknomage : is the above comment true for your version only ? Or does it applies to larikan_Ok_24 too ? Quote Link to comment Share on other sites More sharing options...
Tick4x Posted October 1, 2010 Report Share Posted October 1, 2010 Well Teknomage, I am afraid I am using a different version, sorry. Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 1, 2010 Report Share Posted October 1, 2010 (edited) Hmmm, that's strange. Once MinProfit is reached, all Buy/Sell as well as Limit orders have to be closed together according to the code: CloseAllTrades(1, Magic); //1 is for all Sells, SellLimits CloseAllTrades(2, Magic); //2 is for all Buys, BuyLimits About your second question, YES, that's how it works in Larikan_Ok_24h too. My mod does not have a boolean setting called CableNotToRunTradesTimes, but instead, mine does have separate timings for the London and NY sessions which are to be AVOIDED, even if TelegaEmas (or TradeAllDay) = True If you want to be able to see how it works visually, replace this: if (CableNotToRunTradesTimes==true && IsTradeTime(CableRunNOTtoTradesTime1, CableRunNOTtoTradesTime2)) return (0); with my lines below: if (CableNotToRunTradesTimes==true && IsTradeTime(CableRunNOTtoTradesTime1, CableRunNOTtoTradesTime2)){ Comment("\n\n\n+++++++ CableRun is now avoiding timings from "+CableRunNOTtoTradesTime1+" to "+CableRunNOTtoTradesTime2+" ++++++++"); return (0); } Edited October 1, 2010 by teknomage tomislav and gigamax 2 Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 1, 2010 Report Share Posted October 1, 2010 tecknomage what do you think of muruku's WHILE loop for closing trades more efficiently? if (Pips >= MinProfit){ while(MyOrdersTotal(Magic) != 0) { CloseAllTrades(1, Magic); CloseAllTrades(2, Magic); DeletePendingOrders(Magic); } And then he posted this: muruku:Let's modify based on your code. DONE ! Happy pips ! double Pips = TotalProfit(Magic); if (Pips > MinProfit){ while(MyOrdersTotal(Magic) != 0) { DeletePendingOrders(Magic); CloseAllTrades(0, Magic) } } I tried to put them in myself but I'm not good at this. Any thoughts? If so can you tell me how to place within the coding? I believe they're two versions of the same set of strings. Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 2, 2010 Report Share Posted October 2, 2010 Hi Tomislav. The only code i see related to timeframes is PERIOD_M15 and this is used when calling ATR_Pips. The robot itself will trade on any chart timeframe that you drop it onto, but the the ATRs will calculate only on M15 As for the WHILE loop, the second one is better because it closes according to TotalProfit and not the previously used GlobalVariable OldBalance. In the other half of the code, theoretically, CloseAllTrades(0,Magic) does the same thing as CloseAllTrades(1) and (2) together... in simple words, 0 closes ALL trades, whereas (as I had explained in some of the code before), 1 closes only Sells/SellLimits while 2 only closes Buys/BuyLimits. So, as far as the CloseAllTrades lines go, it doesnt matter which variation you use... Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 2, 2010 Report Share Posted October 2, 2010 By the way, when you guys change ATR to 5 or 7, are you changing the robot's ATR_Period parameter or are you manually changing the value within the ATR_Pips indicator code and then and compiling itself? Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 2, 2010 Report Share Posted October 2, 2010 (edited) Thanks teknomage I inputted both sets of lines in before unsuccessfully but I'll have another go This is original coding CloseAllTrades(1, Magic); CloseAllTrades(2, Magic); GlobalVariableSet("OldBalance", 0); } // latest by muruku /* double Pips = TotalProfit(Magic); ----------this is entry to modify yes? if (Pips > MinProfit){ DeletePendingOrders(Magic); CloseAllTrades(0, Magic) } */ ------------do I keep asterisk and forward slash? if (TelagaEmas) ActiveTime = " Active 24 hrs collecting $ "; if (!TelagaEmas) ActiveTime = TimeToStr(StrToTime(CableRunEndTime+":00")+ 5*3600,TIME_MINUTES); I've included lines above and below. Original coding has asterisk and forward slash at the end. Do I have to include this or can I just enter it as is? As for ATR pips indicator the parameter on EA is set to 5 and I drag the ATR pips indicator onto the chart and set to 5. I don't care if I don't need to I don't want to second guess when it comes to Forex. New coding... double Pips = TotalProfit(Magic); if (Pips > MinProfit){ ----------- do I keep this space in between lines? while(MyOrdersTotal(Magic) != 0) { DeletePendingOrders(Magic); CloseAllTrades(0, Magic) } } -------------- do i keep both of these brackets? Do I enter this set of strings in exactly the same place as original set? Pardon the elementary questions as I just want to get it right and then I'll be done. Edited October 2, 2010 by tomislav 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.