barindex code trouble

Forums ProRealTime English forum ProOrder support barindex code trouble

Viewing 9 posts - 1 through 9 (of 9 total)
  • #162078

    hi,

    i am having some trouble to barindex code. please see picture. lets just say i am at candle number 2 marked on the picture. forget the rest of the candles that come after it. i want to sell 2 contracts at candle number 2 when the difference of (close[candle number 1] – close[which is the latest candle] > 30 pips). please help.

     

    #162080

    and also i do not know how many candles are in between candle number 1 and 2.

    thank you

    #162081

    Try replacing line 6 with:

    To see what’s the barindex number in ProBackTest you can append this line to your code:

    which will show you the value BARINDEX retains each bar, in the variable window of ProBackTest.

    To know how many bars there are between the two candles you need to know the BARINDEX value of candle 1 (you can use a variable to store that value), then calculate the difference.

     
    #162082

    i have done what you have suggested and the barindex graph showed an increase of 1 on every candle.  Can you correct me if  i have stored the barindex at candle number 1 correctly? it is line number 7 “buyindex = barindex[a]”.

    #162084

    Yes, that’s correct.

     

    #162086

    thanks!

    #162155

    hi,

    how do i change the period so that it is equal to the barindex of the recent longconditions? and when the line number 12,13,14 is satisfied the period stops.

     

    #162159

    I’m not sure that I fully understand what you are trying to do but:

     

    #162163

    kevin12345 – You started another topic about exactly the same piece of code being discussed here. Please avoid double posting as per the forum rules as it just leads to confusion and wasted time. I also noticed that you posted this first topic in the wrong forum. I have moved it to the right forum (ProOrder as you are discussing strategy code) and merged your second post (because I had already replied to it) on exactly the same topic with this first one.

    Please read and stick to the forum rules with all future posts to save moderators from having to do a lot of tidying up for you.

    Post your topic in the correct forum:
    _ ProRealTime Platform Support: only platform related issues.
    _ ProOrder: only strategy topics.
    _ ProBuilder: only indicator topics.
    _ ProScreener: only screener topics
    _ General Discussion: any other topics.
    _ Welcome New Members: for new forum members to introduce themselves.

    • Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.

     

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

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