count an occurrence relative to the last value

Forums ProRealTime English forum ProOrder support count an occurrence relative to the last value

  • This topic has 11 replies, 2 voices, and was last updated 6 years ago by avatarBe-n.
Viewing 12 posts - 1 through 12 (of 12 total)
  • #108459

    Hello everybody !

    I have a puzzle to submit to you. Here is my problem :

    Whenever a closing is strictly greater than a certain percentage since my last position, I indicate it on my graph as follows :

    At my last closing, I have an increase of 2.43% (bonus=2)

    Where :

    my question :

    How to know how many times lastclose was greater than 2% (that is to say bonus=2) ? Let’s say this case (bonus = 2) has occurred 10 times since the start of my strategy.

    I imagine that a loop is necessary …

    Thx in advance for your time and explanations … and sorry for my english !

    #108461

    You don’t need a loop if you check the condition on each candlestick close. Just make an increment of a variable each time bonus=2 and that’s enough.

    #108462

    Thx Nicolas !

    But if I have an increase of 1.43% ($bonus=1) the next time… and so on…

    How do I get the number of occurrences where $bonus = 1 from the beginning of my strategy if $lastclose = 1.43 ? :/

    #108465

    Sorry, I might not understand what you want or!? Count occurrences by incrementing a variable:

     

     

    #108482

    No problem Nicolas. I misspoke. I replaced ‘Bonus‘ by ‘Earnings‘ for more readability.

    I would like my last result (‘LastClose‘ = 1.43) determine how many times this same result was found previously in my strategy. I attach to my example a picture of my board.

    In this example, if (‘LastClose‘ = 1.43), I would like to determine how many times this result has already been found 7 times previously (‘Earnings‘ = 1) since the beginning of my strategy (red sticks).

    In this example, if (‘LastClose‘ = 2.14), I would like to determine how many times this result has already been found 4 times previously (‘Earnings‘ = 2) since the beginning of my strategy (red sticks).

    And so on…

    Here is a very simple strategy in order to know where I want to go :

    So I thought to make this loop :

    I hope it’s clearer for you … Thanks in advance !

    #108508

    Ok but you confirm that the statistic is calculated with closed orders, right?

    #108510

    Absolutely Nicolas … If I correctly understand your question, the result (statistic?) is determined by the closing of a candle …

    #108512

    closed orders = orders not at market anymore.

    To make it shorter: you want to know how many orders achieved gain above 1%, 2% and 3% since the start of the strategy? But only after their closure? (or while they were opened? = at market).

    #108678

    Hi Nicolas, sorry for my late answer. I thought I had a solution but no…

    I wish to know how many orders achieved gain above 1%, 2% and 3% (for example) since the start of the strategy after the closure of my orders. Thx in advance ! 😉

    #108682

    For instance, a rough solution for 1% one (and not tested, please do):

     

     

    #108688

    Thx Nicolas ! The SUMMATION function seems a good way !

    On the other hand, it requires to enter a fixed value, (1 in your example). In this case, it works perfectly. However, this value changes during my strategy. In my example, this value can be 1 or 2 or 3 but potentially more. The idea would be to use a variable. In this case, it would give :

    code :

    Where ‘Result‘ correspond to :

    But there, it doesn’t work unfortunately …

    I think you understand what I want to do. A big thx for your help ! 😉

    #108690

    Sorry this code is better :

    Whenever the last result (‘Result’) was equal to the same previous results (‘Earnings=Result’)

    Thx !

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