Utilizzo Indicatore personalizzato per strategia
Forums › ProRealTime forum Italiano › Supporto ProOrder › Utilizzo Indicatore personalizzato per strategia
- This topic has 3 replies, 2 voices, and was last updated 4 years ago by Giovanni Belli.
-
-
05/04/2020 at 11:27 AM #129798
Ciao, creato un indicatore che riesca ad identificare le formazioni di candle pattern più significative. Ora volevo utilizzare lo stesso criterio per generare una strategia di lavoro ma il programma mi segnala una serie di errori. Dove sbaglio?
Grazie
allego codice e allarme:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711// Definizione dei parametri del codiceDEFPARAM CumulateOrders = False // Posizioni cumulate disattivate// Il sistema cancellerà tutti gli ordini in attesa e chiuderà tutte le posizioni a 0:00. Dopo l'orario "Flat Before" non saranno piazzati nuovi ordini o posizioni.DEFPARAM FLATBEFORE = 083000// Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all'orario "Flat After"DEFPARAM FLATAFTER = 201500// Impedisce al sistema di tradare in giorni specifici della settimanadaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0atr = averagetruerange[10](close)*0.5body=close[1]-open[1]body1=close[2]-open[2]body2=close[3]-open[3]body3=close[4]-open[4]body4=close[5]-open[5]abody=abs(body)abody1=abs(body1)abody2=abs(body2)abody3=abs(body3)abody4=abs(body4)if range>0 thenratio=abody/rangeelseratio=0endifdimension=abody/(averagetruerange[50]*2)dimension1=abody1/(averagetruerange[50]*2)dimension2=abody2/(averagetruerange[50]*2)dimension3=abody3/(averagetruerange[50]*2)dimension4=abody4/(averagetruerange[50]*2)lunga=dimension > 0.3 and dimension <1extralunga=dimension > 1piccola=dimension<0.3extrapiccola=dimension > 0 and dimension <0.1lunga1=dimension1 > 0.3 and dimension1 <1extralunga1=dimension1 > 1piccola1=dimension1<0.3extrapiccola1=dimension1 > 0 and dimension1 <0.1lunga2=dimension2 > 0.3 and dimension2 <1extralunga2=dimension2 > 1piccola2=dimension2<0.3extrapiccola2=dimension2 > 0 and dimension2 <0.1lunga3=dimension3 > 0.3 and dimension3 <1extralunga3=dimension3 > 1piccola3=dimension3<0.3extrapiccola3=dimension2 > 0 and dimension2 <0.1lunga4=dimension4 > 0.3 and dimension4 <1extralunga4=dimension4 > 1piccola4=dimension4<0.3extrapiccola4=dimension4 > 0 and dimension4 <0.1mid=(open[1]+close[1])/2mid1=(open[2]+close[2])/2mid2=(open[3]+close[3])/2mid3=(open[4]+close[4])/2mid4=(open[5]+close[5])/2Sbratio=0Sbratio1=0Sbratio2=0Sbratio3=0Sbratio4=0if (shadowbottom / abody)<0.15 thenSbratio=1elseif (shadowbottom / abody) > 0.15 and (shadowbottom / abody) < 1 thenSbratio=2if (shadowbottom / abody) > 1 and (shadowbottom / abody) < 2 thenSbratio=3if (shadowbottom / abody) > 2 thenSbratio=4endifendifendifendifif (shadowbottom1 / abody1)<0.15 thenSbratio1=1elseif (shadowbottom1 / abody1) > 0.15 and (shadowbottom1 / abody1)< 1 thenSbratio1=2if (shadowbottom1 / abody1) > 1 and (shadowbottom1 / abody1) < 2 thenSbratio1=3if (shadowbottom1 / abody1) > 2 thenSbratio1=4endifendifendifendifif (shadowbottom2 / abody2)<0.15 thenSbratio2=1elseif (shadowbottom2 / abody2) > 0.15 and (shadowbottom2 / abody2) < 1 thenSbratio2=2if (shadowbottom2 / abody2) > 1 and (shadowbottom2 / abody2) < 2 thenSbratio2=3if (shadowbottom2 / abody2) > 2 thenSbratio2=4endifendifendifendifif (shadowbottom3 / abody3)<0.15 thenSbratio3=1elseif (shadowbottom3 / abody3) > 0.15 and (shadowbottom3 / abody3) < 1 thenSbratio3=2if (shadowbottom3 / abody3) > 1 and (shadowbottom3 / abody3) < 2 thenSbratio3=3if (shadowbottom3 / abody3) > 2 thenSbratio3=4endifendifendifendifif (shadowbottom4 / abody4)<0.15 thenSbratio4=1elseif (shadowbottom4 / abody4) > 0.15 and (shadowbottom4 / abody4) < 1 thenSbratio4=2if (shadowbottom4 / abody4) > 1 and (shadowbottom4 / abody4) < 2 thenSbratio4=3if (shadowbottom4 / abody4) > 2 thenSbratio4=4endifendifendifendifStratio=0Stratio1=0Stratio2=0Stratio3=0Stratio4=0if (shadowtop / abody)<0.15 thenStratio=1elseif (shadowtop / abody) > 0.15 and (shadowtop / abody) < 1 thenStratio=2if (shadowtop / abody) > 1 and (shadowtop / abody) < 2 thenStratio=3if (shadowtop / abody) > 2 thenStratio=4endifendifendifendifif (shadowtop1 / abody1)<0.15 thenStratio1=1elseif (shadowtop1 / abody1) > 0.15 and (shadowtop1 / abody1) < 1 thenStratio1=2if (shadowtop1 / abody1) > 1 and (shadowtop1 / abody1) < 2 thenStratio1=3if (shadowtop1 / abody1) > 2 thenStratio1=4endifendifendifendifif (shadowtop2 / abody2)<0.15 thenStratio2=1elseif (shadowtop2 / abody2) > 0.15 and (shadowtop2 / abody2) < 1 thenStratio2=2if (shadowtop2 / abody2) > 1 and (shadowtop2 / abody2) < 2 thenStratio2=3if (shadowtop2 / abody2) > 2 thenStratio2=4endifendifendifendifif (shadowtop3 / abody3)<0.15 thenStratio3=1elseif (shadowtop3 / abody3) > 0.15 and (shadowtop3 / abody3) < 1 thenStratio3=2if (shadowtop3 / abody3) > 1 and (shadowtop3 / abody3) < 2 thenStratio3=3if (shadowtop3 / abody3) > 2 thenStratio3=4endifendifendifendifif (shadowtop4 / abody4)<0.15 thenStratio4=1elseif (shadowtop4 / abody4) > 0.15 and (shadowtop4 / abody4) < 1 thenStratio4=2if (shadowtop4 / abody4) > 1 and (shadowtop4 / abody4) < 2 thenStratio4=3if (shadowtop4 / abody4) > 2 thenStratio4=4endifendifendifendifbodytop=max(open[1], close[1])bodytop1=max(open[2], close[2])bodytop2=max(open[3], close[3])bodytop3=max(open[4], close[4])bodytop4=max(open[5], close[5])bodybottom=min(open[1], close[1])bodybottom1=min(open[2], close[2])bodybottom2=min(open[3], close[3])bodybottom3=min(open[4], close[4])bodybottom4=min(open[5], close[5])shadowtop=high[1]-bodytopshadowtop1=high[2]-bodytop1shadowtop2=high[3]-bodytop2shadowtop3=high[4]-bodytop3shadowtop4=high[5]-bodytop4shadowbottom=bodybottom-low[1]shadowbottom1=bodybottom1-low[2]shadowbottom2=bodybottom2-low[3]shadowbottom3=bodybottom3-low[4]shadowbottom4=bodybottom4-low[5]longcandle= (ratio>0.6)GapBottom=(bodybottom - bodytop1) / averagetruerange[7]GapBottom1=(bodybottom1 - bodytop2) / averagetruerange[7]GapBottom2=(bodybottom2 - bodytop3) / averagetruerange[7]GapBottom3=(bodybottom3 - bodytop4) / averagetruerange[7]Gaptop=(bodybottom1 - bodytop)/ averagetruerange[7]Gaptop1=(bodybottom2 - bodytop1)/ averagetruerange[7]Gaptop2=(bodybottom3 - bodytop2)/ averagetruerange[7]Gaptop3=(bodybottom4 - bodytop3)/ averagetruerange[7]TrendUp=(ADX[14]>23 AND DI[14](close)>0)TrendDown=(ADX[14]>23 AND DI[14](close)<0)MorningStar=lunga and piccola1 and lunga2 and body>0 and body2<0 and open[1]>Bodybottom1 and open[1]<open[3] and Bodybottom1<open[3] and close[1]>bodytop1 and bodytop1<close[3] and Bodybottom1<close[3] and close[1]>Bodybottom1 and bodytop1<open[3] and mid[2]<close[1] AND min(open,close) > bodybottom // and (close-open)>0ThreeStarsInTheSouth=body2<0 and Sbratio2=2 and lunga2 and stratio2/abody2<0.1 and body1<0 and range[3]>range[2] and low[2]>low[3] and abody<abody1 and body<0 and close[1]>low[2] and close[1]<high[2] and sbratio/abody<0.1 and stratio/abody<0.1 AND min(open,close) > bodybottom // and (close-open)>0ThreeLineStrike=body1<0 and body2<0 and body3<0 and close[4]>close[3] and close[3]>close[2] and body>0 and open[1]<close[2] and close[1]>open[4]AND min(open,close) > bodybottom // and (close-open)>0MatHold=body4>0 and Gapbottom3>0.4 and lunga4 and body3<0 and body2<0 and abody4>abody3 and abody2<abody4 and abody1<abody4 and close[4]>bodybottom2 and bodybottom2>bodybottom1 and close[2]>low[5] and body>0 and lunga and close[1]>high[4]AND min(open,close)> bodybottomThreeOutsideUp=body2<0 and lunga1 and body1>0 and body>0 and open[2]<low[3] and close[2]>high[3] and open[1]>close[2]AND min(open,close)> bodybottomRisingThreeMethods=body>0 and body4>0 and lunga4 and lunga and abody4>abody3 and abody4>abody2 and abody4>abody2 and abody>abody3 and abody>abody2 and abody>abody1 and bodybottom3>bodybottom2 and bodybottom2>bodybottom1 and bodytop3>bodytop2 and bodytop2>bodytop1 and low[2]>low[5] and low[3]>low[5] and low[4]>low[5] and high[4]<high[5] and high[3]<high[5] and high[2]<high[5] and close[1]>close[5]AND min(open,close)> bodybottomBullishSeparatingLines=body1<0 and lunga1 and body>0 and ((max(bodytop1,bodybottom)-min(bodytop1,bodybottom))/abody)<0.2AND min(open,close)> bodybottomBeltHoldLine=lunga and body>0 and Stratio=1 and low[1]=open[1]AND min(open,close)> bodybottomAbandonedBaby=body2<0 and body>0 and lunga2 and lunga and extrapiccola1 and open[1]>high[2] and close[3]>high[2] and gaptop1 AND min(open,close)> bodybottomThreeStarsInTheNorth=body2>0 and stratio2=2 and lunga2 and sbratio2/abody2<0.1 and body1>0 and body>0 and range[3]>range[2] and high[3]>high[2] and abody<abody1 and close[1]>low[2] and close[1]<high[2] and stratio/abody<0.1 and sbratio/abody<0.1 AND max(open,close)< bodybottomBearishEngulfing=body1>0 and body<0 and open[1]>close[2] and close[1]<open[2] and abody1/abody<0.6AND max(open,close)< bodybottomIdenticalThreeCrows=body<0 and body1<0 and body2<0 and ((max(bodybottom2,bodytop1)-min(bodybottom2,bodytop1))/abody1)<0.1 and ((max(bodybottom1,bodytop)-min(bodybottom1,bodytop))/abody)<0.1 and lunga and lunga1 and lunga2 AND max(open,close)< bodybottomBearishMatHold=body4<0 and body3>0 and body<0 and body1>0 and abody3<abody4 and close[5]>close[4] and bodybottom3<bodybottom2 and bodybottom2<bodybottom1 and Bodytop3<Bodytop2 and close[1]<low[4]AND min(open,close) > bodybottomEveningStar=lunga and piccola1 and lunga2 and body<0 and body1>0 and body2>0 and open[1]<open[2] and open[1]>open[3] and open[2]>open[3] and close[1]<close[2] and close[1]<close[3] and close[2]>close[3] and mid<close[2] and mid<close[3] and mid1>close[3] and open[1]<close[2] and open[1]<close[3] and open[2]>close[3] and close[1]<open[2] and close[1]<open[3] and close[2]>open[3]AND max(open,close)< bodybottomFallingThreeMethods=body<0 and body4<0 and lunga and lunga4 and abody>abody1 and abody>abody2 and abody>abody3 and abody4>abody1 and abody4>abody2 and abody4>abody3 and bodybottom3<bodybottom2 and bodybottom2<bodybottom1 and bodytop3<bodytop2 and bodytop2<bodytop1 and high[5]>bodytop1 and low[5]<bodybottom1 and close[1]<close[5]AND max(open,close)< bodybottomBearishAbandonedBaby=body2>0 and body<0 and lunga2 and ((bodytop1-bodybottom1)/abody)<0.05 and lunga and open[1]<low[2] and gaptop AND max(open,close)< bodybottomThreeWhiteSoldiers=body2>0 and body1>0 and body>0 and abody1=>abody2 and abody=>abody1 and open[1]>open[2] and open[2]>open[3] and open[1]<close[2] and open[2]<close[3]AND min(open,close) > bodybottomBullishHarami=body1<0 and body>0 and bodybottom>bodybottom1 and bodytop<bodytop1 and high[1]=<high[2] and low[1]=>low[2]AND min(open,close) > bodybottomBearishHarami=body1>0 and body<0 and bodybottom>bodybottom1 and bodytop<bodytop1 and high[1]=<high[2] and low[1]=>low[2]AND max(open,close)< bodybottomBullishHaramiInverted=body2<0 and body1>0 and body>0 and bodybottom1>bodybottom2 and bodytop1<bodytop2 and high[2]=<high[3] and low[2]=>low[3] and abody>abody1 and open[1]>open[2]AND min(open,close) > bodybottomBearishHaramiInverted=body2>0 and body1<0 and body<0 and bodybottom1>bodybottom2 and bodytop1<bodytop2 and high[2]=<high[3] and low[2]=>low[3] and abody>abody1 and open[1]<open[2]AND min(open,close) > bodybottomBullishEngulfing=body1<0 and body>0 and bodybottom<bodybottom1 and bodytop>bodytop1 and (abody1/abody)<0.6 AND min(open,close) > bodybottomDarkCloudCover=body1>0 and body<0 and bodybottom<mid1 and bodybottom>open[2] and open[1]=>high[2]AND max(open,close)< bodybottomPiercingLine=body1<0 and body>0 and bodytop>mid1 and bodytop<open[2] and open[1]=<low[2]AND min(open,close) > bodybottomHammer=piccola and shadowbottom/abody>2 and shadowtop/abody<0.1 AND min(open,close) > bodybottomShootingStar=piccola and shadowbottom/abody<0.1 and shadowtop/abody>2AND max(open,close)< bodybottomDojiStar=open[1]=close[1] and (min(shadowtop,shadowbottom)/max(shadowtop,shadowbottom))<0.85 and (min(shadowtop,shadowbottom)/max(shadowtop,shadowbottom))>0.5 and shadowtop<(dimension*2)DojiLongLeggend=open[1]=close[1] and (min(shadowtop,shadowbottom)/max(shadowtop,shadowbottom))<0.85 and (min(shadowtop,shadowbottom)/max(shadowtop,shadowbottom))>0.5 and shadowtop>(dimension*2)DojiGravestone=open[1]=close[1] and low[1]=bodybottom and shadowtop>(dimension*2)AND max(open,close)< bodybottomDojiDragonfly=open[1]=close[1] and high[1]=bodytop and shadowbottom>(dimension*2)AND max(open,close)< bodybottomDojiFourPriced=open[1]=close[1] and high[1]=bodytop and low[1]=BodybottomLongWhite= body>0 and extralunga AND min(open,close) > bodybottomLongBlack=body<0 and extralunga AND max(open,close)< bodybottomWhiteMarabozu=body>0 and low[1]=bodybottom and high[1]=bodytop and lunga AND min(open,close) > bodybottomBlackMarabozu=body<0 and low[1]=bodybottom and high[1]=bodytop and lunga AND max(open,close)< bodybottomBlackOpeningMarabozu=body<0 and low[1]<bodybottom and high[1]=bodytop and lunga AND max(open,close)< bodybottomWhiteOpeningMarabozu=body>0 and low[1]=bodybottom and high[1]>bodytop and lunga AND min(open,close) > bodybottomWhiteClosingMarabozu=body>0 and low[1]<bodybottom and high[1]=bodytop and lunga AND min(open,close) > bodybottomBlackClosingMarabozu=body<0 and low[1]=bodybottom and high[1]>bodytop and lunga AND max(open,close)< bodybottomCanUpUp5=MatHold or RisingThreeMethods or BearishMatHoldCanUpUp3=ThreeWhiteSoldiersCanUpUp2=BearishHaramiInverted or BullishSeparatingLinesCanDownUp5=BearishMatHoldCanDownup4=MatHoldCanDownUp3=ThreeOutsideUp or ThreeStarsInTheSouth or MorningStar or AbandonedBabyCanDownUp2=PiercingLine or BullishHaramiInverted or BullishHarami or BullishEngulfingCanDownUp1=Hammer or BeltHoldLineCanUp1=DojiDragonfly or WhiteOpeningMarabozu or WhiteClosingMarabozu or WhiteMarabozu or LongWhiteCanUpDown3=EveningStar or IdenticalThreeCrows or ThreeStarsInTheNorth or BearishAbandonedBabyCanUpDown2=BearishEngulfing or DarkCloudCover or BearishHaramiCanDownDown5=FallingThreeMethodsCanUpDown1=ShootingStarCanDown1=DojiGravestone or BlackOpeningMarabozu or BlackClosingMarabozu or BlackMarabozu or LongBlackIF (trandup and (CanUpUp5 or Canupup2 or Canupup3 or canup1)) AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETelseif (tranddown and (Candownup5 or Candownup3 or Candownup2 or candownup1)) AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETENDIFendifIF (trandup and (CanUpdown3 or Canupdown2 or Canupdown1 or Candown1)) thenSELL AT MARKETelseif (tranddown and Candowndown5 ) THENSELL AT MARKETendifENDIFIF (trandup and (CanUpdown3 or Canupdown2 or Canupdown1 or Candown1)) and not daysForbiddenEntry thenSELLSHORT 1 CONTRACT AT MARKETelseif (tranddown and Candowndown5 ) and not daysForbiddenEntry THENSELLSHORT 1 CONTRACT AT MARKETendifENDIFIF (trandup and (CanUpUp5 or Canupup2 or Canupup3 or canup1)) THENEXITSHORT AT MARKETelseif (tranddown and (Candownup5 or Candownup3 or Candownup2 or candownup1)) THENEXITSHORT AT MARKETENDIFendif05/04/2020 at 12:32 PM #129812Ho scoperto che il problema me lo da solo la versione 10,3. Io avevo creato l’indicatore nella versione demo 11.
Come posso recuperare il codice corretto?
Gentilissimo
05/04/2020 at 1:34 PM #129831Non è che nella versione 11 sia scomparso l’errore, è che la segnalazione di variabili inutilizzate è stata tolta perché molti si sono lamentati perché fastidiosa.
Nelle proprietà le puoi vedere.
La soluzione è usare un blocco IF…ENDIF fasullo con TUTTI quei nomi indicati nella foto, collegate con OR oppure AND (è ininfluente):
12IF Variabile1 AND Variabile2 AND ........ THENENDIFovviamente tra IF ed ENDIF non va messo niente.
05/04/2020 at 9:08 PM #129922Sempre molto gentile. Grazie ancora
-
AuthorPosts
Find exclusive trading pro-tools on