count of number of Candelsticks

Forums ProRealTime English forum ProOrder support count of number of Candelsticks

  • This topic has 11 replies, 3 voices, and was last updated 1 year ago by avatarJS.
Viewing 12 posts - 1 through 12 (of 12 total)
  • #212814

    Hello,

    I have a problem of coding, If I have a support, Let’s say Support=10 and price cross under it, I want to count 10 candles, and buy only if price cross over support within 10 candles.

    thank’s in advance

    Alessio

    #212815
    JS

    Hi,

    You can try this…

    Support=10
    If Close Crosses Over Support and Summation[10](Close crosses under Support)=1 then
    Buy 1 contract at Market
    EndIf

    #212827

    Hi JS,

    thank you for your help.

    it’s the opposite but the meaning is that one.

    Support=10
    If Close Crosses under Support and Summation[10](Close crosses over Support)=1 then
    Buy 1 contract at Market
    EndIf

    I do not understand why you put “=1”

    it would be the same if I write Close>support?

     

    #212828

    wait, I’m not sure which code is correct. I want that price from above crosses under support, and then if price is able to cross over within 10 candles, buy at market

     

    #212829

    If I understand correctly your code, it buys at market only if price cross over support, then it goes down at least once and up again within 10 candles

    Support=10
    If Close Crosses Over Support and Summation[10](Close crosses under Support)=1 then
    Buy 1 contract at Market
    EndIf

     

    what I’m looking for is:

    price crosses down support, and then if it crosses over again within 10 candles, buy at market. If not, don’t buy.

    #212831

    In case JS is busy, I’ll add a bit so to keep you moving on your strategy 😉

    If you backtest JS code in a strategy with below added, you will see that the code works as you want.

     

     

    #212846

    Thank you Grahal,

    so this is correct:

    Support=10
    If Close Crosses Over Support and Summation[10](Close crosses under Support)=1 then
    Buy 1 contract at Market
    EndIf

    #212855

    Yes, the code is saying … if during the last 10 bars, price crossed under 10 once and once only; BUY when price crosses over 10.

    So the BUY would be on Bar 11 out of every count of 11 bars. Has to be else how could we count 1 (1 ONLY) crosses under over the last 10 bars?

     

     

     

     

    #212856

    The crosses-under could be on any bar from Bar 1 to Bar 10, so we could have a crosses under on Bar 10 then a crosses over on Bar 11 and that would satisfy the Conditions … is that what you want??

    I’m sure JS can sort you whatever you need and I can work it out in plain English (maybe?) 😉

    #212857

    If crosses under was ONLY on Bar[12] (meaning 12 bars ago) and crosses over is on Bar[0] (meaning current Bar then the conditions would not be satisfied and there would be no BUY trade executed.

    It’s best getting Conditions into a working Strategy and backtest it as then you can optimise the Bar Count etc and see if ever what you thought would work does actually work and make profit?

    Above is what I do anyway, also it’s more fun than pondering for ages, coding exact conditions which may not make any profit? 😉

    Also using the GRAPH function means you can see what is happening and so understand how the code works and so move onwards and upwards re coding knowledge?

    #212864

    thank you Grahal,

    my idea is that I give a defined time to recover the support. for example 10 bars. If it’s not able to re-cross over quite immediately that support, probably it’s a fake recover and it can go down again easily, so I don’t want to buy there but I wait for a better confirm if it break  a higher resistance.

    1 user thanked author for this post.
    #212880
    JS

    Hi @GraHal

    Thanks for paying attention to the matter…

    1 user thanked author for this post.
Viewing 12 posts - 1 through 12 (of 12 total)

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