why err = Position doesnt exist. - page 2

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- 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
Please post all the relevant code if you want help.
solved it..
now another new err
tested on roboforex MT5 is okay
but on fxchoice have err - unsupported filling mode
so...
//| Checks if the specified filling mode is allowed |
//+------------------------------------------------------------------+
bool IsFillingTypeAllowed(string symbol,int fill_type)
{
//--- Obtain the value of the property that describes allowed filling modes
int filling=(int)SymbolInfoInteger(symbol,SYMBOL_FILLING_MODE);
//--- Return true, if mode fill_type is allowed
return((filling & fill_type)==fill_type);
}
solved it..
Really ?
The forum is not just dedicated to help you, please post the solution, it could help other people.
Really ?
The forum is not just dedicated to help you, please post the solution, it could help other people.
here it is.
{
if (For_AllSymbol || PositionGetSymbol(i) == Symbol())
{
ulong Order_Ticket = OrderGetTicket(i);
ulong Position_Ticket = PositionGetTicket(i);
string Position_Symbol = PositionGetString(POSITION_SYMBOL);
int Position_Digits = (int)SymbolInfoInteger(Position_Symbol, SYMBOL_DIGITS);
ulong Position_Magic = PositionGetInteger(POSITION_MAGIC);
double Position_Volume = PositionGetDouble(POSITION_VOLUME);
double Position_SL = PositionGetDouble(POSITION_SL);
double Position_TP = PositionGetDouble(POSITION_TP);
ENUM_POSITION_TYPE Position_Type = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
if (Position_Type == POSITION_TYPE_BUY)
{
if ((SymbolInfoDouble(_Symbol, SYMBOL_BID) - PositionGetDouble(POSITION_PRICE_OPEN)) > 0)
{
MqlTradeRequest request = {0};
MqlTradeResult result = {0};
ZeroMemory(request);
ZeroMemory(result);
request.action = TRADE_ACTION_DEAL;
request.position = Position_Ticket;
request.symbol = Position_Symbol;
request.magic = Position_Magic;
request.volume = Position_Volume;
request.sl = 0;
request.tp = 0;
request.comment = "Close Buy";
request.deviation = 3;
request.type = ORDER_TYPE_SELL;
request.price = SymbolInfoDouble(Position_Symbol, SYMBOL_BID);
if (!OrderSend(request, result))
PrintFormat("ButtonCloseProfit : ", GetLastError());
else PrintFormat("ButtonCloseProfit : ", PositionGetDouble(POSITION_PRICE_CURRENT));
}
}
if (Position_Type == POSITION_TYPE_SELL)
{
if((PositionGetDouble(POSITION_PRICE_OPEN) - SymbolInfoDouble(_Symbol, SYMBOL_ASK)) > 0)
{
MqlTradeRequest request = {0};
MqlTradeResult result = {0};
ZeroMemory(request);
ZeroMemory(result);
request.action = TRADE_ACTION_DEAL;
request.position = Position_Ticket;
request.symbol = Position_Symbol;
request.magic = Position_Magic;
request.volume = Position_Volume;
request.sl = 0;
request.tp = 0;
request.comment = "Close Sell";
request.deviation = 3;
request.type = ORDER_TYPE_BUY;
request.price = SymbolInfoDouble(Position_Symbol, SYMBOL_ASK);
if (!OrderSend(request, result))
PrintFormat("ButtonCloseProfit : ", GetLastError());
else PrintFormat("ButtonCloseProfit : ", PositionGetDouble(POSITION_PRICE_CURRENT));
}
}
}
}