| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| MPTM updated https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5190 |
Page 8 of 13 |
| Author: | Fourxxxx [ Mon Dec 14, 2020 8:50 pm ] |
| Post subject: | MPTM updated |
Yes that is correct ie if I use your HGI scripts it opens many pending trades and the market may not reach all of them. So if an indicator closes a trade it would be useful to delete the remaining pending orders also. |
|
| Author: | danjuma [ Wed Dec 16, 2020 9:03 pm ] |
| Post subject: | MPTM updated |
There are two exactly named MPTM mq4 files attached to post 1, are they the same or different in some ways? |
|
| Author: | SteveHopwood [ Thu Dec 17, 2020 10:16 am ] |
| Post subject: | MPTM updated |
No idea how that happened. They both have 1d as their version. I will be posting an update soon so you will know you have the latest version if you download the update. |
|
| Author: | danjuma [ Thu Dec 17, 2020 12:39 pm ] |
| Post subject: | MPTM updated |
Thank you Steve. And a merry Xmas to you (in which ever form that takes for you in this Covid, lock-down and tiers times!) |
|
| Author: | SteveHopwood [ Sat Dec 19, 2020 12:36 pm ] |
| Post subject: | MPTM updated |
V 1e is in post 1. The HGI/SS/MA closure functions were only looking at market trades, which is why the stop and limit orders were ignored. This should be fixed now. To DIY to preserve you hard coded inputs, go to the bool ShouldThisTradeBeClosed(int ticket) function. The next three functions down are:
if (OrderType() == OP_BUY) Add the stop/limit order conditionals so that the line of code becomes: if (OrderType() == OP_BUY || OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT) Then scroll down to: if (OrderType() == OP_SELL) Change it to: if (OrderType() == OP_SELL || OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT) Thanks for pointing this out danjuma. |
|
| Author: | Fourxxxx [ Fri Jan 08, 2021 7:17 am ] |
| Post subject: | MPTM updated |
My coding skills are limited so please understand. I am trying to get MPTM to close trades using the MA but only to become active after the trade has moved into profit. This because with the system I am using the price is often on the wrong side of the MA at entry. Without modification, MPTM would close these trades at entry. This is what I have tried but it is not always closing trades when the close is on the wrong side of the MA and in profit. Code: Select all Any tips appreciated and sorry if this causes any bother. |
|
| Author: | SteveHopwood [ Fri Jan 08, 2021 11:56 am ] |
| Post subject: | MPTM updated |
I don't know if this will help but what I would do is:
Code: Select all We always think it is the code we added that is at fault, but sometimes the problem lies elsewhere. Go to the void OnTimer() function and make sure none of your inputs are causing the function to abort before reaching the DoTradeManagement(); call. |
|
| Author: | Fourxxxx [ Fri Jan 08, 2021 12:37 pm ] |
| Post subject: | MPTM updated |
Thanks Steve, I have your suggestions running now on test. If it works it will still sometimes be closing trades at near the open as my entry trigger is often several pips on the wrong side of the MA 5 with shift of 2. Might be easier for me to just write an EA to go on each chart to handle the MA cross close. |
|
| Author: | SteveHopwood [ Fri Jan 08, 2021 2:18 pm ] |
| Post subject: | MPTM updated |
You need to compare the close at shift 2 with the close at shift 1 to detect a cross. Code: Select all |
|
| Author: | Fourxxxx [ Sat Jan 09, 2021 1:15 am ] |
| Post subject: | MPTM updated |
Thank you Steve, I see now my original logic was flawed, to me it looks like the code you wrote would act as per the image, which is exactly what I am trying to achieve. A buy at the yellow circle (which is an actual trade I entered) would close in profit at the red circled close after previously closing above the red MA then closing below it if I am understanding the code correctly. Now I will have to wait till Monday to see how it goes. |
|
| All times are UTC | Page 8 of 13 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|