| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Hoichoi EA https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=188 |
Page 3 of 4 |
| Author: | joancb [ Tue Jan 10, 2012 9:25 am ] |
| Post subject: | Re: Hoichoi EA |
no helping hands here? |
|
| Author: | gaheitman [ Tue Jan 10, 2012 4:13 pm ] |
| Post subject: | Re: Hoichoi EA |
What do you want the behaviour to be? Open a market order, slide the entry as far away as you need to in order to place the pending order, or wait patiently for a retrace and then enter the pending? George |
|
| Author: | joancb [ Tue Jan 10, 2012 5:45 pm ] |
| Post subject: | Re: Hoichoi EA |
Hi George, thanks for your reply, what I just want is these lines to work: if (OrderType()==5) { ticketB=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,StopB,0,Coment,Magic,0,Green); } if (OrderType()==4) { ticketS=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,StopS,0,Coment,Magic,0,Green); } they are supposed to take effect when the time introduced in the input fields arrives and there's only one pending filled because the other has failed due to the proximity of the price. So, in theory, there should be no problem in opening a OP_BUY or and OP_SELL order....but...it does not work. |
|
| Author: | jjgengis [ Tue Jan 10, 2012 6:22 pm ] |
| Post subject: | Re: Hoichoi EA |
Hi joancb, Thank you for sharing your system. what kind of error does your brokers send to you? Trade context busy? invalid price? etc... Pay attention to the buffer value. You put a value of 3, but in a 5 digit platform this mean 0.3 pip, not 3 pip. I think the errors are due to broker's stoplevel. This number of pips that your broker needs as minimum distance from priceorder/pricestop and the price in that moment. This value is variable and could be from 1 to 10 pips, This is dependent to the pairs and the moment. If you put a value of buffer of 30-40 (3-4 pips) i think you have not other problem with major pairs. JJ |
|
| Author: | joancb [ Tue Jan 10, 2012 7:15 pm ] |
| Post subject: | Re: Hoichoi EA |
Eureka! thank you all for your help!! I've found something that works, it may not be clean but it makes it, It was a problem with stops, after trying many different combinations I figured out this (with the help of http://forum.mql4.com if (OrderType()==5) { ticketB=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,Coment,Magic,0,Green); OrderSelect(ticketB,SELECT_BY_TICKET); OrderModify(ticketB, OrderOpenPrice(),StopB,0,0,Green); } if (OrderType()==4) { ticketS=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,Coment,Magic,0,Red); OrderSelect(ticketS,SELECT_BY_TICKET); OrderModify(ticketS, OrderOpenPrice(),StopS,0,0,Red); } Thanks again and post 1 updated P.S. maybe Steve should make this forum change automatically the word Empty4 to Metaphysics or something... |
|
| Author: | jjgengis [ Tue Jan 10, 2012 7:49 pm ] |
| Post subject: | Re: Hoichoi EA |
I think there's something wrong in your solution.... ticketB=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,Coment,Magic,0,Green); this row mean that ticketb will be -1 if the function Ordersend fail and 0 in case the order is gone to the market. The algorithm to extract the number ticket of your order is another. If I've understood well your thought.... JJ |
|
| Author: | joancb [ Tue Jan 10, 2012 7:51 pm ] |
| Post subject: | Re: Hoichoi EA |
Yes, that's true but now the Stop and the TakeProfit are changed to 0, so it will fill the order with no errors |
|
| Author: | jjgengis [ Tue Jan 10, 2012 7:59 pm ] |
| Post subject: | Re: Hoichoi EA |
To Admin I'm sorry, I've reported a post by mistake. To joancb Have you an ECN broker? JJ |
|
| Author: | gaheitman [ Tue Jan 10, 2012 8:49 pm ] |
| Post subject: | Re: Hoichoi EA |
It does sound like joancb needs to review the code in the shell (or other places) that does the two step order. I'd recommend any of the EAs posted by Steve and search for "ECN". It should demonstrate the two step order. George |
|
| Author: | MichaelM [ Wed Jan 11, 2012 12:42 am ] |
| Post subject: | Re: Hoichoi EA |
joancb, you most certainly have an ECN broker if that code doesn't work You are right about your findings, shame I didn't reply to you sooner to save you the trouble, but you did learn a lot about MQL in the process, so it's all good! First, you need to code it so that it opens the order without SL and TP. After that is successful, modify the order to set the SL and TP. |
|
| All times are UTC | Page 3 of 4 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|