![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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, I have an expert i use that needs to be able to resend a buy or a sell order if there is a problem opening the order up if the the server is disconnected, busy or what have you. This morning it should have opened an order but couldn't because the platform was disconnected. In the code right now it is set to wait 3 seconds then try again, which it did but it only tried 3 times then stopped trying to send the order thru. my ea doesn't scalp but is more a mid term trade so I only get 1-3 trades per week per pair. How can i have it coded so it will wait 10 seconds before it tries again and then it will keep trying to send the order until it gets through, i would like to have the option of adjusting it in the code how many seconds it waits to try again and then also how many times it will keep trying.
I've attached a snippet of code so someone could see what could be changed. Thanks in advance for your help!
Mike
RefreshRates();
int ticket=OrderSend(Symbol(),OP_BUY,ManagedLotSize(),Ask,Slippage,sl,tp,"Expert" + " - " + Period(),MagicNumber,0,Lime);
if(ticket<0)
{
Print("Error opening BUY order : ",GetLastError());
Sleep(3000); //---- wait for 3 seconds
}
else
{
break;
}
}
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
{
Print("BUY order opened : ",OrderOpenPrice());
}
else
{
Print("Error opening BUY order : ",GetLastError());
}
}
void ManageSell()
{
double tp,sl;
if (TakeProfit==0) { tp=0; } else { tp=Bid-TakeProfit*Point; }
if (StopLoss==0) { sl=0; } else { sl=Bid+StopLoss*Point; }
for (int i = 1; i <=5; i++) //---- Loop if requote
{
RefreshRates();
int ticket=OrderSend(Symbol(),OP_SELL,ManagedLotSize(),Bid,Slippage,sl,tp,"Expert" + " - " + Period(),MagicNumber,0,Red);
if(ticket<0)
{
Print("Error opening SELL order : ",GetLastError());
Sleep(3000); //---- wait for 3 seconds
}
else
{
break;
}
}
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
{
Print("SELL order opened : ",OrderOpenPrice());
}
else
{
Print("Error opening SELL order : ",GetLastError());
}
Use the OrderReliable include file.
Lux
Hi kevin07,
I will test the new version of nonlagzigzag alert signal when the market opens Sunday. Thanks again for your work. You and others here who give their time and expertise pro bono are what makes many of us more successful traders. I will let you know my results with the new indi.
Best regards, Tom.
help to fix this indicator
hi all ,, when i try to compile this indicator ,, this errors appears to me ,, could it be fix please
thanks
hi all ,, when i try to compile this indicator ,, this errors appears to me ,, could it be fix please thanks
Don't worry, it's not errors, it's warnings only. They put the whole library in the indicator, but used the part only.
Don't worry, it's not errors, it's warnings only. They put the whole library in the indicator, but used the part only.
thank you roger for telling me what is that mean ,,,
but why it dosn't appear when i put it on chart ?![](https://c.mql5.com/forextsd/smiles/cry_smile.png)
can you check it please ??
If you put it in tthe directory /experts/indicators and then compiled, restart your terminal and look at Navigator/Custom Indicators.
If you put it in tthe directory /experts/indicators and then compiled, restart your terminal and look at Navigator/Custom Indicators.
No roger ,, this what i mean ,,
When you start your indicator, should be allowed DLL imports.
When you start your indicator, should be allowed DLL imports.
thanks Roger
,, now it's work ,, ![](https://c.mql5.com/forextsd/smiles/party.png)