How to lock in bid/ask prices for pending orders
4 replies
Tony
6 years ago #116732
Dear Sirs/Maams
I created my EA using the Wizard.
Based on some specific indicators, a buy or sell signal is triggered.
Instead of opening the order immediately, i created a pending order in this case a buy or sell limit which is say `10 pips lower or higher’ from the ask/bid price at that point when the signal is triggered.
In the EA Wizard, under the `THEN’ boxes, i key in the following for the prices:-
Buy Limit
Price = `Ask – ConvertToRealPips(10)’
or if Sell Limit, it would be
Price = `Bid + ConvertToRealPips(10)’
However, I notice that the Ask and Bid prices are `live’ and changes accordingly to the market. This is not what I wanted as I need that particular ask/bid price at that point in time. If so, how do I do it.
Thank you
tomas262
6 years ago #142801
Hello,
you need to save the value into a variable at correct time. You can setup a new double variable called lastAsk / lastBid and on a new tab assign this variable value lastAsk = Ask once condition for placing limit is valid. Then you use the lastAsk to calculate new limit price
Tony
6 years ago #142853
Hello
Thank you for your reply. However, the ask/bid price which was supposed to be locked in is still not static and is fluctuating.
I set up as follows:-
Under strategy
double lastAsk = 0;
double lastBid = 0;
Under Trading Rules
If
specified Indicators are triggered
Then
Assign Variables
Variable : lastAsk = Ask
Enter At Limit
Price : lastAsk – ConvertToRealPips(10) //assuming 10 pips lower
Please guide where I have gone wrong. Tq
tomas262
6 years ago #142912
Hello,
can you attach the entire Wizard project saved? You can also send it to [email protected]
I can modify it for you in your favor
Tony
6 years ago #142960
Hello
I found out where I had gone wrong.
Under `Enter At Limit’,
`Advanced properties, Replace Existing Order’
– I wrongly set it to True instead of False. It should be False, if not the pending orders will continue to be replaced as long as the trading (indicator) signals are valid. Thats why the limit prices (ask/bid) seem to be changing instead of being static
Thank you for your kind assistance
Viewing 4 replies - 1 through 4 (of 4 total)