I want to place a limit type order below the current market for a buy, but I don't want the pending order(s) sitting on the broker's server for all Market Makers to see.
I was thinking that a "simulated hidden limit order" might work instead but was stuck on the code specifics.
For example, let's say I would normally place a normal limit order at 6.0 pips below the entry signal price. In that situation I would just send a limit order as such. Price at buy signal generation minus 6.0 equals buy limit.
Under normal conditions if the spread is 1.5 pips then the market would have to go my limit price plus 1.5 pips lower for a total of 7.5 pips lower than the market price at buy signal for my limit buy to get executed.
Scenario: Let's say my EA generates a BUY SIGNAL. Now, instead of sending a limit order at the lower price, or a market order at the current price which is higher than where I want to get in, I run a function that stores the price when the buy signal is executed minus 7.5 pips.
Logic: If the market goes to minus 7.5 pips from the stored price or price when the signal is executed, then send a market order which should execute very close to the limit price assuming the spread has not widened, in fact if the spread has narrowed it would even execute lower.
The question is this: HOW can I tell MT4 to store the value of the price when the buy signal is generated?
For example, let's say the market is 101.50 and the buy signal is generated. I want the EA to send a market order if the market goes to 101.425.
Since the market price is changing I can't simply say "Ask-7.5*Point", because that's how I send the limit order.
I would need to store the market price at the time the buy signal is generated. How can I do this in MT4?
Any ideas?
This is the basic code and logic so far:
I was thinking that a "simulated hidden limit order" might work instead but was stuck on the code specifics.
For example, let's say I would normally place a normal limit order at 6.0 pips below the entry signal price. In that situation I would just send a limit order as such. Price at buy signal generation minus 6.0 equals buy limit.
Under normal conditions if the spread is 1.5 pips then the market would have to go my limit price plus 1.5 pips lower for a total of 7.5 pips lower than the market price at buy signal for my limit buy to get executed.
Scenario: Let's say my EA generates a BUY SIGNAL. Now, instead of sending a limit order at the lower price, or a market order at the current price which is higher than where I want to get in, I run a function that stores the price when the buy signal is executed minus 7.5 pips.
Logic: If the market goes to minus 7.5 pips from the stored price or price when the signal is executed, then send a market order which should execute very close to the limit price assuming the spread has not widened, in fact if the spread has narrowed it would even execute lower.
The question is this: HOW can I tell MT4 to store the value of the price when the buy signal is generated?
For example, let's say the market is 101.50 and the buy signal is generated. I want the EA to send a market order if the market goes to 101.425.
Since the market price is changing I can't simply say "Ask-7.5*Point", because that's how I send the limit order.
I would need to store the market price at the time the buy signal is generated. How can I do this in MT4?
Any ideas?
This is the basic code and logic so far:
if (BuySignal)
fBuy();
void fBuy()
{
double BuySignalPrice = This needs to be the Ask when the buy signal was generated.
{
if (Ask <= BuySignalPrice-(7.5*Point))
int result = OrderSend(ST1,OP_BUY,Lots,Ask,Slip,0,0,"Open LONG Magic1",Magic1,0,Blue);
}
}