Hoichoi EA

joancb

Re: Hoichoi EA

Post by joancb »

joancb wrote:You're welcome :)

I'm still having some problems with opening orders when the price is close or over the maximum of the PC and close or below the minimum of the PC...
no helping hands here?
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Hoichoi EA

Post by gaheitman »

joancb wrote:
joancb wrote:You're welcome :)

I'm still having some problems with opening orders when the price is close or over the maximum of the PC and close or below the minimum of the PC...
no helping hands here?
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
joancb

Re: Hoichoi EA

Post by joancb »

gaheitman wrote:
joancb wrote:
joancb wrote:You're welcome :)

I'm still having some problems with opening orders when the price is close or over the maximum of the PC and close or below the minimum of the PC...
no helping hands here?
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
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.
User avatar
jjgengis
Trader
Posts: 39
Joined: Thu Nov 24, 2011 8:45 pm
Location: Bologna - Italy

Re: Hoichoi EA

Post by jjgengis »

joancb wrote:
joancb wrote:You're welcome :)

I'm still having some problems with opening orders when the price is close or over the maximum of the PC and close or below the minimum of the PC...
no helping hands here?
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.

:D

JJ
joancb

Re: Hoichoi EA

Post by joancb »

jjgengis wrote:
joancb wrote:
joancb wrote:You're welcome :)

I'm still having some problems with opening orders when the price is close or over the maximum of the PC and close or below the minimum of the PC...
no helping hands here?
Hi joancb,
Thank you for sharing your system.


what kind of error does your criminals 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 criminal's stoplevel. This number of pips that your criminal 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.

:D

JJ

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 :P


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...
User avatar
jjgengis
Trader
Posts: 39
Joined: Thu Nov 24, 2011 8:45 pm
Location: Bologna - Italy

Re: Hoichoi EA

Post by jjgengis »

joancb wrote:
joancb wrote:You're welcome :)..... 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...
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
joancb

Re: Hoichoi EA

Post by joancb »

jjgengis wrote:
joancb wrote:
joancb wrote:You're welcome :)..... 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...
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
Yes, that's true but now the Stop and the TakeProfit are changed to 0, so it will fill the order with no errors
User avatar
jjgengis
Trader
Posts: 39
Joined: Thu Nov 24, 2011 8:45 pm
Location: Bologna - Italy

Re: Hoichoi EA

Post by jjgengis »

To Admin

I'm sorry, I've reported a post by mistake.

To joancb

Have you an ECN broker?

JJ
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Hoichoi EA

Post by gaheitman »

jjgengis wrote:To Admin

I'm sorry, I've reported a post by mistake.

To joancb

Have you an ECN criminal?

JJ
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
MichaelM
Trader
Posts: 117
Joined: Sun Dec 04, 2011 11:04 pm

Re: Hoichoi EA

Post by MichaelM »

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.
Post Reply

Return to “Automated trading systems”