Variable inside IF-function gets set when condition not fulfilled

Forums ProRealTime English forum ProOrder support Variable inside IF-function gets set when condition not fulfilled

Viewing 3 posts - 1 through 3 (of 3 total)
  • #25731

    Hello all,

    I appreciate any help with the following. Disregarding the logic of the buying (which is here only for illustrative purposes), I have in the below code three different IF-clauses. The effect I want to achieve is that when one the clauses is fulfilled and a position is entered, it won’t be filled a second time, at least not before it has been sold. But this method doesn’t seem work in PRT. If I run this on any asset intraday, the code doesn’t take any positions at all. If I GRAPH the varible values, I see that SL1, SL2 and SL3 are set to 1 throughout the backtest-period from the first bar. It beats me what’s going on. Any ideas?

     

    #26132

    Try to defparam preloabars to zero to see if it fix the issue.

    #26165

    The line

    probably won’t behave as you want, since you are adding 10 to much lower values which results in a huge number, Say you are buying EurUsd and the CLOSE price il 1.0523, adding 10 to it produces 11.0523, which will NEVER be true!
    Try using PIPSIZE to sort it out, as follows:

     

    2 users thanked author for this post.
Viewing 3 posts - 1 through 3 (of 3 total)

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