MODIFY MY MQL5 FUNCTION TO RETURN LATEST ORDER TYPE

MQL5 Asesores Expertos

Trabajo finalizado

Plazo de ejecución 21 horas
Comentario del Cliente
good!
Comentario del Ejecutor
Excellent customer!

Tarea técnica

The code below correctly identifies the position type when there is only one trade opened, however if there are more than one position opened, the code does not return the latest position 

 modify it to identify the position type of the LATEST opened trade if there are more than one trade opened :

Example if 2 positions  are opened:

1 Buy  -  opened at 13:00

1 sell- Opened at 12:00


return 1 as this is the latest opened position which is a buy


double POSITTYPE()
  {

   double POSX=0;
   
   string   symbol;
   symbol=PositionGetSymbol(POSITION_SYMBOL);

    for(int i=PositionsTotal()-1;i>=0;i--)
     {
      if(PositionSelectByTicket(PositionGetTicket(i)) && 
            PositionGetString(POSITION_SYMBOL)==_Symbol && 
            PositionGetInteger(POSITION_MAGIC)==MagicNumber)
           {
            if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)
               POSX=1;
            if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL)
               POSX=2;
           
        }
     }
   return( POSX);
  }

Han respondido

1
Desarrollador 1
Evaluación
(1117)
Proyectos
1419
62%
Arbitraje
21
57% / 10%
Caducado
43
3%
Trabaja
Solicitudes similares
looking for a developer who can Design MT5 EA as per my Strategy based on Nadaraya [LuxAlgo] + RSI Multi Length [LuxAlgo] pine script indicator to MT5 (Mql5) Main Inputs 01) Indicator: Nadaraya [LuxAlgo] + RSI Multi Length [LuxAlgo] 02) CYCLE SETTINGS 03) LOT SIZE SETTINGS 04) TP, SL, TS SETTINGS 05) EQUITY PROTECTOR SETTINGS 06) CUSTOM TRADING SESSION TIMES 07) HIGH IMPACT NEWS FILTER Stratagy is : After identify
If auto trading disabled and trades closed (like to avoid news), then when auto trading enabled, EA needs to start trading again right away, but it doesn't. If the terminal is restarted with active EA, the EA should pick up where it left off, not make new trades because terminal restart. EA has terminal GVs. If EA is re initialized with same set file it overwrites the GVs, it should not overwrite the GV values, but
I need assistance setting up both manual and automated trading strategies. I want the flexibility to add multiple strategies in the same order as needed. Additionally, I need any profits made to automatically convert to USDT (Tether) rather than remaining in the same coin. The setup should be compatible for both PC and mobile use, and across platforms including Binance, Bybit, Bitget, Gate.io, and TradingView. If you
I need a developer who can convert my simple script from tradestation to pinescript about just 15 to 20 lines of code, the code will be drop in the conversation please let me know if this is what you can do
I want to convert my tradingview indicator to MT4. I need a developer who can get it completed under the course of 24-48hrs. And I need some who is more experience at this level and possibly if you have experience with NinjaTrader too, we can collaborate and work on it as well
Hello, I would like you to help me develop a simple Expert Advisor (EA) for trading the Boom and Crash markets. All the project requirements is available with me . kindly bid if you can develop EA for boom and out crash . Thanks
Hello, I am looking for an programmer to convert a TradingView strategy pine script to MT5 EA auto trade bot. The indicator is based on the FVG/Imbalance (Pine script will be provided) The MT5 EA must return 100% the same results as TradingView script The MT5 EA must include the same options as TradingView The MT5 EA must be errors free
Project Overview: We are seeking an experienced developer to create a custom Copy Trading Expert Advisor (EA) that supports two-way communication between MetaTrader 4 (MT4), MetaTrader 5 (MT5), and cTrader trading terminals. The EA should enable seamless copying of trades from one account to another, incorporating additional settings for flexibility and customization. The project will involve developing a DLL
I am currently seeking the expertise of a skilled MQL5 developer to assist with a custom trading bot project tailored to specific requirements. The project entails the development of a versatile trading bot capable of implementing both manual and automated strategies, with flexibility to switch between strategies seamlessly. Additionally, the bot should be designed to convert profits automatically into USDT, allowing
PRESQUE PAREIL QUE L’AUTRE ROBOT AVEC QUELQUE PETIT CHANGEMENT. IL N’Y AURA PLUS DE SL; SI TU PEUX M’ENVOYER TON MAIL, JE T’ENVOIE LE DOCUMENT QUI EXPLIQUE LE MODELES DU ROBOT QUE JE VEUX. @page { size: 8.27in 11.69in; margin: 0.79in } p { line-height: 115%; margin-bottom: 0.1in; background: transparent }

Información sobre el proyecto

Presupuesto
30+ USD
Para el ejecutor
27 USD
Plazo límite de ejecución
a 5 día(s)