show the relevant code, and someone may assist you
int Begin=GetTickCount();
while(GetTickCount()<Begin+
while(GetTickCount()<Begin+
13000)
{
Sleep(1);
RefreshRates();
int StartOrder=GetTickCount();
//calculations not related to ordering
if (Conditions)
{
Alert("Order 8001-BUY GOLD "," Buy Price=", MarketInfo("GOLD",MODE_ASK));
FirstOrderAsk = MarketInfo("GOLD",MODE_ASK);
_Order = OrderSend("GOLD",0,LotsGold,MarketInfo("GOLD",MODE_ASK),GoldSlippage,MarketInfo("GOLD",MODE_ASK)-MarketInfo("GOLD",MODE_POINT)*300,0,"",8001);
err = GetLastError();
while (!exit_loop)
{
RefreshRates();
if (
!exit_loop &&
FirstOrderAsk != MarketInfo("GOLD",MODE_ASK) &&
Conditions
)
{
FirstOrderAsk = MarketInfo("GOLD",MODE_ASK);
_Order = OrderSend("GOLD",0,LotsGold,MarketInfo("GOLD",MODE_ASK),GoldSlippage,MarketInfo("GOLD",MODE_ASK)-MarketInfo("GOLD",MODE_POINT)*300,0,"",8001);
err = GetLastError();
}
if (
!exit_loop &&
!Conditions
)
{
exit_loop = true;
Alert(Exit ordering! Ask=",MarketInfo("GOLD",MODE_ASK));
}
switch (err)
{
case ERR_NO_ERROR:
exit_loop = true;
Alert("GOLD Executed Buy Price=", MarketInfo("GOLD",MODE_ASK), " for ",GetTickCount()-StartOrder," ms" );
break; //Order executed successfully, break cycle
case ERR_REQUOTE:
Alert("GOLD BUY Order REQUOTED! Lost time was ",GetTickCount()-StartOrder," ms" );
Sleep(1);
continue; // continue until there is no error
} // end switch
} //while
RefreshRates();
}
{
Sleep(1);
RefreshRates();
int StartOrder=GetTickCount();
//calculations not related to ordering
if (Conditions)
{
Alert("Order 8001-BUY GOLD "," Buy Price=", MarketInfo("GOLD",MODE_ASK));
FirstOrderAsk = MarketInfo("GOLD",MODE_ASK);
_Order = OrderSend("GOLD",0,LotsGold,MarketInfo("GOLD",MODE_ASK),GoldSlippage,MarketInfo("GOLD",MODE_ASK)-MarketInfo("GOLD",MODE_POINT)*300,0,"",8001);
err = GetLastError();
while (!exit_loop)
{
RefreshRates();
if (
!exit_loop &&
FirstOrderAsk != MarketInfo("GOLD",MODE_ASK) &&
Conditions
)
{
FirstOrderAsk = MarketInfo("GOLD",MODE_ASK);
_Order = OrderSend("GOLD",0,LotsGold,MarketInfo("GOLD",MODE_ASK),GoldSlippage,MarketInfo("GOLD",MODE_ASK)-MarketInfo("GOLD",MODE_POINT)*300,0,"",8001);
err = GetLastError();
}
if (
!exit_loop &&
!Conditions
)
{
exit_loop = true;
Alert(Exit ordering! Ask=",MarketInfo("GOLD",MODE_ASK));
}
switch (err)
{
case ERR_NO_ERROR:
exit_loop = true;
Alert("GOLD Executed Buy Price=", MarketInfo("GOLD",MODE_ASK), " for ",GetTickCount()-StartOrder," ms" );
break; //Order executed successfully, break cycle
case ERR_REQUOTE:
Alert("GOLD BUY Order REQUOTED! Lost time was ",GetTickCount()-StartOrder," ms" );
Sleep(1);
continue; // continue until there is no error
} // end switch
} //while
RefreshRates();
}
Do you run this on the Gold chart?
Is Gold open in the Market watch window?
What code are you using, the above code will not compile
Alert(Exit ordering! Ask=",MarketInfo("GOLD",MODE_ASK));
missing "
Please use the SRC button when posting code
sorry, I'm using the forum rarely. I missed SRC button :(
Yes, Gold is opening in Market watch window.
In Alert there is missing " because the original text was on other language and missed the "
What is GoldSlippage?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello guys,
I got puzzle for you that can't solve.
A last several orders were requoted by my broker. Their explanation is that my orders come with old prices, thats why slippage does not work and order is requoted.
I'm checking every 1 ms the broker quotes with Refreshrate() and MarketInfo, send the orders with MarketInfo data and I have 2 ms latency to my broker.
Can you tell me some possible reason, my orders to reach the MT4 server with old quotes ?