Storing a met condition in a previous bar

Forums ProRealTime English forum ProOrder support Storing a met condition in a previous bar

Viewing 10 posts - 16 through 25 (of 25 total)
  • #115967

    On the 3rd the average cross happened and crossflag was set to 1 and averagecrosslong was set to 1 but abovebollinger is 0.

    On the 4th crossflag is still valid but abovebollinger is still 0 so no order is sent.

    On the 5th crossflag switches to 0 because an order is sent to buy and abovebollinger is set to 1 because that condition is now true.

    On the open of the 6th a trade is opened.

    Everything is as it should be.

    I would suggest graphing the value of the averages in your code and double check that they are the same as those on your chart.

     

    #115968

    So I’ve graphed the instrument values (see first screengrab). Now we can see the problem (finally!)

    “Boll middle” is listed as 10,158

    “Average[21]” is listed as 10,274

    They are different values, but I’ve been working on the basis that Average[21] in code should refer to the black “Boll Middle” line. I’m using “Average[21]” because it is suggested to me as the code for the middle bollinger (as you can see from the other screengrab).

    What is the code I should use to make sure I call up “Boll Middle” from Pro Order?

    #115974

    Check in your Bollinger Band indicator settings that everything is the same. Perhaps you have it set to use a simple average instead of an exponential average or maybe it is based on a different price to closing price?

    Also consider using BOLLINGERUP and BOLLINGERDOWN and calculating the mid point between them.

    .

    #115978

    It’s just the standard 21, 0.1 based on close (see screengrab). I’ve tried every combination in that box to try and return the value of 10,274, but none of them do. I can’t understand why indicator Average[21] is returning 10,274. There is also disparity between the EMoving Average 8 reading and my coded ExponentialAverage[8].

    Is “Average[21](close)” the right syntax here? Or is there something else I should use?

    #115980

    You have something set wrong as your code uses a simple 21 period moving average of closing price. I have drawn it on my own chart four ways and they are all identical.

    • Simple Bollinger mid line.
    • Average[21](close) returned
    • Average[21,0](close) returned
    • and the PRT built in average indicator.
    #115982

    These are the only settings I can see for the Bollinger (see screengrabs). What should I change?

    #115985

    They are all the same for me!!!!

    1 user thanked author for this post.
    #116060

    I tried to create a new chart from scratch and I got the same disparity. I then created a whole load of charts on different markets and there was no problem! It seems this is exclusive to the Bitcoin DFB chart (XBTUSD) on PRT linked to IG.

    Thank you for your help. It is useful for me in future to know that I can graph instruments to double check unusual results.

    #116076

    Yes GRAPH and GRAPHONPRICE are very useful debugging tools.

    I would send a technical report to PRT via your platform regarding the Bitcoin averaging problem if I was you (although it will go via IG so PRT may never receive it!)

    #116198

    On a similar theme to the above system, I’m trying to store met conditions for an entry that will only occur a number of bars after the first condition.

    There are three entry rules for this system:

    RSI goes above 80

    RSI then drops below 75

    RSI then rises above 80 again

    I’ve coded it with similar principles to how you coded the two-rule code earlier in this thread, but I knew that it wouldn’t work because in code the first rule appears exactly the same as the third rule. When I use only the first two rules, it correctly enters when RSI drops below 75, so how do I store the first two conditions and then code a third rule to work after the first two? I’m aware that I can change the first and second rules to only act in previous bars with [5] or [6] for example, but this seems messy. Is there a clean way of creating three rules that act sequentially?

     

Viewing 10 posts - 16 through 25 (of 25 total)

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