| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Joe. Swing-trade your way to a baby equity millipede https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=148 |
Page 5 of 15 |
| Author: | SteveHopwood [ Mon Dec 12, 2011 12:18 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
Leaving this aside, why does the damn code insist on allowing the new trade when the stop loss modify fails? Until we work this out, anything else is prone to error. I cannot work out why the bloody trade is still sent even though the bloody stop loss modify bloody well fails. SCREAAAAMMMMMMMM I am going to leave it for now and start again tomorrow. For now, the initial trade send is fine. It is the stack stuff that is failing. It will be a simple logic bloop - it always is. If all else fails, then rewriting void LookForTradingOpportunities() will solve the problem. |
|
| Author: | gaheitman [ Mon Dec 12, 2011 12:57 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
A couple things to start from in the morning: I dropped this code into ModifyOrder(): Code: Select all 19:07:17 2011.10.02 19:00 Joe (3) EURUSD,H4: open #54 buy 0.01 EURUSD at 1.33472 ok 19:07:17 2011.10.02 19:00 Joe (3) EURUSD,H4: Alert: Buy Tkt: 54 bid 1.3345 1.3347 1.3389 0 19:07:17 2011.10.02 19:00 Joe (3) EURUSD,H4: OrderModify error 130 "' "' removed 8 more of these lines.... 19:07:17 2011.10.02 19:00 Joe (3) EURUSD,H4: OrderModify error 130 19:07:17 2011.10.02 19:00 Joe (3) EURUSD,H4: EURUSD SL/TP order modify failed with error(130): invalid stops 19:07:17 2011.10.02 19:00 Joe (3) EURUSD,H4: Alert: EURUSD SL/TP order modify failed with error(130): invalid stops As you can see, the initial order creation is sending an order with an invalid stop loss, since nothing else calls ModifyOrder() -- it's the anti-ECN code.... It's only throwing these on the initial order, not the stacked orders (I added OpenTrades to the error message on a later run.). So, assuming we now have some of our trades running around without stop losses set, we now see that the test for setting sells to break even fails on them. Code: Select all Also, your code doesn't check the type of the last trade, so on the turns, it's possible you have a sell open and trigger a buy. The buy code looks at the last trade and checks Code: Select all As you can see, order 84 was still open, without a BE SL, and a buy triggered. Sorry this is disjointed, just kind or dumping my observations as I have them. I'll be fresher in the middle of the night. George |
|
| Author: | SteveHopwood [ Mon Dec 12, 2011 1:07 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
Hehe. George, I have lost the will to live and don't care whether it is disjointed or not. If you can make this blasted robot work, then just upload a version here and I can adopt it into post 1 before resorting to the razor blades. This will save me completely rewriting the damned robot in the morning, which is what I shall do otherwise. You have never known me as fed up as I am tonight. |
|
| Author: | mobthehop [ Mon Dec 12, 2011 2:04 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
Steve, as you know I can not code (unfortunately).... I have recently read about MODE_FREEZELEVEL: quote FreezeLevel Limitation (Freezing Distance). Market orders can not be closed if the StopLoss and TakeProfit values violate the FreezLevel parameter requirements. StopLoss or TakeProfit orders can not be modified if StopLoss or TakeProfit values violate the StopLevel parameter requirements. Pending orders can not be deleted or modified if the declared open price violates the FreezeLevel parameter requirements. unquote Here is a link to a thread on mql4.com - http://forum.mql4.com/43812 Maybe a mandatory check against broker's FreezeLevel will help to resolve these "can not mondify..." & "invalid stops" errors? Just a thought and have a peacefull rest... bath tub time tomorrow???? |
|
| Author: | andydoc [ Mon Dec 12, 2011 7:31 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
Mobthehop may have something: I have modified 2 lines in the stack:modify routine (not that it has helped yet but am looking for other similar lines) Code: Select all Code: Select all |
|
| Author: | andydoc [ Mon Dec 12, 2011 7:49 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
and here: Code: Select all Code: Select all still no difference |
|
| Author: | gaheitman [ Mon Dec 12, 2011 8:23 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
Progress, I think. I believe the attached version fixes the issues with SL setting. I have added a MinimumStopLoss setting to the extern variables. It is currently set at 30 pips, which I know is wrong, so be sure to change it in your testing. The more insidious error was that PendingBuy and PendingSell were not being set to true/false appropriately in LookForTradingOpportunities(). That allowed what we thought was a pending buy to be filled as a pending sell (or perhaps the other way around). Either way, it is fixed as well. I need to look at BE now, but I wanted to give everyone something else to run for a while. My changes are marked in the code with //gah George |
|
| Author: | gaheitman [ Mon Dec 12, 2011 8:43 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
OK, I think I know the issue with stacking. The code is evaluating the FbTrend and HtfDirection to see if it should enter any orders. Here is the sequence of values prior to a sell and each bar thereafter: 03:39:35 2011.11.14 04:00 Joe (1) EURUSD,H4: Alert: Down Down 03:39:35 2011.11.14 04:00 Joe (1) EURUSD,H4: open #82 sell 0.01 EURUSD at 1.37697 ok 03:39:35 2011.11.14 04:00 Joe (1) EURUSD,H4: modify #82 sell 0.01 EURUSD at 1.37697 sl: 1.37930 tp: 0.00000 ok 03:39:35 2011.11.14 08:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:35 2011.11.14 12:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:35 2011.11.14 16:00 Joe (1) EURUSD,H4: Alert: Up Down 03:39:35 2011.11.14 20:00 Joe (1) EURUSD,H4: Alert: Up Down 03:39:35 2011.11.15 00:00 Joe (1) EURUSD,H4: Alert: Up Down 03:39:35 2011.11.15 04:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:35 2011.11.15 08:00 Joe (1) EURUSD,H4: Alert: Up Down 03:39:35 2011.11.15 12:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:35 2011.11.15 16:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:36 2011.11.15 20:00 Joe (1) EURUSD,H4: Alert: Up Down 03:39:36 2011.11.16 00:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:36 2011.11.16 04:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:36 2011.11.16 08:00 Joe (1) EURUSD,H4: Alert: Up Down 03:39:36 2011.11.16 12:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:36 2011.11.16 16:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:36 2011.11.16 20:00 Joe (1) EURUSD,H4: Alert: None Down 03:39:36 2011.11.17 00:00 Joe (1) EURUSD,H4: Alert: None Up 03:39:36 2011.11.17 04:00 Joe (1) EURUSD,H4: modify #82 sell 0.01 EURUSD at 1.37697 sl: 1.37697 tp: 0.00000 ok 03:39:36 2011.11.17 04:00 Joe (1) EURUSD,H4: Alert: Up Up As you can see, the code doesn't even evaluate whether it should move to breakeven until a new trade is triggered. Back in a few.... George |
|
| Author: | andydoc [ Mon Dec 12, 2011 9:19 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
Well spotted - I was looking in too deep and missed that. |
|
| Author: | gaheitman [ Mon Dec 12, 2011 9:25 am ] |
| Post subject: | Re: Joe. Swing-trade your way to a baby equity millipede |
OK, this one seems to be working (more in GetFlyingBuddha Code: Select all Code: Select all Since we only want to start new sequences (initial trade folllowed by stacks) if we have a fresh flying Buddha, I added the following test (opposite for sell). Code: Select all |
|
| All times are UTC | Page 5 of 15 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|