Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
Karputov Vladimir Y simplificar OnTradeTransaction()- considerar sólo la adición de un comercio a la historia - sin órdenes
Estarás bien, ni te molestes en escribirlo (no pierdas el tiempo).
Empecé a investigarlo porque el real se estrellaba.
Parece que han actualizado el servidor durante el fin de semana. Los milisegundos aparecieron. Puede haber más sorpresas.
Aparentemente, la funciónOnTradeTransaction funciona independientemente del registro de transacciones.
Creo que este comportamiento de la función es razonable - no hay necesidad de ralentizar el flujo de operaciones y esperar hasta que se escriba el registro y se calcule todo.
En su caso, probablemente sea mejor utilizarOnTrade,
o esperar y comprobar periódicamente con una pausa mínima cuando el acuerdo aparece en el historial.
Parece que han actualizado el servidor el fin de semana. Aparecieron milisegundos. Puede haber más sorpresas.
Al parecer, la funciónOnTradeTransaction funciona independientemente del registro de operaciones.
Creo que este comportamiento de la función está justificado - no hay necesidad de ralentizar el flujo de operaciones y esperar hasta que todo esté registrado y contabilizado en el diario.
En su caso, probablemente sea mejor utilizarOnTrade,
o esperar y comprobar periódicamente con una pausa mínima cuando el acuerdo aparece en el historial.
¡Hola Sergei!
Sí lo hicimos, pero no el fin de semana, sino el jueves después de la sesión vespertina (se lo pregunté a mi agente).
No puedo utilizar el evento Trade() y esperar a que los datos se actualicen en el terminal.
El Asesor Experto fue escrito hace mucho tiempo y hasta hace poco funcionaba "como un reloj" (tal vez tuve suerte y el eventoTRADE_TRANSACTION_DEAL_ADD fuesiempre el primero en llegar).
Es importante que el Asesor Experto ejecute una operación recíproca lo antes posible, por eso el modo asíncrono y OnTradeTransaction().
Ahora, el Asesor Experto (a veces) envía órdenes duplicadas para abrir y cerrar posiciones.
Usted: "Creo que este comportamiento de la función está justificado. No es necesario ralentizar el flujo de operaciones y esperar a que todo se escriba y se cuente en el diario".
De todos modos, todo se está escribiendo y contando después de que llegueTRADE_TRANSACTION_DEAL_ADD :)
La cuestión es queTRADE_TRANSACTION_DEAL_ADD puede perderse yTRADE_TRANSACTION_HISTORY_ADD puede llegar y entonces el terminal tendrá datos de posición desactualizados.:(,
lo que realmente sucede.
Es extraño que los desarrolladores no hayan pensado en ello.
TRADE_TRANSACTION_HISTORY_ADD sólo se produce si la orden ha sido ejecutada o eliminada (cancelada), por lo que
si el estado de la orden cambia (respectivamente, la posición puede cambiar), el terminal debe recibir la información sobre el cambio de posición,
incluso siTRADE_TRANSACTION_DEAL_ADD se pierde
Veamos qué dicen los desarrolladores.
Karputov Vladimir Y simplificar OnTradeTransaction() - considerar sólo la adición de un comercio a la historia - sin órdenes
Estarás bien, ni te molestes en escribirlo (no pierdas el tiempo).
Por favor, pida a los "profesores" y a los "sabelotodo" que hablen sobre el fondo,
y no sólo para poner el pie en el poste para hacer un punto.
Antes de mostrarse a la gente que quiere ayudarle, debe formular su pregunta con normalidad. ¿Qué tiene que ver el envío asíncrono de una orden, si el cierre parcial lo realiza la función OrderSend()? ¿Sobre qué preguntas?
¡Genial!
¿Debería considerarse eso como una ayuda?
Y Karputov no tiene nada que ver, es que cuando escribí mi post él ya había puesto el suyo y no lo vi.
Inicialmente, la pregunta estaba planteada de la siguiente manera (por si te da pereza leerla primero)
¿Cómo construir el registro para mostrar a los desarrolladores el error?
Porque, lo hice yo mismo y los registros muestran claramente que
después deTRADE_TRANSACTION_HISTORY_ADD (antes deTRADE_TRANSACTION_DEAL_ADD)
el terminal no actualiza la información de posición.
prostotrader, Dimitri te dice correctamente que los cierres parciales (y completos) no son asíncronos en tu código, sino síncronos... lo que significa que el programa está esperando una respuesta del servidor...
Es probable que OnTradeTransaction se active más rápido que los cambios de la propia posición.
Pues aquí:
podrías intentar hacer un bucle de comprobación de la posición. Tal vez ayude....
Es algo así:
Sin conocer el algoritmo exacto(que necesita del programa), es difícil evaluar la corrección de su implementación...
Cambiado completamente al modo asíncrono
pero nada ha cambiado
Era obvio, pero "en aras de la pureza" del experimento...
Registros completos en el sótano.
1. >Sin conocer el algoritmo exacto (que necesita del programa), es difícil evaluar si está implementado correctamente...
Pensaba que no era difícil entender lo que hace el programa, pues si no está claro, entonces
Un Asesor Experto abre una posición en el mercado FORTS con un volumen de 2 contratos; si la posición se abre, se cierra parcialmente con un volumen de 1 contrato,
entonces la posición se cerrará completamente. Repite este procedimiento hasta que el contador tr_cnt<50
2. Puedes "ejecutar" PositionSelect() un millón de veces - no cambiará nada, porque
el eventoTRADE_TRANSACTION_DEAL_ADD no se recibirá hasta que esté en el bucle, y por lo tanto, el terminal no se actualizará
información sobre el puesto
...
Ya lo he dicho antes: no te dejes llevar por las órdenes: fíjate en las transacciones. Aquí hay un código corto que muestra CUANDO cambia el volumen de la posición y qué tipo de transacción es:
Y aquí están las huellas, en un cierre parcial:
Se puede ver claramente que en cuanto ha pasado un evento con el tipo de transacción comercialTRADE_TRANSACTION_DEAL_ADD, eso es, se actualizan los datos de posición en el terminal.