Candlestick calculation doesn’t seem to work

Forums ProRealTime English forum ProOrder support Candlestick calculation doesn’t seem to work

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

    Hi,

    This is my first post here! I’m trying to backtest an idea where I calculate and measure the different parts of the candlesticks. I want to calculate the lower wick and if it is bigger than the higher wick it’s an entry signal. However it doesent seem to be working, it gives random results. This is the code:

    I have created an indicator with the same calculation of the wick and this seem to be working fine, see attached picture. You can also see in the attached picture that entries is not according to my expected behaviour. What am I missing?

    Best regards

    #233521

    Hi. The problem with your code comes when you have two or more bars “hammer” type.
    When a hammer bar appears the system buy 1 contract in the next bar open and sells after 1 bar.
    If you have 2 consecutive hammer bars the second one doesn’t exits for the system.
    In order to avoid it we can change the code like this:

    if there are 3 consecutive candles with hammer type you should be on market 3 bars.

    2 users thanked author for this post.
    #233522

    Is the Timeframe your displaying in image, the same as the running backtest code , image suggests no.

    What was your expected behaviour for the result.

    1 user thanked author for this post.
    #233524

    Thank you very much for your replies!

    It still doesn’t seem to work though. The picture is the same timeframe as the backtest.

    What I want to achieve is to have a backtest that buys when the wick under the body is x times as big as the wick above the body. I have updated my code with the input from above and also added the criteria that the wick under the body should be 3 times bigger than the one above in order for it to be easier to spot if it works or not.

     

    #233527

    Try this,

    Comment out lines 15, 22 and 23  by placing // at the beginning of these lines

    15. Exiting after 1 bar seems to go against staying in.

    22,23 If in market, buying and then selling same qty is the same as staying in market at current qty.

    25. Then only sell if in market and closing bar is not a hammer.

    The logic appears to be ,

    If not on market, Buy at Market  on a Hammer,

    If on market sell Market  on  NOT hammer

    1 user thanked author for this post.
    #233538

    Thank you, I have tried this but with no luck. There seems to something else that is off… I have made the code even more basic to prove the point -> buy all times condition is met. Result is that the system is buying at correct points mostly but sometimes it’s off. Sometimes it indicates two orders same day but with different execution dates (see picture). There must be something that is not in sync?

     

    #233548
    JS

    Hi,

    What you show (two orders/day) probably only happens on Friday…?

    1 user thanked author for this post.
    #233551

    Yes, that is correct – it’s on a friday. Why is it that way? It shows entry the date day after (saturday), that must be wrong?

    #233552
    JS

    Hi,

    Is IG that is “out of sync”…

    IG has a very nasty “Sunday candle”…

    What happens is: buy on Friday and then again on Sunday and then again on Monday… And when the option “don’t show weekend dates” is enabled, then the Sunday order shifts to Friday, hence the two orders on one day…

    1 user thanked author for this post.
    #233557

    Thank you very much for that insight, explaines a whole lot for my strategies.. Thanks again!

    1 user thanked author for this post.
    avatar JS
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