Erreur de division par 0 (pas en back test)
Forums › ProRealTime forum Français › Support ProBuilder › Erreur de division par 0 (pas en back test)
- This topic has 4 replies, 3 voices, and was last updated 1 year ago by NathanC.
Viewing 5 posts - 1 through 5 (of 5 total)
-
-
09/18/2023 at 9:34 PM #221245
Bonjour quand je lance ce code, il retourne tjs une erreur de division par 0 (pas en backtest) , d’où peut-elle venir ?
Automated trading sys123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128//Source//multitf//https://www.prorealcode.com/topic/indicateurs-mtf-pour-prorealtime-disponible///capitalmanuel//https://www.prorealcode.com/topic/utiliser-le-capital-initial-dans-son-probacktest///https://www.prorealtime.com/fr/pdf/probuilder.pdf//https://www.prorealtime.com/fr/pdf/probacktest.pdf// Définition des paramètres du codeDEFPARAM CumulateOrders = False // Cumul des positions désactivéichi1 = 9ichi2 = 26ichi3 = 52//Tednance sur le autres timeframe// listing variable//UT+2timeframe(15 minutes)KIJUN15 = KijunSen[ichi1,ichi2,ichi3]TENKAN15 = TenkanSen[ichi1,ichi2,ichi3]SSA15 = SenkouSpanA[ichi1,ichi2,ichi3]SSB15 = SenkouSpanB[ichi1,ichi2,ichi3]//UT+1timeframe(5 minutes)KIJUN5 = KijunSen[ichi1,ichi2,ichi3]TENKAN5 = TenkanSen[ichi1,ichi2,ichi3]SSA5 = SenkouSpanA[ichi1,ichi2,ichi3]SSB5 = SenkouSpanB[ichi1,ichi2,ichi3]//UTtimeframe(1 minute)KIJUN = KijunSen[ichi1,ichi2,ichi3]TENKAN = TenkanSen[ichi1,ichi2,ichi3]SSA = SenkouSpanA[ichi1,ichi2,ichi3]SSB = SenkouSpanB[ichi1,ichi2,ichi3]//Indiquateur//Cassure kijunPrev1UnderKijunO = (open<KIJUN)Prev1UpperKijunO = (open>KIJUN)Prev1UnderKijunC = (close<KIJUN)Prev1UpperKijunC = (close>KIJUN)//TenkanPrev1UpperTenkanO = (open>TENKAN)Prev1UnderTenkanO = (open<TENKAN)Prev1UpperTenkanC = (close>TENKAN)Prev1UnderTenkanC = (close<TENKAN)//Nuage kumoPrev1UpperSSA = (close>SSA)Prev1UpperSSB = (close>SSB)Prev1UnderSSA = (close<SSA)Prev1UnderSSB = (close<SSB)//Tendance//BaisseHausseUT = open > SSA and SSA > SSBBaisseUT = open < SSA and SSA < SSBHausseUT1 = open > SSA5 and SSA5 > SSB5BaisseUT1 = open < SSA5 and SSA5 < SSB5HausseUT2 = open > SSA15 and SSA15 > SSB15BaisseUT2 = open < SSA15 and SSA15 < SSB15//Money managementONCE Capital = 3500ONCE Risk = 0.005equity = Capital + StrategyProfitmaxrisk = round(equity*Risk)SLLong= abs( close - LOWEST[10](low))SLShort = abs( close - Highest[10](high))PositionSizeL = abs(round((maxrisk/SLLong)/PointValue)*pipsize)PositionSizeS = abs(round((maxrisk/SLShort)/PointValue)*pipsize)//ORDER Achat://Kijun//close 2 avant sskijun// close prev au dessus// close pre au dessus tenkan// prev au dessus du nage SSA-SSB// convergence UT UT1 UT2IF Prev1UnderKijunO AND Prev1UpperKijunC AND Prev1UpperTenkanC AND Prev1UpperSSA AND Prev1UpperSSB and HausseUT and HausseUT1 and HausseUT2 THENSELLSHORT PositionSizeS SHARES AT MARKETSET STOP LOSS SLShorttype = 1ENDIF//fermeture ss kijunIF Prev1UnderKijunC AND type = 1 THENEXITSHORT AT MARKETtype = 0ENDIF//tenkan(descri)//close 2 avant sstenkan// close prev au dessus tenkan// close pre au dessus kijun// prev au dessus du nage SSA-SSB// convergence UT UT1 UT2IF Prev1UnderTenkanO AND Prev1UpperTenkanC AND Prev1UpperKijunC AND Prev1UpperSSA AND Prev1UpperSSB AND HausseUT and HausseUT1 and HausseUT2 and type<>1 THENSELLSHORT PositionSizeS SHARES AT MARKETSET STOP LOSS SLShorttype = 2ENDIF//fermeture ss kijunIF Prev1UnderTenkanC AND type = 2 THENEXITSHORT AT MARKETtype =0ENDIF//Order Sell//close 2 avant au dessuskijun// close prev en dessous// close pre au dessous tenkan// prev au dessous du nage SSA-SSB// convergence UT UT1 UT2IF Prev1UpperKijunO AND Prev1UnderKijunC AND Prev1UnderTenkanC AND Prev1UnderSSA AND Prev1UnderSSB AND BaisseUT and BaisseUT2 AND BaisseUT1 THENBUY PositionSizeL SHARES AT MARKETSET STOP LOSS SLLongtype = 3ENDIF//fermeture haut kijunIF Prev1UpperKijunC AND type = 3 THENSELL AT MARKETtype = 0ENDIF//tenkan(descri)//close 2 avant au dessustenkan// close prev en dessous tenkan// close pre en dessous kijun// prev en dessous du nuage SSA-SSB// convergence UT UT1 UT2IF Prev1UpperTenkanO AND Prev1UnderTenkanC AND Prev1UnderKijunC AND Prev1UnderSSA AND Prev1UnderSSB AND BaisseUT and BaisseUT2 AND BaisseUT1 AND type<>3 THENBUY PositionSizeL SHARES AT MARKETSET STOP LOSS SLLongtype = 4ENDIF//fermeture haut tenkanIF Prev1UpperTenkanC AND type = 4 THENSELL AT MARKETtype = 0ENDIFMerci !
09/19/2023 at 7:32 AM #221247Sauf erreur de ma part, les seules divisions que je vois dans ton code se situent aux lignes 74 et 75:
PositionSizeL = abs(round((maxrisk/SLLong)/PointValue)*pipsize)PositionSizeS = abs(round((maxrisk/SLShort)/PointValue)*pipsize)Il faudrait donc s’assurer que SLLong et SLShort soit bien supérieur à 0 avant de faire ces calculs et aussi pour lancer des ordres.09/19/2023 at 7:39 AM #221248Merci pour la réponse, j’ai eu le même raisonnement, c’est pour ca que dans le calcul SLlong et SL short j’ai mi abs :
SLLong= abs( close – LOWEST[10](low))SLShort = abs( close – Highest[10](high))cela ne certifie pas une valeurs positive ?
09/19/2023 at 8:16 AM #22125209/19/2023 at 11:20 AM #221265 -
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
Find exclusive trading pro-tools on
Similar topics: