Problème pour faire fonctionner PositionPerf
Forums › ProRealTime forum Français › Support ProOrder › Problème pour faire fonctionner PositionPerf
- This topic has 10 replies, 3 voices, and was last updated 2 years ago by
Nicolas.
-
-
09/12/2022 at 3:51 PM #200632
Bonjour,
Je ne parviens pas à faire fonctionner la fonction Positionperf dans ma stratégie d’achat du cac40:
12345678910111213DEFPARAM CumulateOrders = Falseindicator1 = Average[20](close)c1 = (close CROSSES OVER indicator1)IF NOT LongOnMarket and c1 THENBUY 1 CONTRACT AT MARKETENDIFIF LONGONMARKET AND positionperf>0.1 THENSET TARGET %PROFIT 0.3SET STOP TRAILING 4ENDIFMerci d’avance à celui qui pourra m’aiguiller.
Cordialement,
Stéphane
09/12/2022 at 5:09 PM #20064409/13/2022 at 8:05 AM #20066909/13/2022 at 8:12 AM #200670Ok, as-tu fait un
1GRAPH positionperfpour vérifier que la valeur est juste pour activer tes instructions des lignes 10 et 11 ?
Si le problème persiste, j’aimerai le reproduire avec un exemple concret merci 🙂 (indiquer timeframe, instrument svp).
09/13/2022 at 8:42 AM #20067709/13/2022 at 9:37 AM #200682Essaye ça:
123456789IF close CROSSES OVER average[20,0](close) thenbuy 1 contract at marketset target %profit 1set stop %loss 1endifgraph PositionPerf AS "Performance MultiPlier"graph PositionPerf * 100 AS "Performance %"graph PositionPerf*PositionPrice AS "Profit/Loss"graphonprice PositionPrice AS "Average Price"09/13/2022 at 9:52 AM #20068309/13/2022 at 10:06 AM #200684En effet, fait un backtest et tu verras l’utilité de cette instruction qui te permet de débugger.
Ton code devrait être comme suit pour que tu puisses visualiser le positionperf lors d’un backtest:
123456789101112131415DEFPARAM CumulateOrders = Falseindicator1 = Average[20](close)c1 = (close CROSSES OVER indicator1)IF NOT LongOnMarket and c1 THENBUY 1 CONTRACT AT MARKETENDIFIF LONGONMARKET AND positionperf>0.1 THENSET TARGET %PROFIT 0.3SET STOP TRAILING 4ENDIFgraph positionperf09/13/2022 at 11:46 AM #20068909/14/2022 at 10:18 AM #20078009/14/2022 at 10:28 AM #200781Comme l’indiquai Roberto, pour obtenir positionperf en pourcentage il faut le multiplier par 100. Car positionperf est un ratio du prix actuel vis à vis du prix d’entrée, problème de sémantique ici .. 🙄
Donc ton code devrait être plutôt :
123456789101112131415DEFPARAM CumulateOrders = Falseindicator1 = Average[20](close)c1 = (close CROSSES OVER indicator1)IF NOT LongOnMarket and c1 THENBUY 1 CONTRACT AT MARKETENDIFIF LONGONMARKET AND positionperf*100>0.1 THENSET TARGET %PROFIT 0.3SET STOP TRAILING 4ENDIFgraph positionperf -
AuthorPosts