| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| GU H1 high/low entry system? https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4702 |
Page 5 of 9 |
| Author: | SteveHopwood [ Fri May 20, 2016 9:24 am ] |
| Post subject: | GU H1 high/low entry system? |
It is much simpler than all this and would take me about 30 seconds. I am going out teaching soon but will be back this afternoon, so sing out if you want me to add the relevant code. |
|
| Author: | themaxx [ Fri May 20, 2016 6:33 pm ] |
| Post subject: | GU H1 high/low entry system? |
Yes please Steve! |
|
| Author: | SteveHopwood [ Fri May 20, 2016 7:43 pm ] |
| Post subject: | GU H1 high/low entry system? |
No probs. Sometime this weekend. Don't stop trying to do this stuff for yourself - you will never regret every bit of progress you make, I promise. |
|
| Author: | themaxx [ Fri May 20, 2016 7:45 pm ] |
| Post subject: | GU H1 high/low entry system? |
Thanks Steve will do |
|
| Author: | woodlands [ Sat May 21, 2016 11:42 am ] |
| Post subject: | GU H1 high/low entry system? |
Thanks Maxx and Steve, I have tried a different setting for PH, using MPTM for very tight stop and small TP in the hope of low DD and small return, it is interesting so far but very early days so don't know if there is any mileage. The set files are attached |
|
| Author: | SteveHopwood [ Sat May 21, 2016 12:03 pm ] |
| Post subject: | GU H1 high/low entry system? |
V 1c of both versions are in post 2. Here is some explanation to help you develop your own coding skills. One of the many thingies I have learned from the Proper Coders here is to make code as reusable/adaptable as possible. The void CloseAllTrades(int type) function starting at line 2577 is a flexible close all function. The parameter int type allows me to tell the function which type of order to close/delete. Lines 2591-2596 check that the currently selected order 'belongs' to the EA and that it is of the type that needs closing. OP_BUY is a constant whose value is 0. OP_SELL is a constant whose value is 1. So a call such as: CloseAllTrades(OP_BUY) tells the function to close all buy trades, so the line at 2599 if (OrderType() < 2) closes market trades. The line at 2612: if (OrderType() > 1) tells the function to delete pending orders. I need a way to tell the ea to close/delete everything, so I declare a constant AllTrades at line 23. This call CloseAllTrades(AllTrades) tells the function to make two passes, closing market trades on the first pass and deleting pendings on the second. This is why I wrote that you were overcomplicating things; the code already exists for you. Line 345 declares a boolean, DeletePendingsAfterTradingStops. Line 5615 opens the void DeleteUnfilledStopOrders(). There is code within the function to deal with a deletion attempt at swap rollover time and your broker disables trading during this period. You might want to adjust your last parameter in the tradingHours input. Lines 5851-5873 contain two code blocks that work out whether the bot can trade. 5851 contains the call to Balluda's time check function. 5863 deals with the various individual day trading hours - you probably do not use these. There is a call to DeleteUnfilledStopOrders() in both code blocks. Ta daa. It took me longer to write this post than it took me to add the code. |
|
| Author: | Wavegarrick [ Sat May 21, 2016 12:07 pm ] |
| Post subject: | GU H1 high/low entry system? |
|
|
| Author: | themaxx [ Sat May 21, 2016 1:28 pm ] |
| Post subject: | GU H1 high/low entry system? |
This is excellent Steve, thank you very much. Downloading the IDE now so I can follow all of your line references.
|
|
| Author: | SteveHopwood [ Sat May 21, 2016 1:36 pm ] |
| Post subject: | GU H1 high/low entry system? |
Whilst you are in there, correct one of my copy/paste/forgot-to-edit bloops, spotted by the ever-vigilant Heraclees. Go to line 1782. This code snippet: price = Ask; stop = CalculateStopLoss(OP_BUY, price); take = CalculateTakeProfit(OP_BUY, price); result = SendSingleTrade(Symbol(), OP_BUY, TradeComment, SendLots, price, stop, take); needs to be: price = Bid; stop = CalculateStopLoss(OP_SELL, price); take = CalculateTakeProfit(OP_SELL, price); result = SendSingleTrade(Symbol(), OP_SELL, TradeComment, SendLots, price, stop, take); I have added the fixes to the files in post 2 without changing the version number. |
|
| Author: | themaxx [ Sat May 21, 2016 1:49 pm ] |
| Post subject: | GU H1 high/low entry system? |
Excellent work woodlands! You're starting to see the power of this EA! The EA seems quite dumb when it enters but consider this - if this EA is set to trade when a pair is most active - it will sell the high of the day/ buy the low of the day. If you hold those trades for a few days (and they aren't stopped out), you've caught the high and low of the week, you could catch the high and low of the month, the high and low of the year! And if the pair trended....!!!!! You don't necessarily need pairs that trend, but you MUST have pairs that make big swings - this EA makes its money when the TP matches the pair's swing. So look for pairs with big swings. The original rules were designed so that I could trade them manually, and get some sleep. But if you want to trade other pairs, you could change when the EA stops trading (as you don't want to be trading when volatility is low, as you get chewed up). For example, now the EA is sorted out I'm going to be adding EURJPY and GBPJPY. According to the MATAF.net historical volatility charts, 20-22 GMT are the least volatile times of the day for those pairs - so I will set the EA to sleep during those times. Also, consider bigger take profit targets. On GU last week I think 200 or 250 pips might have done better. Keep it up!
|
|
| All times are UTC | Page 5 of 9 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|