positionperf [n] not working?

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #169091 quote
    verygrubby
    Participant
    Master
    IF time=143000 THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pLOSS 25
    SET TARGET pPROFIT 25
    
    
    graph positionperf[1]
    

    I might have forgotten how this works, but I thought positionperf[n] was supposed to return the % performance of the nth previous closed position… ie if we graph positionperf[1], we should see the value update as each trade closes, and that value should stay there until another trade closes – ie it should never reset to no value… however you can see in the attached that it seems to reset to 0 when a trade closes, and we don’t get a value for every trade…

    Is this a bug, or have I misunderstood what positionperf[n] is supposed to show?

    Thanks all…

    Screenshot-2021-05-08-at-09.58.34.png Screenshot-2021-05-08-at-09.58.34.png
    #169094 quote
    JC_Bywan
    Moderator
    Master

    Hi, positionperf is with ( ) not [ ] : https://www.prorealcode.com/documentation/positionperf/

    #169095 quote
    verygrubby
    Participant
    Master

    Doh!! That explains it – thank you.

    #169100 quote
    robertogozzi
    Moderator
    Master

    Use Parentheses instead of brackets:

    graph PositionPerf(1)
    #169104 quote
    verygrubby
    Participant
    Master

    OK, same code as before, but I changed it to ().  It seems to not update for all trades? eg the trades on 30th April & 6th May have not updated positionperf(1)…

    Screenshot-2021-05-08-at-12.19.37.png Screenshot-2021-05-08-at-12.19.37.png
    #169109 quote
    robertogozzi
    Moderator
    Master

    PositionPerf only updates the current trade, when it exits PorsitionPerf is reset to 0 for the next trade AND StrategyProfit is updated adding to itself  the final PositionPerf (before it is reset.

    So, for the total report of Gains/Losses of CLOSED trades STRATEGYPROFIT is the system constant to refer to.

    #169113 quote
    verygrubby
    Participant
    Master

    Yes, for positionperf – but positionperf(1) should always show the last closed trade, right? That’s what I graphed in the last picture I posted. You can see that it oscillates above and below 0 as the trades win or lose (as expected), but it seems to miss the occasional trade (eg it only updated for 6/8 trades in the picture)….

    #169114 quote
    verygrubby
    Participant
    Master

    Sorry, should have include this picture to explain what I mean…

    Screenshot-2021-05-08-at-14.21.47.png Screenshot-2021-05-08-at-14.21.47.png
    #169122 quote
    robertogozzi
    Moderator
    Master

    PositionPerf(1) is the positionperf of the trade the prior candle.

    #169125 quote
    verygrubby
    Participant
    Master

    It should be the percent of gain or loss of the Nth previous position. Regardless of when you call it, it should show the gain/loss of the previous closed position. You can see from my picture that it updates each time a position closes, and the value stays the same until another position closes. It doesn’t reset to 0 (and I don’t want it to!)

    My problem is that it seems to not update for various random trades…. I can’t work out why…

    #169126 quote
    JC_Bywan
    Moderator
    Master

    Both examples you show in your graph are in case of 2 consecutive trades being the same in points (equity curve has gone up twice in a row or down twice in a row by gain/loss for same 25pts amount), so it’s not that positionperf is not updated, it’s most likely updated to almost same percentage value (same gain in points over an asset not far off its previous value in points)

    #169127 quote
    verygrubby
    Participant
    Master

    aha… yes, I think you are right. My brain was not properly in gear – thank you!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

positionperf [n] not working?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
verygrubby @verygrubby Participant
Summary

This topic contains 11 replies,
has 3 voices, and was last updated by verygrubby
4 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/08/2021
Status: Active
Attachments: 3 files
Logo Logo
Loading...