| 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 6 of 9 |
| Author: | guptabhk [ Fri May 27, 2016 5:08 am ] |
| Post subject: | GU H1 high/low entry system? |
Hi. still I am getting error code 130 on few products like GBPNZD,NZDUSD,OIL,GOLD etc , I changed Hi Low buffer pips to 10 , then also it comes Is there anybody who also face the same? and any remedies please ? thanks in advance |
|
| Author: | smpcoe [ Sat May 28, 2016 6:34 am ] |
| Post subject: | GU H1 high/low entry system? |
This might help http://www.stevehopwoodforex.com/phpBB3 ... 70#p140807 Stan |
|
| Author: | guptabhk [ Sun May 29, 2016 3:21 am ] |
| Post subject: | GU H1 high/low entry system? |
Thanks smpcoe . even though Steve coded 130 error solution in pip hunter, still problem persists , i think i have to enter manually at that time . anyhow thanks for your reply and link. |
|
| Author: | themaxx [ Fri Jun 03, 2016 4:09 pm ] |
| Post subject: | Code my H1 high/low entry system? |
Hi, could someone please give me a steer in the right direction? I'm trying to amend the code so that the EA only opens one trade in each direction. Currently the EA opens a new trade in each direction every day, I want to change it so that if there is an long open from yesterday, it won't open a new long today. I thought I could do this by commenting the code as set out below, but I tried it this morning and I still got new trades. Am I missing something please? I stepped through the code in my head and can't see what I'm missing.
|
|
| Author: | SteveHopwood [ Fri Jun 03, 2016 6:32 pm ] |
| Post subject: | Code my H1 high/low entry system? |
I will show you what to do in time for next week. |
|
| Author: | SteveHopwood [ Fri Jun 03, 2016 9:55 pm ] |
| Post subject: | GU H1 high/low entry system? |
Here beginneth the lesson. Use the attached PH so we are both talking about the same line numbers. CountOpenTrades() sets the variable BuyOpen to 'true' if there is a market buy trade and SellOpen to 'true' if there is a market sell trade open. Ditto Buy/SellStop trades - BuyStopOpen etc. Look at lines 1633 - 1655. These lines are saying, "If there are neither a market buy or a pending buy stop trade in place, then send some sort of long trade. Taking a buy trade as an example, line 2076 finds a market buy trade open, and so sets BuyOpen to 'true'. That takes care of line 1633. The code will abort here if there is an open market buy. Then line 2965 detects a buy stop on the chart and sets BuyStopOpen to 'true'. So, if the filter at 1633 passed, then that at 1644 will fail and the bot will not attempt to take a trade. The code will only continue if there are no sort of buy related trades on the platform. Suppose, as does PH, you have extra filters that only apply to trading in one specific direction. That is where the block starting at 1639 comes in. They stop any long trade that fails any of the filters that are applied to it. Here is where you can add your own. Stochastic not the correct value? Add it here. You mistakenly favourite CCA (I am sure this does not apply to you)? Add it here. Suppose you do not want a new buy trade today after one has already closed? You define a new function, say bool HasTradeAlreadyClosedToday(int type) - where type == OP_BUY. This iterates through the History tab and returns 'true' if it finds a market buy trade that closed today and 'false' if not. Then: Code: Select all Mind, you then get into the pain of what is 'today' to you and 'today' to your broker. Your OrderCloseTime() is 'today' or 'yesterday' etc to your broker; it may well have fuck all to do with 'today' or 'yesterday' etc to you. Global Prime, for example, starts a new D1 candle at 22.00 London time; this is still 'today' to me. Good luck sorting that little lot out; all you can do is the best you can for yourself. Define new functions where ever possible rather than contain the code within another function as this makes it easier to port code over to new applications. I am not great at this, but am getting better. The 'proper coders' here probably bang their heads on the table every time I post some code. I Try my best. That takes care of the immediates. ----------------------------------------------------------------------------------------- Go back to line 1622: if (!IsTradingAllowed() ) return; bool IsTradingAllowed() starts at line 1319 and is a catch-all function that disables trading altogether under a variety of different circumstances. There you see how I add anything that will stop trading altogether. ---------------------------------------------------------------------------------------- I hope this helps. Sing out if you need any extra info. Feel free to post your code here - one of us will confirm or correct it for you; we all want to encourage people to learn this stuff for themselves. |
|
| Author: | themaxx [ Sat Jun 04, 2016 2:22 pm ] |
| Post subject: | GU H1 high/low entry system? |
OK, I followed all your line references (I even spotted a reference to 2076 which should have been 2876 - I am paying attention As you said - 1633 - 1655 - lines are saying, "If there are neither a market buy or a pending buy stop trade in place, then send some sort of long trade. So that's how I want the new robot to work, only take new long if there's no existing open long or pending long. But I know I requested that the robot ignore previous days trades. So there must be a check somewhere in the code where previous day's trades are filtered out for the purposes of checking if there is an open buy/sell. So 1633 checks "BuyOpen" - I need to be look at where the code switches this variable from true to false. At 2733 CountOpenTrades() sets BuyOpen to false, then iterates through the open trades. I can see this: 2818 if (OrderOpenTime() < iTime(Symbol(), PERIOD_D1, 0)) continue;//Only interested in today's trades. This needs refining. Then I looked at: https://book.mql4.com/operators/continue So I converted the above code in my head as: if the time of the trade being checked is earlier than today's day, then skip that trade and continue ie 3 Jun 2016 < 4 June 2016, skip 3 Jun trade So that seems to be the line filtering out previous day's trades from the is there an open trade check. So I should be able to delete that line, and the robot will iterate through all trades when it does an open trade check. But I tried that, and it didn't work for me. Am I missing something? |
|
| Author: | SteveHopwood [ Sat Jun 04, 2016 3:50 pm ] |
| Post subject: | GU H1 high/low entry system? |
If you comment out line 2818, then BuyOpen is set to 'true' at 2876 so the EA cannot send a fresh trade. You would need to add an extra conditional, so the snippet at 2876 would become: Code: Select all My EA's do not hve broker and local times shown on the charts because I think people do not have clocks. The have two functions:
Code: Select all |
|
| Author: | SteveHopwood [ Sat Jun 04, 2016 4:00 pm ] |
| Post subject: | GU H1 high/low entry system? |
I have added DMI timeframe inputs to the indi and EA in post 3. |
|
| Author: | themaxx [ Sat Jun 04, 2016 5:40 pm ] |
| Post subject: | GU H1 high/low entry system? |
I've just realised that I've been extremely unclear in what I'm trying to achieve. Yes, this is exactly what I want. I want to simplify the robot so it only takes 1 buy trade and 1 sell trade. I want it to include previous days trades when it runs its checks to see if there are open trades, and then stop entering fresh trades. I commented out 2818, there was an open buy yesterday, and it entered an open buy today - I don't understand why that would happen? Maybe I made a mistake, I will try this again. Please don't waste any more time on this I'm sure I'll work it out on my own. |
|
| All times are UTC | Page 6 of 9 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|