Wrong entries. Help to fix de code.

Forums ProRealTime English forum ProOrder support Wrong entries. Help to fix de code.

Viewing 4 posts - 1 through 4 (of 4 total)
  • #52451

    Hi everyone,

    I am trying to put together a code, based on the RSI, and applying some daily averaging down in both directions. I am trying to averaging down within the same day to avoid uncontrolled losses and limit the number of contracts.

    I am still in the middle of the process, but after trying a couple of versions, I am getting wrong entries of just 1€. I have no idea why this is happening. I am attaching the results of one of the tries, so you can see the entries, and also the code as it is right now.

    I would appreciate any help or feedback about these false entries.

    Thanks,

    Juan

     

     

    #52458

    Hola Juan,

    Creo que tu problema está en las últimas líneas. Quieres que el sistema no haga más operaciones cuando se alcance un determinado beneficio/pérdida en el día, pero tal y como está programado aunque se haya alcanzado ese límite diario se sigue ejecutando la operación sólo que inmediatamente la cierra, con el consiguiente beneficio/pérdida de 1 € (quizás el spread). Para que no se ejecuten más operaciones al llegar a esos límites, que es lo que quieres, se me ocurre por ejemplo añadir una nueva variable en esas líneas finales, tal que así:

    //Finishing DAILY operations when reaching target profit/loss
    IF (STRATEGYPROFIT-stratprofit)>=10 THEN //current day’s profit
    NOTRADES = 1
    ENDIF

    IF (STRATEGYPROFIT-stratprofit)<=-20 THEN //current day’s loss
    NOTRADES = 1
    ENDIF

    Y hacer que vuelva a “0” esa variable al principio de cada día, añadiendo a las líneas iniciales:

    // STRATEGYPROFIT per day. It resets the variable each new day
    IF INTRADAYBARINDEX = 0 THEN

    NOTRADES = 0
    stratprofit = STRATEGYPROFIT //saves the previous day Profit
    ENDIF

    Y añadiendo esa condición a las líneas de ejecución, claro:

    // LONG Positions-Opening_________________________________________________________________________________________________
    // Alcistas
    IF alcista AND NOT fastbaja AND NOTRADE=0 THEN
    BUY positionsize CONTRACT AT MARKET
    SET TARGET pPROFIT profit1
    ENDIF

    Y al resto de ejecuciones.

    Tu sistema parece muy prometedor, espero poder verlo ya terminado. Buena suerte.

    #52459

    Hi Tempus,

    Thanks so much for your answer. I had a line with nomoretrade = 1 before, but I had it remove because I thought it didnt make a difference. I will try it now.

    I am also confused with the strategy profit. Roberto helped me to create a daily strategy profit and limit the losses and stoping the operations once you reached a target, just to avoid an overexposure to the market. Honestly, I don’t know if is working.

    The final idea is to stop trading for the day once you reach the profit, and if the operation is not going well averaging down (in both directions) and close the accumulation once the profit is >0. So, trying to generate a daily profit or a breakeven.

    Let you know of the results,

    Muchas gracias compañero.

    Juan

    P.S.- Perdona por el inglés, pero al haber abierto el hilo en el grupo de inglés, las reglas nos obligan a mantenerlo en inglés. Ya me han dado varios tokes…:)))

    #52462

    Juan,

    I have no much experince so don´t take my words too seriously but if I were you I will design and backtest the system first without the two parameters you are using: daily profit/loss limit and avering down (kind of martingala?). And when you think you have a good system you can try those ideas, but if you use them from the begining maybe your system is not good and only saved in the backtest because of those parameters. And I would not expect to get good results in the future with that system. In other words I think you would have more chances to datamining or overoptimization. Just my thought 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login