aiuto su codici pivot
Forums › ProRealTime forum Italiano › Supporto ProOrder › aiuto su codici pivot
- This topic has 6 replies, 2 voices, and was last updated 7 years ago by Nicolas.
-
-
09/22/2017 at 11:03 AM #46911
vorrei creare un codice che
entra short quando il prezzo incrocia a rialzo pivot resistenza 1 e lo stesso resistenza 2 e 3
entra long quando il prezzo incrocia a ribasso supporto 1 2 e 3
stop loss 10 punti (da ottimizzare)
profit dopo 5 punti
grazie
09/22/2017 at 12:30 PM #46921Ho codificato la strategia per te, ti preghiamo di trovarla qui sotto:
1234567891011121314151617181920212223242526272829303132333435363738394041defparam cumulateorders=false//Pivot calculation methodOnce mode = 1Once dailyPivot = undefinedOnce dailyR1 = undefinedOnce dailyS1 = undefinedOnce dailyR2 = undefinedOnce dailyS2 = undefinedOnce dailyR3 = undefinedOnce dailyS3 = undefinedIf Day>Day[1] thenIf mode = 0 thendailyPivot = (DHigh(1) + DLow(1) + Close[1]) / 3Elsif mode = 1 thendailyPivot = (Open + DHigh(1) + DLow(1) + Close[1]) / 4Elsif mode = 2 thendailyPivot = (DHigh(1) + DLow(1) + Close[1]*2) / 4ElsedailyPivot = (Open*2 + DHigh(1) + DLow(1)) / 4EndifdailyR1 = 2*dailyPivot - DLow(1)dailyS1 = 2*dailyPivot - DHigh(1)dailyR2 = dailyPivot + (DHigh(1) - DLow(1))dailyS2 = dailyPivot - (DHigh(1) - DLow(1))dailyR3 = dailyR1 + (DHigh(1) - DLow(1))dailyS3 = dailyS1 - (DHigh(1) - DLow(1))Endifif close crosses over dailyr1 or close crosses over dailyr2 or close crosses over dailyr3 thenbuy 1 contract at marketendifif close crosses under dailys1 or close crosses under dailys2 or close crosses under dailys3 thensellshort 1 contract at marketendifset target pprofit 5set stop ploss 1009/22/2017 at 1:05 PM #4692609/22/2017 at 1:36 PM #46935ciao Nicolas
ma dal backtest vedo che il codice non entra quando il prezzo incrocia a rialzo o a ribasso il pivot o non sempre
09/22/2017 at 1:38 PM #46944Non ero ancora sicuro del livello del perno, ecco il codice modificato di conseguenza:
1234567891011121314151617181920212223242526272829303132333435363738394041defparam cumulateorders=false//Pivot calculation methodOnce mode = 1Once dailyPivot = undefinedOnce dailyR1 = undefinedOnce dailyS1 = undefinedOnce dailyR2 = undefinedOnce dailyS2 = undefinedOnce dailyR3 = undefinedOnce dailyS3 = undefinedIf Day>Day[1] thenIf mode = 0 thendailyPivot = (DHigh(1) + DLow(1) + Close[1]) / 3Elsif mode = 1 thendailyPivot = (Open + DHigh(1) + DLow(1) + Close[1]) / 4Elsif mode = 2 thendailyPivot = (DHigh(1) + DLow(1) + Close[1]*2) / 4ElsedailyPivot = (Open*2 + DHigh(1) + DLow(1)) / 4EndifdailyR1 = 2*dailyPivot - DLow(1)dailyS1 = 2*dailyPivot - DHigh(1)dailyR2 = dailyPivot + (DHigh(1) - DLow(1))dailyS2 = dailyPivot - (DHigh(1) - DLow(1))dailyR3 = dailyR1 + (DHigh(1) - DLow(1))dailyS3 = dailyS1 - (DHigh(1) - DLow(1))Endifif close crosses over dailyr1 or close crosses over dailyr2 or close crosses over dailyr3 or close crosses over dailypivot thenbuy 1 contract at marketendifif close crosses under dailys1 or close crosses under dailys2 or close crosses under dailys3 or close crosses under dailypivot thensellshort 1 contract at marketendifset target pprofit 5set stop ploss 1009/22/2017 at 3:25 PM #46970ciao Nicolas
scusami ma io sono alle prime armi
non esitite un comando che fa entrate appena il prezzo tocca il pivot e non alla chiusura della barra?
09/25/2017 at 11:53 AM #47239Dovrebbe essere possibile con questo codice:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657defparam cumulateorders=false//Pivot calculation methodOnce mode = 1Once dailyPivot = undefinedOnce dailyR1 = undefinedOnce dailyS1 = undefinedOnce dailyR2 = undefinedOnce dailyS2 = undefinedOnce dailyR3 = undefinedOnce dailyS3 = undefinedIf Day>Day[1] thenIf mode = 0 thendailyPivot = (DHigh(1) + DLow(1) + Close[1]) / 3Elsif mode = 1 thendailyPivot = (Open + DHigh(1) + DLow(1) + Close[1]) / 4Elsif mode = 2 thendailyPivot = (DHigh(1) + DLow(1) + Close[1]*2) / 4ElsedailyPivot = (Open*2 + DHigh(1) + DLow(1)) / 4EndifdailyR1 = 2*dailyPivot - DLow(1)dailyS1 = 2*dailyPivot - DHigh(1)dailyR2 = dailyPivot + (DHigh(1) - DLow(1))dailyS2 = dailyPivot - (DHigh(1) - DLow(1))dailyR3 = dailyR1 + (DHigh(1) - DLow(1))dailyS3 = dailyS1 - (DHigh(1) - DLow(1))Endifif close>dailyr3 thensellshort 1 contract at dailyr3 stopelsif close<dailyr3 and close>dailyr2 thensellshort 1 contract at dailyr2 stopbuy 1 contract at dailyr3 stopelsif close<dailyr2 and close>dailyr1 thensellshort 1 contract at dailyr1 stopbuy 1 contract at dailyr2 stopelsif close<dailyr1 and close>dailypivot thensellshort 1 contract at dailypivot stopbuy 1 contract at dailyr1 stopelsif close<dailypivot and close>dailys1 thensellshort 1 contract at dailys1 stopbuy 1 contract at dailypivot stopelsif close<dailys1 and close>dailys2 thensellshort 1 contract at dailys2 stopbuy 1 contract at dailys1 stopelsif close<dailys2 and close>dailys3 thensellshort 1 contract at dailys3 stopbuy 1 contract at dailys2 stopelsif close<dailys3 thenbuy 1 contract at dailys3 stopendifset target pprofit 5set stop ploss 10Questo codice utilizza ordini in sospeso, è consapevole che per utilizzare questo tipo di ordini, il prezzo effettivo deve essere conforme alle limitazioni del broker per metterle sul mercato (almeno X pips dal prezzo)
Non l’ho provata, per favore le tue simulazioni e le tue prove e per ricevere feedback…. -
AuthorPosts