teknomage Posted October 2, 2010 Report Share Posted October 2, 2010 (edited) Let me know which version you're trying to modify so I can help you better.. I assume it's _OK_24h ? For the CloseAllTrades code, you'll need to add an extra brace at the end. There should be a closing flower bracket } for every open flower bracket { . Make it like this: double Pips = TotalProfit(Magic); if (Pips >= MinProfit){ while(MyOrdersTotal(Magic) != 0) { CloseAllTrades(0, Magic); DeletePendingOrders(Magic); } } About the other lines you put up, those are just meant for displaying info on your chart. You can add or leave those ActiveTime lines as they are... it's just good to know what the robot is up to :-) Edited October 2, 2010 by teknomage tomislav 1 Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 2, 2010 Report Share Posted October 2, 2010 (edited) Yep it's ok 24hr. I actually copied and pasted the code from this thread into the MQ4 file in my initial attempts. Is it better if I manually input each character? Man... thanks for your help... I really appreciate it! I just put up those other lines so you could tell where I was inside the file. Awesome. P.S Is it ok to change the name of the MQ4 file from Cable Run larikan ok 24 HR to something a little different so I can tell which is which? Edited October 2, 2010 by tomislav Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 2, 2010 Report Share Posted October 2, 2010 No worries, mate. I too struggled as a beginner a while ago :-) From the point of view of the code, it doesnt matter if you copy-paste it... but if you want to slowly get a hang of coding in MQL4, i'd suggest you type it out and try to understand the code as you go along. If you still have trouble with the code or if you want to make minor alterations, feel free to p.m. me. And yes, sure you can name it anything else.. just do the usual File->Save As, give it a different name and then make sure you try compiling it, otherwise it wont appear inside your MT4. Quote Link to comment Share on other sites More sharing options...
mrcrow Posted October 2, 2010 Report Share Posted October 2, 2010 hi teknomage, where can i find a list of functions for mt4, after having a quick look at cable run it seems to run on doji, please correct me if i am wrong. double Pips = TotalProfit(Magic); is double, double number? so pips is equal to total profit? if (Pips >= MinProfit){ pips is greater than or equal to mini? while(MyOrdersTotal(Magic) != 0) { is this a do while loop? and magic number is returned? CloseAllTrades(0, Magic); close all trades, not sure what the parrameter magic means? 0 means all trades? DeletePendingOrders(Magic); all orders delete, with the parrameter magic, is, magic a variable that has a number stored, or is it a number that is returned on the ui. } i am new to this, as tom showed me some ea's and they seem to work in the correct enviorment. just want to know if i am reading it right. Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 2, 2010 Report Share Posted October 2, 2010 Hi mrcrow, here you go: http://docs.mql4.com/ You read most of the code right, but no, it doesnt run on Doji. The candlestick analyser is just for display purposes on the chart, which is where you might see DojiAtBottom or BullishEngulfing, etc etc And about this line : while(MyOrdersTotal(Magic) != 0) { The While loop doesnt return the MagicNumber... Magic is used by the function MyOrdersTotal to check if we still have any orders open. What this simply means is that the loop will try to continually close all open and pending trades until none are left. Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 2, 2010 Report Share Posted October 2, 2010 (edited) ATTENTION for all those who're using ok_24H version! This is regarding the TotalProfit function and how it behaves based on the ProfitMode. When i looked at the code closely, i noticed that MinProfit is set to 1.5 in the 24H version, while the default for ProfitMode is set to 3, which counts the Total Profit in DOLLARS not pips. These default settings ASSUME that your lot size is always 0.1, but this will not make sense, especially if you choose to vary your lot sizes. If you wish to continue using the default settings (i.e. ProfitMode=3), then please use your common sense and set MinProfit accordingly, keeping FirstLot in mind! Personally, I'd rather use ProfitMode=2, since this counts the sum of the total PIPS gained, irrespective of the lot size I use. Since we're focusing on GBPUSD (or for that matter, any XXX/USD pair), Total Pips is more than enough for me. If you use ProfitMode=2, then set MinProfit to 15 (which was the original setting... although I have seen some ppl here using MinProfit=5 successfully also) Don't set ProfitMode=0 or 1... it's unnecessary, IMHO. If anyone wants to know why, go through the code first and then question me. OK, I need to take a break NOW Edited October 2, 2010 by teknomage domonkos and tomislav 2 Quote Link to comment Share on other sites More sharing options...
muruku Posted October 2, 2010 Report Share Posted October 2, 2010 CR in FPA this week 334 pips.. & i got 300 pips. Quote Link to comment Share on other sites More sharing options...
mrcrow Posted October 2, 2010 Report Share Posted October 2, 2010 teknomage thanks! Quote Link to comment Share on other sites More sharing options...
muruku Posted October 2, 2010 Report Share Posted October 2, 2010 Since last week, my FF browser kept crashing like nobody bz .. still not solving, .. anyway, back to our topic of CR.. We discussed abt good features & strategies need in CR that I keep in short as for now.. - hidden TP (X000 pips ) & SL (200), we not suppose to TP any of open winning positions (NO!), they are needed to compensate losing end of open trades. When Pips >= MinProfit, all the +/- positions MUST be closed immediately using my while loop.. I suggest 200 pips SL or more depends on your equity in case you have no choice but need to slam some too negative positions using the EA. - dynamic magic ID within-range generation, make sure debug the code I shared, ( i found little bugs) as when the magic # attached to each order not within the range, the EA lose control to them (not able to close these orders).. this is damn good feature to hopefully conFUSE the broker. - ATR_pips although very useful to determine ranging/quiet market to enter the trades, but storm comes after the quiet..especially 8-12pm NY session.. i have up to 13 fury open trades up to -1000 pips while hit by 29-Sep, 10:00am USD GDP news.. , luckily i was able to escape with + pips.. be safe is having the EA off during this critical hrs.. you may want to write some logic like below to prevent the EA to open more buy/sell limit when you were in dilemma of opening trades more then 5 ? if (MyOrdersTotalActive() >= 5) return(0); //to prevent the EA to open more buy/sell limit ? so, the precaution is NOT to have multiply lots like 0.1, 0.2, 0.4 or increment lot 0.10,0.11,0.12,0.13 that some folks had suggested before .. that will blow your equity anytime ! You can have larger fixed lot size during Asian/Euro Session & maybe more than 1 instance, but be play safe to switch back to smallest lot, 1 instance during NY session. - I also mentioned abt monitoring DIFF of your local PC time vs your Broker server time after taken consideration adding the offset.. the delays shouldn't more than 100s.. if yes, do the sendmail features.. - Print out all your vital variables on screen useful for displaying purposes & debugging logic flaws as well .. this EA is heavily managing its range of magic # on subroutines like TotalProfit(), MyOrdersTotalActive() or MyOrdersTotal()... like case if dynamic magic # not managing its positions properly, MyOrdersTotalActive() or MyOrdersTotal() will not show the correct qty of trades.. Comment("\n\n\n******* CABLERUN COLLECTING $$ WEALTH $$ IN ACTION *********" +"\n" +" M15 ATR PrePips2 = ", ATRPrePips2," for period of ",ATRPeriod2," (",ATRDnLimit1,"<=x<=",ATRUpLimit1,") or (",ATRDnLimit2,"<=x<=",ATRUpLimit2,") or (",ATRDnLimit3,"<=x<=",ATRUpLimit3,")" +"\n" +" M15 ATR PrePips1 = ", ATRPrePips1," for period of ",ATRPeriod1," (",ATRDnLimit1,"<=x<=",ATRUpLimit1,") or (",ATRDnLimit2,"<=x<=",ATRUpLimit2,") or (",ATRDnLimit3,"<=x<=",ATRUpLimit3,")" +"\n" +" M15 ATR Pips = ", ATRPips," for period of 0 (",ATRDnLimit1,"<=x<=",ATRUpLimit1,") or (",ATRDnLimit2,"<=x<=",ATRUpLimit2,") or (",ATRDnLimit3,"<=x<=",ATRUpLimit3,")" +"\n" +" Total Pips = ", DoubleToStr(Pips,0) +"\n" +" Active Orders = ", MyOrdersTotalActive() +"\n" +" Total Orders = ", MyOrdersTotal() +"\n" +" Magic = ", Magic, " (",MagicRangeLow," <= Magic <= ",MagicRangeHigh,")" +"\n" +" Active until = ", ActiveTime +"\n" +" PriceComment = "+ PriceComment +"\n" +" CandleStick Pattern = ", CandleStick_Analyzer() +"\n" +" Local Current Time = ", Local_Time +"\n" +" Fx Server Time = ", Server_Time +"\n" +" DIFF = ", Diff," seconds" ); What else more ? that's the thoughts of the week .. basically as mentioned above should be needed as a typically scalper EA like CR .. Azam, clevereto all folks that had been following with this threads (not active nowadays, i dun know why) should be earning a lot happy pips by now. So, i wish all happy pips to all by now. ( I consider this is my last comment on this thread ) isssac 1 Quote Link to comment Share on other sites More sharing options...
gigamax Posted October 2, 2010 Report Share Posted October 2, 2010 muruku, thanks again for all your work. your comment are so useful .....please don't give up Quote Link to comment Share on other sites More sharing options...
TheBeast Posted October 2, 2010 Report Share Posted October 2, 2010 ...Its my first time approach on coding but EA Generator works just nice and quick for the basics ;)... ...Will share later as it is still too raw.... Good effort Expat1967! I've been trying too in EA Generator but it keep opening new buy/sell limits every new bar. Do you know how to have it base it on the price you first start the EA please? Many thanks in advance, John Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 2, 2010 Report Share Posted October 2, 2010 (edited) Try IF ORDER DOES NOT EXITS. That should cure it. Below is for indication only. It does not reflect the further layout of the EA. http://img337.imageshack.us/img337/6941/indorunlayout.jpg Edited October 2, 2010 by expat1967 Quote Link to comment Share on other sites More sharing options...
TheBeast Posted October 2, 2010 Report Share Posted October 2, 2010 Thanks! Will give that a go. Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 2, 2010 Report Share Posted October 2, 2010 (edited) Here we go... Attached is, lets call it Indo Run. The EA is still raw and needs further trimming. At least, we can try the basics and filter options... Thus, appreciating your constructive feedback ;) Edit: You might focus on the 24h setup first. The timed version does not place the Pending Orders correctly while starting and having open trades. http://www.multiupload.com/Q7YAPZ5C6S This version: - Individual Order TP and SL - Cumulated SL based on Currency - Cumulated TP based on Currency - Day Filter - Time Filter - Timed Stop out of orders - ATR on/off with variuos switches below to test (closing of pending orders/buy or sell orders...) - Fully backtestable on Every Tick Mode/Control Mode can be used for indication - Essential Infos on Chart e.g. Filter and Trading Status - Emergency closing of all open orders via manuell switch Next Version: - Strategy Variations - Random Magic Number - EA Fine Tuning/Optimization and Code cleanup;) - Revised Pending Order Strategy - Tick delay monitoring/logging - Filters for processing safety extern string EAName = ""; //Comment for your orders, you might better leave it empty ;) 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 extern bool Monday = true; extern bool Tuesday = true; extern bool Wednesday = true; extern bool Thursday = true; extern bool Friday = true; extern bool Saturday = false; extern bool Sunday = false; extern bool Trading24h = true; extern int HoursFrom = 20; //Start Trading Hour in GMT extern int HoursTo = 13; //Stop Trading Hour in GMT extern double ProfitAllOrders = 12; //Cumulated Sell Order Take Profit in Account Currency !!! Divide by 10 if using 0.01 Lotsize => 1.2 extern int OpenOrdersLimit = 0; //Limits the number of open orders + 2 Pending Orders extern int SingleOrderSL = 0; //Stop Loss of each individual Order in Pips extern int SingleOrderTP = 0; //Take Profit of each individual Order in Pips extern int PriceOffset = -17; //Step/Gap in Pips where Pending Order is placed to current price extern double Lots = 0.1; extern bool TimedStop = false; //Switches Time to close all open orders once a day on/off extern int StopHour = 14; //Timed Stop Hour in GMT extern int StopMinute = 0; //Timed Stop Minute extern bool ATROn = true; //Switches ATR Filter on/off extern int ATR_Period = 7; //extern int ATRPipsLimit = 17; //not referenced... extern double ATRPeriod1 = 3.0; extern double ATRPeriod2 = 5.0; //or 4 extern double ATRUpLimit1 = 13.0; extern double ATRDnLimit1 = 7.0; extern double ATRUpLimit2 = 21.0; extern double ATRDnLimit2 = 16.0; extern double ATRUpLimit3 = 28.0; extern double ATRDnLimit3 = 25.0; extern bool DeletePOATR = true; // Switch to delete all pending orders while ATR is active extern bool DeleteOrderATR = false; // Switch to close all open orders while ATR is active (disabled due to current strategy set extern int Slippage=4; extern bool LossStopOutOn = false; //Switches Cumulated Loss Stop Out On on/off extern int LossStopOut = -5000; // Cumulated Loss in Account Currency which will close all open orders extern bool CloseAllTrades = false; // Closes all open orders 2010 Backtest on Control Points! Better use Every Tick mode but that will take some time... http://img816.imageshack.us/img816/2779/strategytester.gif Initial deposit 50000.00 Total net profit 7327.68 Gross profit 15344.10 Gross loss -8016.41 Profit factor 1.91 Expected payoff 8.75 Absolute drawdown 3579.63 Maximal drawdown 5134.56 (9.96%) Relative drawdown 9.96% (5134.56) Total trades 837 Short positions (won %) 407 (70.52%) Long positions (won %) 430 (67.67%) Profit trades (% of total) 578 (69.06%) Loss trades (% of total) 259 (30.94%) Largest profit trade 366.74 loss trade -423.88 Average profit trade 26.55 loss trade -30.95 Maximum consecutive wins (profit in money) 11 (1144.39) consecutive losses (loss in money) 11 (-1215.65) Maximal consecutive profit (count of wins) 1144.39 (11) consecutive loss (count of losses) -1215.65 (11) Average consecutive wins 4 consecutive losses 2 Cheers Edited October 3, 2010 by expat1967 Jarora, tgt123, ⭐ musketeer and 6 others 9 Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 3, 2010 Report Share Posted October 3, 2010 (edited) @ Muruku: Thank you for all your contribution to the development of this robot!! You've inspired quite of a few of us here to take this baby further.. @ expat1967: Neat code, mate! One thing though about ATR_Pips (not really sure if you purposely wanted it this way or not): In the ATRPrePips lines, you haven't specified ATR_Period in the parameters. If the user sets ATR_Period to something other than 7 (say 5), then ATRPips will calculate the ATR using 5, while ATRPrePips1 & 2 will be calculated using the default of the ATR_Pips indicator (which is either 14 or 7, depending on whether the user has the original ATR_Pips indi or if he got it from this thread respectively). Isnt it better to just use ATR_Period in all 3 lines? Just my 2 cents... By the way, i notice your code uses TimeLocal. During a backtest, MT4 will either use your PC's local time at THAT moment when you were backtesting OR it'll use the broker's time (i really have yet to confirm this), but in the latter case, the backtest will only be valid for someone who lives in the same timezone as their broker. If I'm wrong, please correct me... @ Mrcrow, since you're new here, just FYI... you can thank someone by clicking the Thanks icon on that person's post. It's called givin' KUDOs, hehe teknomage thanks! Edited October 3, 2010 by teknomage Quote Link to comment Share on other sites More sharing options...
tgt123 Posted October 3, 2010 Report Share Posted October 3, 2010 Here we go... Attached is, lets call it Indo Run. The EA is still raw and needs further trimming. At least, we can try the basics and filter options... Thus, appreciating your constructive feedback ;) Edit: You might focus on the 24h setup first. The timed version does not place the Pending Orders correctly while starting and having open trades. http://www.multiupload.com/Q7YAPZ5C6S This version: - Individual Order TP and SL - Cumulated SL based on Currency - Cumulated TP based on Currency - Day Filter - Time Filter - Timed Stop out of orders - ATR on/off with variuos switches below to test (closing of pending orders/buy or sell orders...) - Fully backtestable on Every Tick Mode/Control Mode can be used for indication - Essential Infos on Chart e.g. Filter and Trading Status - Emergency closing of all open orders via manuell switch Next Version: - Strategy Variations - Random Magic Number - EA Fine Tuning/Optimization and Code cleanup;) - Revised Pending Order Strategy - Tick delay monitoring/logging - Filters for processing safety extern string EAName = ""; //Comment for your orders, you might better leave it empty ;) 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 extern bool Monday = true; extern bool Tuesday = true; extern bool Wednesday = true; extern bool Thursday = true; extern bool Friday = true; extern bool Saturday = false; extern bool Sunday = false; extern bool Trading24h = true; extern int HoursFrom = 20; //Start Trading Hour in GMT extern int HoursTo = 13; //Stop Trading Hour in GMT extern double ProfitAllOrders = 12; //Cumulated Sell Order Take Profit in Account Currency !!! Divide by 10 if using 0.01 Lotsize => 1.2 extern int OpenOrdersLimit = 0; //Limits the number of open orders + 2 Pending Orders extern int SingleOrderSL = 0; //Stop Loss of each individual Order in Pips extern int SingleOrderTP = 0; //Take Profit of each individual Order in Pips extern int PriceOffset = -17; //Step/Gap in Pips where Pending Order is placed to current price extern double Lots = 0.1; extern bool TimedStop = false; //Switches Time to close all open orders once a day on/off extern int StopHour = 14; //Timed Stop Hour in GMT extern int StopMinute = 0; //Timed Stop Minute extern bool ATROn = true; //Switches ATR Filter on/off extern int ATR_Period = 7; //extern int ATRPipsLimit = 17; //not referenced... extern double ATRPeriod1 = 3.0; extern double ATRPeriod2 = 5.0; //or 4 extern double ATRUpLimit1 = 13.0; extern double ATRDnLimit1 = 7.0; extern double ATRUpLimit2 = 21.0; extern double ATRDnLimit2 = 16.0; extern double ATRUpLimit3 = 28.0; extern double ATRDnLimit3 = 25.0; extern bool DeletePOATR = true; // Switch to delete all pending orders while ATR is active extern bool DeleteOrderATR = false; // Switch to close all open orders while ATR is active (disabled due to current strategy set extern int Slippage=4; extern bool LossStopOutOn = false; //Switches Cumulated Loss Stop Out On on/off extern int LossStopOut = -5000; // Cumulated Loss in Account Currency which will close all open orders extern bool CloseAllTrades = false; // Closes all open orders 2010 Backtest on Control Points! Better use Every Tick mode but that will take some time... http://img816.imageshack.us/img816/2779/strategytester.gif Initial deposit 50000.00 Total net profit 7327.68 Gross profit 15344.10 Gross loss -8016.41 Profit factor 1.91 Expected payoff 8.75 Absolute drawdown 3579.63 Maximal drawdown 5134.56 (9.96%) Relative drawdown 9.96% (5134.56) Total trades 837 Short positions (won %) 407 (70.52%) Long positions (won %) 430 (67.67%) Profit trades (% of total) 578 (69.06%) Loss trades (% of total) 259 (30.94%) Largest profit trade 366.74 loss trade -423.88 Average profit trade 26.55 loss trade -30.95 Maximum consecutive wins (profit in money) 11 (1144.39) consecutive losses (loss in money) 11 (-1215.65) Maximal consecutive profit (count of wins) 1144.39 (11) consecutive loss (count of losses) -1215.65 (11) Average consecutive wins 4 consecutive losses 2 Cheers Dear expat1967, Thank you expat1967 ! you are so generous to share the EA!! And thanks again, we are waiting for your time filter and random magic number version!! Thanks tomislav 1 Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 3, 2010 Report Share Posted October 3, 2010 @ Muruku: Thank you for all your contribution to the development of this robot!! You've inspired quite of a few of us here to take this baby further.. @ expat1967: Neat code, mate! One thing though about ATR_Pips (not really sure if you purposely wanted it this way or not): In the ATRPrePips lines, you haven't specified ATR_Period in the parameters. If the user sets ATR_Period to something other than 7 (say 5), then ATRPips will calculate the ATR using 5, while ATRPrePips1 & 2 will be calculated using the default of the ATR_Pips indicator (which is either 14 or 7, depending on whether the user has the original ATR_Pips indi or if he got it from this thread respectively). Isnt it better to just use ATR_Period in all 3 lines? Just my 2 cents... By the way, i notice your code uses TimeLocal. During a backtest, MT4 will either use your PC's local time at THAT moment when you were backtesting OR it'll use the broker's time (i really have yet to confirm this), but in the latter case, the backtest will only be valid for someone who lives in the same timezone as their broker. If I'm wrong, please correct me... ALso, one last thing: why have the pending orders been set to expire after only 1 hour? int expire = TimeCurrent() + 60 * 0; In this case, wont the pending orders expire and then new ones be opened again at the same prices?? @ Mrcrow, since you're new here, just FYI... you can thank someone by clicking the Thanks icon on that person's post. It's called givin' KUDOs, hehe Yeap, as said the EA is still raw and sure have some bugs to be ironed. However lets get started somewhere. The time setting attaches to the broker time. Can be automated later. Anyway, I mentioned already not to use the time (counts as well for the weekday filter). Need to change the pending order placement first. The pending orders do not expire ...+60*0 is 0. For the ATR Period I did use your code and it works fine as per my checks double ATRPips =iCustom(NULL,PERIOD_M15,"ATR_Pips",ATR_Period,0,0);// by teknomage I have made a brief optimization run just now and can tweak it to a Profitfactor of 5!!! and DD of 3% (5k start account)!!! Just now I am trying a 10 year backtest an it looks great so far over the first 6 years ;) Oh, still a long way to go with this EA. Sure with all the support here we can make something happen. Cheers Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 3, 2010 Report Share Posted October 3, 2010 Sounds great! Let me know if you'd like any help with the coding... Quote Link to comment Share on other sites More sharing options...
tomislav Posted October 3, 2010 Report Share Posted October 3, 2010 (edited) What's the difference between results of profit factor 5 compared to profit factor 15? Cheers Edited October 3, 2010 by tomislav Quote Link to comment Share on other sites More sharing options...
hypernics Posted October 3, 2010 Report Share Posted October 3, 2010 If you still got error 130, try this: gd_124 = FindLastSellPrice(Magic);// GetLastSellPrice(Magic); gd_132 = FindLastBuyPrice(Magic);// GetLastBuyPrice(Magic); if (gd_124 < Bid) gd_124 = Bid; if (gd_132 > Ask) gd_132 = Ask; Quote Link to comment Share on other sites More sharing options...
teknomage Posted October 3, 2010 Report Share Posted October 3, 2010 tomislav, some say that Profit Factor = Gross Profit / absolute Gross Loss , but I think the correct formula is: (profit - commission)/(max drawdown + commission) The higher the Net Profit and the lower the Drawdown, the better the Profit Factor will be... radicaltour and tomislav 2 Quote Link to comment Share on other sites More sharing options...
⭐ musketeer Posted October 3, 2010 Report Share Posted October 3, 2010 Yeap, as said the EA is still raw and sure have some bugs to be ironed. However lets get started somewhere. The time setting attaches to the broker time. Can be automated later. Anyway, I mentioned already not to use the time (counts as well for the weekday filter). Need to change the pending order placement first. The pending orders do not expire ...+60*0 is 0. For the ATR Period I did use your code and it works fine as per my checks double ATRPips =iCustom(NULL,PERIOD_M15,"ATR_Pips",ATR_Period,0,0);// by teknomage I have made a brief optimization run just now and can tweak it to a Profitfactor of 5!!! and DD of 3% (5k start account)!!! Just now I am trying a 10 year backtest an it looks great so far over the first 6 years ;) Oh, still a long way to go with this EA. Sure with all the support here we can make something happen. Cheers Hi expat, The backtest goes almost forever... (every tick's based). But I do really really think that's a good idea to add in the code some logging function - it must write in a file every N minutes (customizable) some info like: balance, equity, P/L, free, used margin, math P/L / equity.... etc that will give EXACT info of the DD Quote Link to comment Share on other sites More sharing options...
expat1967 Posted October 3, 2010 Report Share Posted October 3, 2010 Sounds great! Let me know if you'd like any help with the coding... You are very welcome to help. Having the EA structured in Function Blocks should make it easy to coordinate. I am focusing on getting the pending order Strategy optimized and the day/hour filters sorted. If you want you can look into the Random Magic Number Function: My basic idea: To check and change every hour if no Buy/Sell Order and Pending Order exists to support the 24h setup, e.g. while ATR is filtering. If, then change Magic Number. I guess the Random Code by muruku can be simplified towards this setup. The once an hour function is below as well, nut no need to worry about. If you need local variables just define them within the RandomMagicNumber() itself. The RandomMagicNumber() should return e.g. Magic=182738 accordingly. Let me consolidate it then in the overall code with the required functions call to and from. 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(); } } void RandomMagicNumber() // by teknomage { } Cheers Quote Link to comment Share on other sites More sharing options...
Prometheus Posted October 3, 2010 Report Share Posted October 3, 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? Quote Link to comment Share on other sites More sharing options...
mister23 Posted October 3, 2010 Report Share Posted October 3, 2010 tomislav, some say that Profit Factor = Gross Profit / absolute Gross Loss , but I think the correct formula is: (profit - commission)/(max drawdown + commission) The higher the Net Profit and the lower the Drawdown, the better the Profit Factor will be... i've calculated and come up with it correctly... profit factor = gross profit / gross loss ... basically a win-loss ratio. because pf 1.00 means your money is what you started with. tomislav 1 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.