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…
Doh!! That explains it – thank you.
Use Parentheses instead of brackets:
graph PositionPerf(1)
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)…
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.
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)….
Sorry, should have include this picture to explain what I mean…
PositionPerf(1) is the positionperf of the trade the prior candle.
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…
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)
aha… yes, I think you are right. My brain was not properly in gear – thank you!