one fit size strategy

Forums ProRealTime English forum ProOrder support one fit size strategy

Viewing 10 posts - 1 through 10 (of 10 total)
  • #212461

    Hi everyone,

    The name of the strategy is obviously ironic and conceptually wrong.

    Anyway, I practiced writing this strategy, but it doesn’t work because I have two error messages on lines 4 and 7. I would ask you to help me fix the code and make any changes you think are necessary if you believe it can be improved.

    Specifically, the strategy follows the market trend when the 50-period EMA is above the 100-period EMA, the ADX is above 20, the RSI is above 50, the MACD is above zero, the Stochastic is above 20, and the price is above the 20-period Bollinger moving average. In this case, a long position is opened with a market order, while the stop loss is set at twice the 14-period ATR below the market price and the profit target is set at three times the 14-period ATR above the market price.

    When the market is choppy, the strategy adopts a more cautious trading strategy. When the price crosses the Bollinger range, a long or short position is opened . In this case, the stop loss is set at twice the 14-period ATR above or below the market price and the profit target is set at three times the 14-period ATR above or below the market price.

    At least , I believe that what I have written outlines these rules. Sorry, but I am learning while having fun.

    Edo

     

    #212472

    Hi Edo,

    OrderCancelDelay is not a “system parameter” (I have no idea how to call these, set with DefParam), hence an error message on that one.
    Then probably some message on line 7 because line 4 has to be corrected first.

    What you intended with line 4 ? … no idea. 🙂 What was the idea about this line ?

    The name of the title is perfect. Now get it working !
    haha

    Peter

     

     

    #212474

    Hi Peter,

    eheh you’re right: the name of the strategy is perfect!…but , I say, the strategy itself… not exactly the same!

    Anyhow, in line 4 the value of “1” in this case should mean that the order will be cancelled after one bar, so if the order is not filled immediately, it will be cancelled in the next bar. As per your suggestion, I deleted line 4 but error in line 7 remains..

    ciao

    Edo

    #212475

    Ah, I only now see it myself … EMA is not an existing function. Look here on how to do it : https://www.prorealcode.com/documentation/average/

     

    in line 4 the value of “1” in this case should mean that the order will be cancelled after one bar

    If that is what you want, then let your code start with Sell At Market. Or better :

     

    1 user thanked author for this post.
    #212565

    OrderCancelDelay, Ema, Bollinger and ATR are not valid supported keywords.

    OrderCancelDelay does not exist.

    EMA must be replaced with Exponentialaverage[periods](source) or Average[periods,1](source).

    Bollinger needs to be either BollingerUP[periods](source) or BollingerDown[periods](source).

    ATR should be replaced with AverageTrueRange[periods](source).

     

    1 user thanked author for this post.
    #212618

    Hello everyone,

    I was finally able to finish my first code. I tested it on BTCUSD and I’m attaching a screenshot.

    Thank you in advance to those who want to try to improve it, if it’s worth it, by sharing here any enhancements.

    Edo

     

    #212634

    Congratulations ! Very well done.

    Keep in mind that backtesting is an art in itself. For example, being Long on Bitcoin over that period of time does not lose easily. Hence, try the same over the past one year and it could be more difficult.
    Still, well done because you applied your theories and they worked out. Looks easy but is not easy at all.

     

    1 user thanked author for this post.
    #213020

    Hi Edoardo,

    I’ve just seen your code and I’d like to backtest it.

    Before that I’m asking you why, at line 7, you wrote [100].  What does it mean ?

    Thanks for your reply and ………….. HAPPY EASTER TO EVEROBODY

    #213021

    Hi MaoRai54, and thank you for wanting to test my strategy.

    If you can improve it, that’s great. The 100 on line 7 is a typo, feel free to delete it.

    Happy Easter to you too!

    Edo

    1 user thanked author for this post.
    #213179

    Keep in mind that backtesting is an art in itself. For example, being Long on Bitcoin over that period of time does not lose easily. Hence, try the same over the past one year and it could be more difficult.

    yes backtest is an Art, You can take almost any strategy and you will see that it will always be positive at some point, and that will be comforting to you and because of that you may do a lot of stupid things, You always have to look and look hard and understand what’s going on,

    A little theory that might help you and it’s very simple, if for example your strategy is a Long strategy, then once you think your strategy is good you can try to backtest it on some periods in the past where you can see visually that the trend is down, if your Long strategy ends up with zero gains in a downtrend then I think you might have a winning strategy,

    Be careful not to optimize your strategy lot for the bear market in question otherwise it is cheating

    about your line :

    If your goal is to buy only after the condition candle (Candle 1) then this is already the case with the ProRealTime code your order will be cancelled at the next candle (Candle 3) if it is not filled at the previous candle (Candle 2)

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

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